Open basham opened 9 years ago
CKEditor has no build-in character limit, like the maxlength
HTML attribute. Would have to use an existing plugin or create something custom.
Have to consider how markup relates to character count. If not included, which is more sensible, then the HTML has to be stripped out in order to ensure a proper plain text count (maximum of 1000 characters, as determined by Success Criteria). Then you're betting that there's no combination of markup that CKEditor would create that would push the character count beyond the database limit (4000 characters).
http://stackoverflow.com/a/27720326
window.onload = function() {
CKEDITOR.instances.mytext.on( 'key', function() {
var str = CKEDITOR.instances.mytext.getData();
if (str.length > 50) {
CKEDITOR.instances.mytext.setData(str.substring(0, 50));
}
} );
};
Something like: