- Issue created by @gaurav_manerkar
When maxlength is configured with a "Hard" limit option for a field with CKEditor 5 widget, the editor text doesn't seem to get trimmed when the page is loaded.
The counter seems to work fine, but nothing happens to the editor text.
1. Enable the core ckeditor5 module.
2. Enable the maxlength module.
3. Go to any content entity type and add a field of type "Text (formatted, long)".
4. Set the "Text area (multiple rows)" widget for the field created in step #3.
5. Configure widget maxlength settings -
Maximum length: 20 characters
Keep others settings as they are.
6. Create node content, and for the text area field, add content of more than 20 characters. Save node.
7. Go to the widget settings section again and enable the "Hard" limit option.
8. Go to the edit node page of the content created in step #6.
You will find that the text is not trimmed to 20 characters. The counter will show "0" characters left.
The ckeditor function defined in maxlength.js
file only triggers when a change to editor text is made. Update the logic to also work for page load/form or field rebuilt via ajax
callback.
Active
3.0
Code