32
Views
5
Comments
[CKEditor 5] [CKEDITOR 5] Caracters limit and Image size
ckeditor-5
Reactive icon
Forge asset by Vincent Koning
Service Studio Version
11.55.14 (Build 64054)

Good morning from here, I'm facing two problems with CkEditor 5, someone that faced this kind of problema can help me.


First problem - Caracters Limitation

- I have the possibility to put 10k caracteres in a ckeditor field, but when I pass this max length, always leave me save without any problem,  how to limit the caracters, because i know that in ckeditor has events that i can use to know how much caracters the user typed, but how to limit this, i tried a lot of possibilities with javascript, but without success.


Second problem - Image size

- In ckeditor 5 i have the possibility to upload images, but just found a lot of configuration and tutporials, but how to create a limitation is this case? One example will be accept just images size until 2mb, but how to solve this in Outsystems.


Obs: I'm not saving the images in local Db, i need to to upload to Amazon S3, for now i just did the test with screen captures that is to small, but one test with a complex image size of 5mb, i receive errors.

2025-03-11 05-02-41
Ragu Vasu

Hi David Mafra Filho,

Good Evening,

In CKEditor the local variable cfg_wcount is set by default to -1. If you change it the max length you want, user will no longer be able to enter more that the specified maximum.


extraPlugins: 'wordcount',


wordcount: {

    showParagraphs: true,    // Whether or not you want to show the Paragraphs Count


    showWordCount: true,     // Whether or not you want to show the Word Count


    showCharCount: true,     // Whether or not you want to show the Char Count


    countSpacesAsChars: true,     // Whether or not you want to count Spaces as Chars


    countHTML: false,     // Whether or not to include Html chars in the Char Count

    

    maxWordCount: -1,     // Maximum allowed Word Count, -1 is default for unlimited


    maxCharCount: -1,     // Maximum allowed Char Count, -1 is default for unlimited

}


On the demo module in CKEditor, check out the preparation of the CKEDemo screen.


2025-06-14 12-17-01
David Mafra Filho

Hey Ragu, thanks for your answer, but I'm working with ckeditor 5, this kind of configuration I did to work with ckeditor 4, but with ckeditor 5 is different.

If I wrong, just let me know.

2022-12-22 10-00-39
Beatriz Sabino

Hi David,

For the word count, there is a WordCount event that you can use. You can create a variable to set the character limit, and then check in this event if the user has reached the limit. If they have, you can set the editor to "read-only" using the SetEditorState action.

Regarding the image limitation, I’ve only found documentation on resizing images, which you can see being used in the Demo App for this component.

2025-06-14 12-17-01
David Mafra Filho

Hi Beatriz,

I will try this approach about character limit, thanks a lot about it.

About the images i will see about this.


Thanks again.

2025-07-22 10-30-27
Mandar Deshpande

In your case, I think CKEditor's UploadAdapter can be used to validate the file size before uploading it to S3.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.