Set editing limit
Allow set chars or words limit
Jodit.make('#editor', {
/**
* limit words count
*/
limitWords: 100,
/**
* limit chars count
*/
limitChars: 400,
/**
* limit html chars count
*/
limitHTML: true
});
limitWords
- Limits the number of words separated by spaces. Limitation does not include HTML tags and attributeslimitChars
- Limits the number of characters not including spaces and special characters. Tags and attributes are also ignored.limitHTML
- If this option is enabled, thenlimitWords
andlimitChars
count tags and their attributes.
Events
When limits are reached, a series of events occur:
limit.limit
- Upon reaching any of the limitsdenyChars.limit
- When the character limit is reacheddenyWords.limit
- Upon reaching any wordsdenyPaste.limit
- If the user wanted to insert text beyond the limits
const jodit = Jodit.make('#editor', {
limitWords: 100
});
jodit.e.on(
'limit.limit',
jodit.async.debounce(() => {
// Allow 'error' | 'info' | 'success' See messages module.
editor.message.error('Limit reached!');
return false;
}, 300)
);