Opened 14 years ago
Closed 14 years ago
#8624 closed Task (invalid)
Maximum characters and maximum line limit for CKEditor
| Reported by: | Pavan | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | General | Version: | |
| Keywords: | Cc: |
Description
Hi,
I am using CKEditor i want to set a character limit and number limit for the text area. If any one of the limit reached the user should be blocked.
For this i need to set max limit for CKEditor.
Please Help.
Regards, Pavan.
Change History (1)
comment:1 Changed 14 years ago by
| Keywords: | Character limit and Line limit removed |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |
| Version: | 3.6.2 |

First of all if you are seeking help please use one of our forums (http://cksource.com/forums/index.php) and not bug tracker!!!
Second - To make it you will have to combine pure JavaScript method of character limiter and some CKEditor methods:
Here are the links that might help:
And a code that might be used as a jump start (it can be used as in page, config.js or inside a plugin)
// catches changes in WYSIWYG mode. editor.on( 'contentDom', function() { editor.document.on( 'keydown', function( event ) { if ( event.data.$.ctrlKey || event.data.$.metaKey ) return; var keyCode = event.data.$.keyCode; // Filter movement keys and related if ( keyCode == 8 || keyCode == 13 || keyCode == 32 || ( keyCode >= 46 && keyCode <= 90 ) || ( keyCode >= 96 && keyCode <= 111 ) || ( keyCode >= 186 && keyCode <= 222 ) ) window.setTimeout( function() { somemethod( editor ); }, 100 ); } ); } ); // If you won't fire this event keydowns won't work // until you switch to source and back. editor.fire( 'contentDom' );