Opened 18 years ago
Last modified 15 years ago
#397 confirmed New Feature
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 (6)
comment:1 Changed 18 years ago by
Keywords: | length maxlength removed |
---|
comment:3 Changed 17 years ago by
Keywords: | Confirmed added |
---|
comment:5 Changed 15 years ago by
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.
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