The WordCount feature provides a possibility to track the number of words and characters written in the text editor. This feature helps planning the meeting assignment requirements, overall content volume. Visit CKEditor official website and download latest version of Editor.
Word and character count plugin – CKEditor 5
use the following HTML page structure:
<div id="text-editor">
<p>Hello world.</p>
</div>
<div id="word-count-div"></div>
ClassicEditor
.create( document.querySelector( '#text-editor' ), {
// Configuration details.
} )
.then( editor => {
const wordCountPlugin = editor.plugins.get( 'WordCount' );
const wordCountWrapper = document.getElementById( 'word-count-div' );
wordCountWrapper.appendChild( wordCountPlugin.wordCountContainer );
} )
.catch( ... );
Word and character count plugin – CKEditor 4
If you are using Editor old version, Please download CKEditor 4 word count plugin from GITHUB. Unzip files and move to your ckeditor plugins folder -ckeditor\plugins\wordcount.
CKEDITOR.replace('text-editor', {
extraPlugins: 'wordcount',
wordcount: {
showParagraphs: false,
showWordCount: false,
showCharCount: true,
countSpacesAsChars:true,
countHTML:false,
maxWordCount: -1,
maxCharCount: 1100 //word limit
},
});