ckeditor-wordcount-plugin
Advanced tools
Comparing version 1.17.10 to 1.17.11
{ | ||
"name": "ckeditor-wordcount-plugin", | ||
"version": "1.17.10", | ||
"version": "1.17.11", | ||
"author": "w8tcha", | ||
@@ -5,0 +5,0 @@ "description": "WordCount Plugin for CKEditor Editor", |
@@ -29,3 +29,3 @@ CKEditor-WordCount-Plugin | ||
```javascript | ||
config.extraPlugins = 'wordcount,notification'; | ||
config.extraPlugins = 'wordcount'; | ||
``` | ||
@@ -32,0 +32,0 @@ |
@@ -9,3 +9,3 @@ /** | ||
lang: "ar,bg,ca,cs,da,de,el,en,es,eu,fa,fi,fr,he,hr,hu,it,ka,ko,ja,nl,no,pl,pt,pt-br,ru,sk,sv,tr,uk,zh-cn,zh,ro", // %REMOVE_LINE_CORE% | ||
version: "1.17.10", | ||
version: "1.17.11", | ||
requires: "htmlwriter,notification,undo", | ||
@@ -186,7 +186,9 @@ bbcodePluginLoaded: false, | ||
if (tmp.textContent == "" && typeof tmp.innerText == "undefined") { | ||
// Parse filtered HTML, without applying it to any element in DOM | ||
var tmp = new DOMParser().parseFromString(html, 'text/html'); | ||
if (!tmp.body || !tmp.body.textContent) { | ||
return ""; | ||
} | ||
return tmp.textContent || tmp.innerText; | ||
return tmp.body.textContent || tmp.body.innerText; | ||
} | ||
@@ -260,4 +262,11 @@ | ||
function countWords(text) { | ||
var normalizedText = text.replace(/(<([^>]+)>)/ig, " ").replace(/(\r\n|\n|\r)/gm, "").replace(/^\s+|\s+$/g, "") | ||
.replace(" ", " "); | ||
/** | ||
* we may end up with a couple of extra spaces in a row with all these replacements, but that's ok | ||
* since we're going to split on one or more delimiters when we generate the words array | ||
**/ | ||
var normalizedText = text.replace(/(<([^>]+)>)/ig, " ") //replace html tags, i think? | ||
.replace(/(\r\n|\n|\r)/gm, " ") //replace new lines(in many forms) | ||
.replace(/^\s+|\s+$/g, " ") //replace leading or trailing multiple spaces | ||
.replace(" ", " "); //replace html entities indicating a space | ||
@@ -264,0 +273,0 @@ normalizedText = strip(normalizedText); |
1191
69913
49