Reputation: 147
I'm using wordcount
plugin for CKEditor
. It perfectly displays wordcount and characters count ignoring spaces.
How do I get only characters(without spaces/line-breaks)? Is there any default API provided CKeditor
or wordcount plugin?
editor.getData()
- returns complete text with HTML
editorContent.text().trim()
- returns text(without HTML) but it doesn't ignore line-breaks and spaces.
Upvotes: 1
Views: 197
Reputation:
No, there is no official API or plugin for that.
Instead of trimming editorContent.text()
you could replace
all whitespace characters using regex (e.g. /\s/g
).
Upvotes: 0