Ticket #397 (confirmed New Feature)

Opened 8 years ago

Last modified 4 years ago

MaxLength functionality

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

Description

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

comment:1 Changed 8 years ago by fredck

  • 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:
http://sourceforge.net/tracker/index.php?func=detail&aid=1510662&group_id=75348&atid=737639

comment:2 Changed 7 years ago by alfonsoml

#605 has been marked as dup

comment:3 Changed 7 years ago by w.olchawa

  • Keywords Confirmed added

comment:4 Changed 7 years ago by w.olchawa

#854 is a similar request - a char counter.

comment:5 Changed 5 years ago by tobiasz.cudnik

  • Milestone set to 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 4 years ago by fredck

  • Milestone CKEditor 3.x deleted

Milestone CKEditor 3.x deleted

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