Opened 11 years ago

Last modified 7 years ago

#397 confirmed New Feature

MaxLength functionality

Reported by: Campbeln Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


The ability to define a MaxLength (in characters, including underlying HTML tags) would be very useful in order to ensure that the FCKeditor data will "fit" into a Db column. I'd think that this functionality would be relativity trivial if it were to leverage the Undo/Redo functionality (on a change, the length is tested and if it's too long then automatically "undo" the change and display some kind of message). It would also be nice if this functionality could be pegged to the underlying Textarea's maxlength attribute value (even though this is not a standard recognized attribute on a Textarea, though I could be convinced to the contrary).

I cannot seem to find information relating to this feature in the Wiki (which I found very odd) but if this is a dupe or if there is a (non-obvious) method for accomplishing this with FCKeditor I'd greatly appreciate the information.

Change History (6)

comment:1 Changed 11 years ago by Frederico Caldeira Knabben

Keywords: length maxlength removed

This is actually not trivial as it seams. The problem is that the final contents posted by FCKeditor is not the innerHTML of the editing area. The editor processes the DOM tree for the final output, and the resulting length is certainly different after processing.

In the other hand, having to process the HTML to get its length on every single user action would cause strong CPU usage and possibly usability problems, mainly noted when working on long documents.

Maybe a doable solution would be some kind of button that, when clicked by the user, updates a length label. So, it would be a user action to trigger it, informing the user about the current length. Then, the real check, with a possible error message, should be finally done in the server side when receiving the posted data.

In any case, a proposed plugin to achieve the requested behavior can be found here:

comment:2 Changed 10 years ago by Alfonso Martínez de Lizarrondo

#605 has been marked as dup

comment:3 Changed 10 years ago by Wojciech Olchawa

Keywords: Confirmed added

comment:4 Changed 10 years ago by Wojciech Olchawa

#854 is a similar request - a char counter.

comment:5 Changed 8 years ago by Tobiasz Cudnik

Milestone: CKEditor 3.x

We can trigger it in same moment we take undo snapshots. It will give at maximum 20 chars of error.

On user demand i'm scheduling this for 3.x milestone.

comment:6 Changed 7 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.x

Milestone CKEditor 3.x deleted

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy