user2608601
user2608601

Reputation: 147

CKEditor: How to get only characters

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

Answers (1)

user9025529
user9025529

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

Related Questions