Word Count
Plugin alias: wordcount
editor42.init({
plugins: 'wordcount'
});
Tracks and displays word count, character count, and character count without spaces for both the full document and the current selection. Fires periodic count updates in response to content changes and provides a dialog with all counts.
Commands
| Command | Description |
|---|---|
editor42WordCount | Opens the Word Count dialog. |
Toolbar buttons
| Button | Type | Description |
|---|---|---|
wordcount | Button | Opens the Word Count dialog. |
Menu items
| Item | Description |
|---|---|
wordcount | Opens the Word Count dialog. |
Events
| Event | Description |
|---|---|
wordCountUpdate | Fired when counts are recalculated. Payload: { wordCount: { words, characters, charactersWithoutSpaces } }. |
API
| Method | Description |
|---|---|
body.getWordCount() | Returns word count for the full document. |
body.getCharacterCount() | Returns character count for the full document. |
body.getCharacterCountWithoutSpaces() | Returns character count without spaces for the full document. |
selection.getWordCount() | Returns word count for the current selection. |
selection.getCharacterCount() | Returns character count for the current selection. |
selection.getCharacterCountWithoutSpaces() | Returns character count without spaces for the current selection. |
getCount() | Deprecated. Returns body word count. Use body.getWordCount() instead. |