how to set character limit in ckeditor 5

Hello dev in this post character limit in ckeditor. CKEDITOR.instances.editor1.getData().so give you how to set character limit in ckeditor 5

Parameters are passed through config.js:

config.wordcount = {

// Whether or not you want to show the Paragraphs Count
showParagraphs: false,

// Whether or not you want to show the Word Count
showWordCount: false,

// Whether or not you want to show the Char Count
showCharCount: true,

// Whether or not you want to count Spaces as Chars
countSpacesAsChars: true,

// Whether or not to include Html chars in the Char Count
countHTML: false,

// Maximum allowed Word Count, -1 is default for unlimited
maxWordCount: 400,

// Maximum allowed Char Count, -1 is default for unlimited
maxCharCount: 400};

Do you know some way to do this?

Thanks in advance!

how to set character limit in ckeditor

Solution

how to set character limit in ckeditor 5

you are verify please CKEDITOR.replace() in your CKEDITOR config.js

var wordCountA = {
    showParagraphs: false,
    showWordCount: true,
    showCharCount: true,
    countSpacesAsChars: false,
    countHTML: false,
    maxWordCount: -1,
    maxCharCount: 2000}
}

var wordCountB = {
    showParagraphs: false,
    showWordCount: true,
    showCharCount: true,
    countSpacesAsChars: false,
    countHTML: false,
    maxWordCount: -1,
    maxCharCount: 5000}
}

CKEDITOR.replace('editorone', {wordcount: wordCountA});
CKEDITOR.replace('editortwo', {wordcount: wordCountB});

Recent post like how to set character limit in ckeditor 5

Leave a Comment