From 535fa051cc88d42e9b4c7b0f988d567eeaafe8b9 Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Fri, 25 Sep 2020 21:43:36 +0200
Subject: [PATCH] [TASK] Update ckeditor-wordcount-plugin to 1.17.6

Executed commands:

  yarn add ckeditor-wordcount-plugin@^1.17.6
  grunt build

Resolves: #92420
Releases: master, 10.4, 9.5
Change-Id: I82bfead7265a70afdec0b3f2e331afb2b3c2ef70
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65891
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
---
 Build/package.json                            |   2 +-
 Build/yarn.lock                               |   8 +-
 .../plugins/wordcount/css/wordcount.css       |   4 +-
 .../Contrib/plugins/wordcount/lang/ar.js      |   1 +
 .../Contrib/plugins/wordcount/lang/bg.js      |  17 +
 .../Contrib/plugins/wordcount/lang/ca.js      |   1 +
 .../Contrib/plugins/wordcount/lang/cs.js      |   1 +
 .../Contrib/plugins/wordcount/lang/da.js      |   1 +
 .../Contrib/plugins/wordcount/lang/de.js      |   1 +
 .../Contrib/plugins/wordcount/lang/el.js      |   1 +
 .../Contrib/plugins/wordcount/lang/en.js      |   1 +
 .../Contrib/plugins/wordcount/lang/es.js      |   1 +
 .../Contrib/plugins/wordcount/lang/eu.js      |   4 +
 .../Contrib/plugins/wordcount/lang/fa.js      |   1 +
 .../Contrib/plugins/wordcount/lang/fi.js      |   1 +
 .../Contrib/plugins/wordcount/lang/fr.js      |   1 +
 .../Contrib/plugins/wordcount/lang/he.js      |   1 +
 .../Contrib/plugins/wordcount/lang/hr.js      |  17 +-
 .../Contrib/plugins/wordcount/lang/hu.js      |   1 +
 .../Contrib/plugins/wordcount/lang/it.js      |   1 +
 .../Contrib/plugins/wordcount/lang/ja.js      |   1 +
 .../Contrib/plugins/wordcount/lang/ko.js      |  16 +
 .../Contrib/plugins/wordcount/lang/nl.js      |   1 +
 .../Contrib/plugins/wordcount/lang/no.js      |   1 +
 .../Contrib/plugins/wordcount/lang/pl.js      |   1 +
 .../Contrib/plugins/wordcount/lang/pt-br.js   |   1 +
 .../Contrib/plugins/wordcount/lang/pt.js      |   1 +
 .../Contrib/plugins/wordcount/lang/ro.js      |  15 +
 .../Contrib/plugins/wordcount/lang/ru.js      |   3 +-
 .../Contrib/plugins/wordcount/lang/sk.js      |   3 +-
 .../Contrib/plugins/wordcount/lang/sv.js      |   2 +
 .../Contrib/plugins/wordcount/lang/tr.js      |   1 +
 .../Contrib/plugins/wordcount/lang/uk.js      |  17 +
 .../Contrib/plugins/wordcount/lang/zh-cn.js   |   4 +
 .../Contrib/plugins/wordcount/lang/zh.js      |   4 +
 .../Contrib/plugins/wordcount/plugin.js       | 893 ++++++++++--------
 36 files changed, 632 insertions(+), 398 deletions(-)
 create mode 100644 typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/bg.js
 create mode 100644 typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ko.js
 create mode 100644 typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ro.js
 create mode 100644 typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/uk.js

diff --git a/Build/package.json b/Build/package.json
index 1949b0fa2752..dddba8f7cae5 100644
--- a/Build/package.json
+++ b/Build/package.json
@@ -76,7 +76,7 @@
     "broadcastchannel-polyfill": "^1.0.0",
     "chart.js": "^2.9.3",
     "chosen-js": "^1.8.7",
-    "ckeditor-wordcount-plugin": "^1.17.2",
+    "ckeditor-wordcount-plugin": "^1.17.6",
     "ckeditor4": "^4.15.0",
     "codemirror": "^5.58.1",
     "cropperjs": "^1.5.7",
diff --git a/Build/yarn.lock b/Build/yarn.lock
index ddfc3fb02580..7326c1c347a6 100644
--- a/Build/yarn.lock
+++ b/Build/yarn.lock
@@ -1361,10 +1361,10 @@ circular-json@^0.3.1:
   resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66"
   integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==
 
-ckeditor-wordcount-plugin@^1.17.2:
-  version "1.17.2"
-  resolved "https://registry.yarnpkg.com/ckeditor-wordcount-plugin/-/ckeditor-wordcount-plugin-1.17.2.tgz#9bd528bcf3f2898948fc056d8fdbe80106e87381"
-  integrity sha512-CAS64xhKCQJE3TGIFQECBIrGNFp4neFRdhB4JQ5DiCvnZ36VXd7UydJm6UiIBXZEUag9ykdBe4n5anYIkG6sNA==
+ckeditor-wordcount-plugin@^1.17.6:
+  version "1.17.6"
+  resolved "https://registry.yarnpkg.com/ckeditor-wordcount-plugin/-/ckeditor-wordcount-plugin-1.17.6.tgz#cb1a2a988ce8c3f29cd701f38b120c3a03daef85"
+  integrity sha512-73Q0/W445UoToQ8fyaBhXxhsZXMOxoeGGaIZ1HyiPc1nisK1gbIGAFi1ksgKoavQhri0+sOfpnYSFXDEC608EQ==
 
 ckeditor4@^4.15.0:
   version "4.15.0"
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/css/wordcount.css b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/css/wordcount.css
index fe72026bce14..41589d7ced7d 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/css/wordcount.css
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/css/wordcount.css
@@ -1,3 +1,3 @@
 .cke_wordcount {display:block;float:right;margin-top:-2px;margin-right:3px;color:black;}
-
-.cke_wordcountLimitReached {color:red! important}
\ No newline at end of file
+.cke_wordcount_rtl {float:left;}
+.cke_wordcountLimitReached {color:red! important}
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ar.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ar.js
index ef4d8f55adcc..7c181a4cdf55 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ar.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ar.js
@@ -5,6 +5,7 @@ CKEDITOR.plugins.setLang('wordcount', 'ar', {
     CharCount: 'حروف:',
     CharCountWithHTML: 'حروف مع إتش تي إم إل',
     Paragraphs: 'فقرات',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'لا يمكن اضافة هذا المحتوى لانه تجاوز الحد الاقصى',
     Selected: 'محدد: ',
     title: 'احصائيات'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/bg.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/bg.js
new file mode 100644
index 000000000000..1e37b6b7b187
--- /dev/null
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/bg.js
@@ -0,0 +1,17 @@
+/*
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+CKEDITOR.plugins.setLang('wordcount', 'bg', {
+    WordCount: 'Думи:',
+    WordCountRemaining: 'Оставащи думи',
+    CharCount: 'Знаци:',
+    CharCountRemaining: 'Знаци',
+    CharCountWithHTML: 'Знаци (с HTML):',
+    CharCountWithHTMLRemaining: 'Оставащи знаци (с HTML)',
+    Paragraphs: 'Параграфи:',
+    ParagraphsRemaining: 'Paragraphs remaining',
+    pasteWarning: 'Съдържанието не може да бъде поставено, защото е над разрешения лимит',
+    Selected: 'Избрани: ',
+    title: 'Статистика'
+});
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ca.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ca.js
index 5e7ca1f164dd..19f67c458770 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ca.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ca.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'ca', {
     CharCount: 'Caràcters:',
     CharCountWithHTML: 'Caràcters (including HTML):',
     Paragraphs: 'Paragraphs:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Content can not be pasted because it is above the allowed limit',
     Selected: 'Selected: ',
     title: 'Estadístiques'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/cs.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/cs.js
index 3d6691f24518..6dbd0bf4a48f 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/cs.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/cs.js
@@ -8,6 +8,7 @@ CKEDITOR.plugins.setLang('wordcount', 'cs',
         CharCount: 'Znaků: ',
         CharCountWithHTML: 'Znaků (s HTML): ',
         Paragraphs: 'Odstavců: ',
+        ParagraphsRemaining: 'Paragraphs remaining',
         pasteWarning: 'Obsah nelze vložit',
         Selected: 'Výběr: ',
         title: 'Statistika'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/da.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/da.js
index b382b182bc95..aaf781a41b6f 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/da.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/da.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'da', {
     CharCount: 'Karakterer:',
     CharCountWithHTML: 'Karakterer (med HTML):',
     Paragraphs: 'Afsnit:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Indholdet kan ikke indsættes da det er længere end den tilladte grænse.',
     Selected: 'Markeret: ',
     title: 'Statistik'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/de.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/de.js
index 462e7729ccc2..42e298dead74 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/de.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/de.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'de', {
     CharCount: 'Zeichen:',
     CharCountWithHTML: 'Zeichen (inkl. HTML):',
     Paragraphs: 'Absätze:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Content can not be pasted because it is above the allowed limit',
     Selected: 'Selected: ',
     title: 'Statistik'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/el.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/el.js
index 58f2222c2659..2643c225e01c 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/el.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/el.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'el', {
     CharCount: 'Χαρακτήρες:',
     CharCountWithHTML: 'Χαρακτήρες (μαζί με HTML):',
     Paragraphs: 'Paragraphs:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Content can not be pasted because it is above the allowed limit',
     Selected: 'Selected: ',
     title: 'Στατιστικά'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/en.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/en.js
index a762d8487e44..581790f7bab7 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/en.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/en.js
@@ -10,6 +10,7 @@ CKEDITOR.plugins.setLang('wordcount', 'en', {
     CharCountWithHTML: 'Characters (with HTML):',
     CharCountWithHTMLRemaining: 'Characters (with HTML) remaining',
     Paragraphs: 'Paragraphs:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Content cannot be pasted because it is above the allowed limit',
     Selected: 'Selected: ',
     title: 'Statistics'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/es.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/es.js
index c5385d9395c3..8cd41ff367fd 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/es.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/es.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'es', {
     CharCount: 'Carácteres:',
     CharCountWithHTML: 'Carácteres (con HTML):',
     Paragraphs: 'Párrafos:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'El contenido no se puede pegar, ya que se encuentra fuera del límite permitido',
     Selected: 'Seleccionado: ',
     title: 'Estadísticas'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/eu.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/eu.js
index 66a924520938..3d2e9c11511d 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/eu.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/eu.js
@@ -4,9 +4,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 CKEDITOR.plugins.setLang('wordcount', 'eu', {
     WordCount: 'Hitzak:',
+    WordCountRemaining: 'Gelditzen diren hitzak',
     CharCount: 'Karaktereak:',
+    CharCountRemaining: 'Gelditzen diren karaktereak',
     CharCountWithHTML: 'Karaktereak (HTMLarekin):',
+    CharCountWithHTMLRemaining: 'Gelditzen diren karaktereak (HTMLarekin)',
     Paragraphs: 'Paragrafoak:',
+    ParagraphsRemaining: 'Gelditzen diren paragrafoak',
     pasteWarning: 'Ezin da edukia itsatsi, onartutako muga gainditu duelako',
     Selected: 'Hautatuta: ',
     title: 'Estatistikak'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fa.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fa.js
index 5e71b6b2e342..e679255f22e2 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fa.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fa.js
@@ -6,6 +6,7 @@ CKEDITOR.plugins.setLang('wordcount', 'fa', {
     CharCount: 'کاراکتر:',
     CharCountWithHTML: 'کاراکترها (با HTML):',
     Paragraphs: 'پاراگراف:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'محتوای مورد نظر را نمی توان چسباند. زیرا این بیشتر از حد مجاز است.',
     Selected: 'انتخاب شده: ',
     title: 'آمار'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fi.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fi.js
index 444eaf8b91fc..827a72f70b74 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fi.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fi.js
@@ -8,6 +8,7 @@ CKEDITOR.plugins.setLang('wordcount', 'fi', {
     CharCount: 'Merkkejä:',
     CharCountWithHTML: 'Merkkejä (ml. HTML):',
     Paragraphs: 'Kappaleita:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Sisältöä ei voida liittää, koska se ylittää sallitun rajan.',
     Selected: 'Valittuna: ',
     title: 'Statistiikkaa'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fr.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fr.js
index 6c1e063a472e..1fa562b1901a 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fr.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/fr.js
@@ -5,6 +5,7 @@ CKEDITOR.plugins.setLang('wordcount', 'fr', {
     CharCount: 'Caractères :',
     CharCountWithHTML: 'Caractères (incluant HTML) :',
     Paragraphs: 'Paragraphes :',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Le contenu ne peut pas être collé car il dépasse la limite autorisée',
     Selected: 'Sélectionné :',
     title: 'Statistiques'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/he.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/he.js
index e6080dab5da6..43895e0a4bf2 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/he.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/he.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'he', {
     CharCount: 'תווים:',
     CharCountWithHTML: 'תווים (כולל HTML):',
     Paragraphs: 'פסקאות:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'לא ניתן להדביק תוכן בשל עודף תווים',
     Selected: 'נבחר: ',
     title: 'סטטיסטיקות'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hr.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hr.js
index ab9e5fae21bb..b66d154e2d15 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hr.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hr.js
@@ -2,12 +2,13 @@
 Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
-CKEDITOR.plugins.setLang('wordcount', 'hr', {
-    WordCount: 'Riječi:',
-    CharCount: 'Znakova:',
-    CharCountWithHTML: 'Znakova (uključujući HTML):',
-    Paragraphs: 'Paragraphs:',
-    pasteWarning: 'Content can not be pasted because it is above the allowed limit',
-    Selected: 'Selected: ',
-    title: 'Statistika'
+CKEDITOR.plugins.setLang("wordcount", "hr", {
+    WordCount: "Riječi:",
+    CharCount: "Znakova:",
+    CharCountWithHTML: "Znakova (uključujući HTML):",
+    Paragraphs: "Paragraphs:",
+    ParagraphsRemaining: "Paragraphs remaining",
+    pasteWarning: "Content can not be pasted because it is above the allowed limit",
+    Selected: "Selected: ",
+    title: "Statistika"
 });
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hu.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hu.js
index c403708740da..7866a8e9086f 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hu.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/hu.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'hu', {
     CharCount: 'Karakaterek:',
     CharCountWithHTML: 'Karakterek (HTML tagekkel):',
     Paragraphs: 'Bekezdések:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'A szöveget nem lehet beilleszteni, mert a megadott limit felett van',
     Selected: 'Kiválasztva: ',
     title: 'Statisztika'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/it.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/it.js
index 38ec86c5a40c..07717265ed04 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/it.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/it.js
@@ -8,6 +8,7 @@ CKEDITOR.plugins.setLang('wordcount', 'it', {
     CharCount: 'Caratteri:',
     CharCountWithHTML: 'Caratteri (HTML incluso):',
     Paragraphs: 'Paragrafi:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Il contenuto non può essere incollato poiché supera il limite massimo di caratteri disponibili',
     Selected: 'Selezionato: ',
     title: 'Statistiche'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ja.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ja.js
index c7fc0ce2c823..1d02684ab288 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ja.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ja.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'ja', {
     CharCount: '文字数:',
     CharCountWithHTML: '文字数 (HTMLタグを含む):',
     Paragraphs: '段落数:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: '文字数/単語数の上限を超えるため、貼り付けできません。',
     Selected: '選択中の字数:',
     title: 'ワードカウント'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ko.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ko.js
new file mode 100644
index 000000000000..53e0a471e0ed
--- /dev/null
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ko.js
@@ -0,0 +1,16 @@
+/*
+Korean translation by Maxime Houdais
+*/
+CKEDITOR.plugins.setLang('wordcount', 'ko', {
+    WordCount: '단어:',
+    WordCountRemaining: '남은 단어',
+    CharCount: '글자:',
+    CharCountRemaining: '자 남음',
+    CharCountWithHTML: '글자 와 HTML:',
+    CharCountWithHTMLRemaining: '남은 글자 와 HTML',
+    Paragraphs: '단락:',
+    ParagraphsRemaining: 'Paragraphs remaining',
+    pasteWarning: '허용 된 한도를 초과하여 콘텐츠를 붙여 넣을 수 없습니다.',
+    Selected: '선택:',
+    title: '통계'
+});
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/nl.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/nl.js
index ebbc9c774578..e2a81701fd9a 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/nl.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/nl.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'nl', {
     CharCount: 'Tekens:',
     CharCountWithHTML: 'Tekens (inclusief HTML):',
     Paragraphs: 'Paragrafen:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'De tekst kan niet worden geplakt omdat de limiet is overschreden',
     Selected: 'Geselecteerd: ',
     title: 'Statistieken'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/no.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/no.js
index 0932542b422b..e9fba5c45f92 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/no.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/no.js
@@ -4,6 +4,7 @@ CKEDITOR.plugins.setLang('wordcount', 'no', {
     CharCount: 'Tegn:',
     CharCountWithHTML: 'Tegn (including HTML):',
     Paragraphs: 'Paragraphs:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Content can not be pasted because it is above the allowed limit',
     Selected: 'Selected: ',
     title: 'Statistikk'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pl.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pl.js
index 7b753fbbcb55..cc742442a6e8 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pl.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pl.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'pl', {
     CharCount: 'Znaków:',
     CharCountWithHTML: 'Znaków (wraz z kodem HTML):',
     Paragraphs: 'Paragrafy:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Zawartość nie może zostać wklejona, ponieważ przekracza dozwolony limit',
     Selected: 'Zaznaczono: ',
     title: 'Statystyka'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt-br.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt-br.js
index 595a3543f1d5..da5b7a596f8d 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt-br.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt-br.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'pt-br', {
     CharCount: 'Contagem de carateres:',
     CharCountWithHTML: 'Carateres (incluindo HTML):',
     Paragraphs: 'Parágrafos:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Conteúdo não pode ser colado porque ultrapassa o limite permitido',
     Selected: 'Selecionado: ',
     title: 'Estatísticas'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt.js
index e72908f6e19e..5fd624b22ca7 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/pt.js
@@ -3,6 +3,7 @@ CKEDITOR.plugins.setLang('wordcount', 'pt', {
     CharCount: 'Caracteres:',
     CharCountWithHTML: 'Carateres (incluindo HTML):',
     Paragraphs: 'Parágrafos:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'O conteúdo não pode ser colado porque ultrapassa o limite permitido',
     Selected: 'Selecionado: ',
     title: 'Estatísticas'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ro.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ro.js
new file mode 100644
index 000000000000..6ce7c05705e0
--- /dev/null
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ro.js
@@ -0,0 +1,15 @@
+// Romanian Translation by Bogdanov Mihail
+
+CKEDITOR.plugins.setLang('wordcount', 'ro', {
+    WordCount: 'Numar cuvinte',
+    WordCountRemaining: 'Cuvinte ramase',
+    CharCount: 'Numar caracter:',
+    CharCountRemaining: 'Caractere ramase:',
+    CharCountWithHTML: 'Numar caractere (cu HTML):',
+    CharCountWithHTMLRemaining: 'Caractere (cu HTML) ramase',
+    Paragraphs: 'Paragrafe:',
+    ParagraphsRemaining: 'Paragrafe ramase',
+    pasteWarning: 'Continutul nu poate fi adaugat deoarece este mai mare decat limita setata',
+    Selected: 'Selectat:',
+    title: 'Statistici'
+});
\ No newline at end of file
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ru.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ru.js
index fd8eb697912f..fd51b9323ac5 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ru.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/ru.js
@@ -5,8 +5,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 CKEDITOR.plugins.setLang('wordcount', 'ru', {
     WordCount: 'Слов:',
     CharCount: 'Символов:',
-    CharCountWithHTML: ' (включая HTML разметку):',
+    CharCountWithHTML: ' (включая HTML-разметку):',
     Paragraphs: 'Параграфов:',
+    ParagraphsRemaining: 'Параграфов осталось',
     pasteWarning: 'Контент не может быть вставлен, т.к. привышает допустимый лимит',
     Selected: 'Выделено: ',
     title: 'Статистика'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sk.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sk.js
index 7ce0d1c5bedf..70eeb3aafa52 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sk.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sk.js
@@ -6,7 +6,8 @@ CKEDITOR.plugins.setLang('wordcount', 'sk', {
       WordCount: 'Slov:',
       CharCount: 'Znakov:',
       CharCountWithHTML: 'Znakov (vrátane HTML):',
-      Paragraphs: 'Odstavcov:',
+    Paragraphs: 'Odstavcov:',
+      ParagraphsRemaining: 'Paragraphs remaining',
       pasteWarning: 'Obsah sa nedá prilepiť.',
       Selected: 'Výber: ',
       title: 'Å tatistika'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sv.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sv.js
index 8132fccc7829..33509171fd37 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sv.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/sv.js
@@ -5,8 +5,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 CKEDITOR.plugins.setLang('wordcount', 'sv', {
     WordCount: 'Ord:',
     CharCount: 'Tecken:',
+    CharCountRemaining: 'tecken återstår',
     CharCountWithHTML: 'Tecken (inklusive HTML):',
     Paragraphs: 'Paragraf:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Innehåll kan inte klistras in eftersom det överskrider den tillåtna gränsen',
     Selected: 'Valt: ',
     title: 'Statistik'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/tr.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/tr.js
index 74ccc92291f6..e916533b3015 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/tr.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/tr.js
@@ -7,6 +7,7 @@ CKEDITOR.plugins.setLang('wordcount', 'tr', {
     CharCount: 'Karakter:',
     CharCountWithHTML: 'Karakter (HTML dahil):',
     Paragraphs: 'Paragraf:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: 'Content can not be pasted because it is above the allowed limit',
     Selected: 'Selected: ',
     title: 'Ä°statistik'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/uk.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/uk.js
new file mode 100644
index 000000000000..a7d976cba47f
--- /dev/null
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/uk.js
@@ -0,0 +1,17 @@
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.html or http://ckeditor.com/license
+ */
+CKEDITOR.plugins.setLang('wordcount', 'uk', {
+    WordCount: 'Слів:',
+    WordCountRemaining: 'Слів залишилося',
+    CharCount: 'Символів:',
+    CharCountRemaining: 'Символів залишилося',
+    CharCountWithHTML: 'Символів (включаючи HTML-розмітку):',
+    CharCountWithHTMLRemaining: 'Символів (включаючи HTML-розмітку) залишилося',
+    Paragraphs: 'Параграфів:',
+    ParagraphsRemaining: 'Параграфів залишилося',
+    pasteWarning: 'Контент не може бути вставлено, оскільки перевищує допустимий ліміт',
+    Selected: 'Виділено: ',
+    title: 'Статистика'
+});
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh-cn.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh-cn.js
index 26e4a3ed016e..25463773311d 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh-cn.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh-cn.js
@@ -4,9 +4,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 CKEDITOR.plugins.setLang('wordcount', 'zh-cn', {
     WordCount: '词数:',
+    WordCountRemaining: 'Words remaining',
     CharCount: '字符:',
+    CharCountRemaining: '个剩余字符',
     CharCountWithHTML: '字符 (含HTML)',
+    CharCountWithHTMLRemaining: 'Characters (with HTML) remaining',
     Paragraphs: '段落:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: '由于上限允许,内容不能粘贴',
     Selected: '已选择: ',
     title: '统计'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh.js
index f877a55b6385..1ab2270c05ad 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/lang/zh.js
@@ -4,9 +4,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 CKEDITOR.plugins.setLang('wordcount', 'zh', {
     WordCount: '詞數:',
+    WordCountRemaining: 'Words remaining',
     CharCount: '字數:',
+    CharCountRemaining: '個剩餘字元',
     CharCountWithHTML: '字數 (含HTML)',
+    CharCountWithHTMLRemaining: 'Characters (with HTML) remaining',
     Paragraphs: '段落:',
+    ParagraphsRemaining: 'Paragraphs remaining',
     pasteWarning: '由於字數達到上限,內容不能粘貼',
     Selected: '已選擇: ',
     title: '統計'
diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/plugin.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/plugin.js
index 99fcab369989..66535bb379b8 100644
--- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/plugin.js
+++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/wordcount/plugin.js
@@ -3,195 +3,213 @@
  * For licensing, see LICENSE.html or http://ckeditor.com/license
  */
 
-CKEDITOR.plugins.add("wordcount", {
-    lang: "ar,ca,cs,da,de,el,en,es,eu,fa,fi,fr,he,hr,hu,it,ja,nl,no,pl,pt,pt-br,ru,sk,sv,tr,zh-cn,zh", // %REMOVE_LINE_CORE%
-    version: "1.17.2",
-    requires: 'htmlwriter,notification,undo',
-    bbcodePluginLoaded: false,
-    onLoad: function(editor) {
-        CKEDITOR.document.appendStyleSheet(this.path + "css/wordcount.css");
-    },
-    init: function (editor) {
-        var defaultFormat = "",
-            intervalId,
-            lastWordCount = -1,
-            lastCharCount = -1,
-            limitReachedNotified = false,
-            limitRestoredNotified = false,
-            snapShot = editor.getSnapshot(),
-            notification = null;
-
-
-        var dispatchEvent = function (type, currentLength, maxLength) {
-            if (typeof document.dispatchEvent == 'undefined') {
-                return;
-            }
+CKEDITOR.plugins.add("wordcount",
+    {
+        lang: "ar,bg,ca,cs,da,de,el,en,es,eu,fa,fi,fr,he,hr,hu,it,ko,ja,nl,no,pl,pt,pt-br,ru,sk,sv,tr,uk,zh-cn,zh,ro", // %REMOVE_LINE_CORE%
+        version: "1.17.7",
+        requires: "htmlwriter,notification,undo",
+        bbcodePluginLoaded: false,
+        onLoad: function() {
+            CKEDITOR.document.appendStyleSheet(this.path + "css/wordcount.css");
+        },
+        init: function(editor) {
+            var defaultFormat = "",
+                lastWordCount = -1,
+                lastCharCount = -1,
+                lastParagraphs = -1,
+                limitReachedNotified = false,
+                limitRestoredNotified = false,
+                timeoutId = 0,
+                notification = null;
+
+
+            var dispatchEvent = function(type, currentLength, maxLength) {
+                if (typeof document.dispatchEvent == "undefined") {
+                    return;
+                }
 
-            type = 'ckeditor.wordcount.' + type;
+                type = "ckeditor.wordcount." + type;
 
-            var cEvent;
-            var eventInitDict = {
-                bubbles: false,
-                cancelable: true,
-                detail: {
-                    currentLength: currentLength,
-                    maxLength: maxLength
+                var cEvent;
+                var eventInitDict = {
+                    bubbles: false,
+                    cancelable: true,
+                    detail: {
+                        currentLength: currentLength,
+                        maxLength: maxLength
+                    }
+                };
+
+                try {
+                    cEvent = new CustomEvent(type, eventInitDict);
+                } catch (o_O) {
+                    cEvent = document.createEvent("CustomEvent");
+                    cEvent.initCustomEvent(
+                        type,
+                        eventInitDict.bubbles,
+                        eventInitDict.cancelable,
+                        eventInitDict.detail
+                    );
                 }
+
+                document.dispatchEvent(cEvent);
             };
 
-            try {
-                cEvent = new CustomEvent(type, eventInitDict);
-            } catch (o_O) {
-                cEvent = document.createEvent('CustomEvent');
-                cEvent.initCustomEvent(
-                    type,
-                    eventInitDict.bubbles,
-                    eventInitDict.cancelable,
-                    eventInitDict.detail
-                );
-            }
+            // Default Config
+            var defaultConfig = {
+                showRemaining: false,
+                showParagraphs: true,
+                showWordCount: true,
+                showCharCount: false,
+                countBytesAsChars: false,
+                countSpacesAsChars: false,
+                countHTML: false,
+                countLineBreaks: false,
+                hardLimit: true,
+                warnOnLimitOnly: false,
+                wordDelims: '',
+
+                //MAXLENGTH Properties
+                maxWordCount: -1,
+                maxCharCount: -1,
+                maxParagraphs: -1,
+
+                // Filter
+                filter: null,
+
+                // How long to show the 'paste' warning
+                pasteWarningDuration: 0,
+
+                //DisAllowed functions
+                wordCountGreaterThanMaxLengthEvent: function(currentLength, maxLength) {
+                    dispatchEvent("wordCountGreaterThanMaxLengthEvent", currentLength, maxLength);
+                },
+                charCountGreaterThanMaxLengthEvent: function(currentLength, maxLength) {
+                    dispatchEvent("charCountGreaterThanMaxLengthEvent", currentLength, maxLength);
+                },
+
+                //Allowed Functions
+                wordCountLessThanMaxLengthEvent: function(currentLength, maxLength) {
+                    dispatchEvent("wordCountLessThanMaxLengthEvent", currentLength, maxLength);
+                },
+                charCountLessThanMaxLengthEvent: function(currentLength, maxLength) {
+                    dispatchEvent("charCountLessThanMaxLengthEvent", currentLength, maxLength);
+                }
+            };
 
-            document.dispatchEvent(cEvent);
-        };
-
-        // Default Config
-        var defaultConfig = {
-            showRemaining: false,
-            showParagraphs: true,
-            showWordCount: true,
-            showCharCount: false,
-            countBytesAsChars: false,
-            countSpacesAsChars: false,
-            countHTML: false,
-            countLineBreaks: false,
-            hardLimit: true,
-
-            //MAXLENGTH Properties
-            maxWordCount: -1,
-            maxCharCount: -1,
-
-            // Filter
-            filter: null,
-
-            // How long to show the 'paste' warning
-            pasteWarningDuration: 0,
-
-            //DisAllowed functions
-            wordCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
-                dispatchEvent('wordCountGreaterThanMaxLengthEvent', currentLength, maxLength);
-            },
-            charCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) {
-                dispatchEvent('charCountGreaterThanMaxLengthEvent', currentLength, maxLength);
-            },
-
-            //Allowed Functions
-            wordCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
-                dispatchEvent('wordCountLessThanMaxLengthEvent', currentLength, maxLength);
-            },
-            charCountLessThanMaxLengthEvent: function (currentLength, maxLength) {
-                dispatchEvent('charCountLessThanMaxLengthEvent', currentLength, maxLength);
+            // Get Config & Lang
+            var config = CKEDITOR.tools.extend(defaultConfig, editor.config.wordcount || {}, true);
+
+            if (config.showParagraphs) {
+              if (config.maxParagraphs > -1) {
+                  if (config.showRemaining) {
+                      defaultFormat += "%paragraphsCount% " + editor.lang.wordcount.ParagraphsRemaining;
+                  } else {
+                      defaultFormat += editor.lang.wordcount.Paragraphs + " %paragraphsCount%";
+
+                      defaultFormat += "/" + config.maxParagraphs;
+                  }
+              } else {
+                  defaultFormat += editor.lang.wordcount.Paragraphs + " %paragraphsCount%";
+              }
             }
-        };
-
-        // Get Config & Lang
-        var config = CKEDITOR.tools.extend(defaultConfig, editor.config.wordcount || {}, true);
 
-        if (config.showParagraphs) {
-            defaultFormat += editor.lang.wordcount.Paragraphs + " %paragraphs%";
-        }
+            if (config.showParagraphs && (config.showWordCount || config.showCharCount)) {
+                defaultFormat += ", ";
+            }
 
-        if (config.showParagraphs && (config.showWordCount || config.showCharCount)) {
-            defaultFormat += ", ";
-        }
+            if (config.showWordCount) {
+                if (config.maxWordCount > -1) {
+                    if (config.showRemaining) {
+                        defaultFormat += "%wordCount% " + editor.lang.wordcount.WordCountRemaining;
+                    } else {
+                        defaultFormat += editor.lang.wordcount.WordCount + " %wordCount%";
 
-        if (config.showWordCount) {
-            if (config.maxWordCount > -1) {
-                if (config.showRemaining) {
-                    defaultFormat += "%wordCount% " + editor.lang.wordcount.WordCountRemaining;
+                        defaultFormat += "/" + config.maxWordCount;
+                    }
                 } else {
                     defaultFormat += editor.lang.wordcount.WordCount + " %wordCount%";
-
-                    defaultFormat += "/" + config.maxWordCount;
                 }
-            } else {
-                defaultFormat += editor.lang.wordcount.WordCount + " %wordCount%";
             }
-        }
 
-        if (config.showCharCount && config.showWordCount) {
-            defaultFormat += ", ";
-        }
+            if (config.showCharCount && config.showWordCount) {
+                defaultFormat += ", ";
+            }
 
-        if (config.showCharCount) {
-            if (config.maxCharCount > -1) {
-                if (config.showRemaining) {
-                    defaultFormat += "%charCount% " + editor.lang.wordcount[config.countHTML
-                        ? "CharCountWithHTMLRemaining"
-                        : "CharCountRemaining"];
+            if (config.showCharCount) {
+                if (config.maxCharCount > -1) {
+                    if (config.showRemaining) {
+                        defaultFormat += "%charCount% " +
+                            editor.lang.wordcount[config.countHTML
+                                ? "CharCountWithHTMLRemaining"
+                                : "CharCountRemaining"];
+                    } else {
+                        defaultFormat += editor.lang.wordcount[config.countHTML
+                                ? "CharCountWithHTML"
+                                : "CharCount"] +
+                            " %charCount%";
+
+                        defaultFormat += "/" + config.maxCharCount;
+                    }
                 } else {
-                    defaultFormat += editor.lang.wordcount[config.countHTML
-                        ? "CharCountWithHTML"
-                        : "CharCount"] + " %charCount%";
-
-                    defaultFormat += "/" + config.maxCharCount;
+                    defaultFormat += editor.lang.wordcount[config.countHTML ? "CharCountWithHTML" : "CharCount"] +
+                        " %charCount%";
                 }
-            } else {
-                defaultFormat += editor.lang.wordcount[config.countHTML ? "CharCountWithHTML" : "CharCount"] + " %charCount%";
             }
-        }
 
-        var format = defaultFormat;
+            var format = defaultFormat;
 
-        bbcodePluginLoaded = typeof editor.plugins.bbcode != 'undefined';
-
-       function counterId(editorInstance) {
-            return "cke_wordcount_" + editorInstance.name;
-        }
+            bbcodePluginLoaded = typeof editor.plugins.bbcode != "undefined";
 
-        function counterElement(editorInstance) {
-            return document.getElementById(counterId(editorInstance));
-        }
+            function counterId(editorInstance) {
+                return "cke_wordcount_" + editorInstance.name;
+            }
 
-        function strip(html) {
-            if (bbcodePluginLoaded) {
-                // stripping out BBCode tags [...][/...]
-                return html.replace(/\[.*?\]/gi, '');
+            function counterElement(editorInstance) {
+                return document.getElementById(counterId(editorInstance));
             }
 
-            var tmp = document.createElement("div");
+            function strip(html) {
+                if (bbcodePluginLoaded) {
+                    // stripping out BBCode tags [...][/...]
+                    return html.replace(/\[.*?\]/gi, "");
+                }
 
-            // Add filter before strip
-            html = filter(html);
+                var tmp = document.createElement("div");
 
-            tmp.innerHTML = html;
+                // Add filter before strip
+                html = filter(html);
 
-            if (tmp.textContent == "" && typeof tmp.innerText == "undefined") {
-                return "";
-            }
+                tmp.innerHTML = html;
 
-            return tmp.textContent || tmp.innerText;
-        }
+                if (tmp.textContent == "" && typeof tmp.innerText == "undefined") {
+                    return "";
+                }
 
-        /**
-         * Implement filter to add or remove before counting
-         * @param html
-         * @returns string
-         */
-        function filter(html) {
-            if(config.filter instanceof CKEDITOR.htmlParser.filter) {
-                var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html),
-                    writer = new CKEDITOR.htmlParser.basicWriter();
-                config.filter.applyTo( fragment );
-                fragment.writeHtml( writer );
-                return writer.getHtml();
+                return tmp.textContent || tmp.innerText;
             }
-            return html;
-        }
 
-        function countCharacters(text, editorInstance) {
-            if (config.countHTML) {
-                return (filter(text).length);
-            } else {
+            /**
+             * Implement filter to add or remove before counting
+             * @param html
+             * @returns string
+             */
+            function filter(html) {
+                if (config.filter instanceof CKEDITOR.htmlParser.filter) {
+                    var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html),
+                        writer = new CKEDITOR.htmlParser.basicWriter();
+                    config.filter.applyTo(fragment);
+                    fragment.writeHtml(writer);
+                    return writer.getHtml();
+                }
+                return html;
+            }
+
+            function countCharacters(text) {
+                if (config.countHTML) {
+                    return config.countBytesAsChars ? countBytes(filter(text)) : filter(text).length;
+                }
+
                 var normalizedText;
 
                 // strip body tags
@@ -211,293 +229,406 @@ CKEDITOR.plugins.add("wordcount", {
                 }
 
                 if (config.countLineBreaks) {
-                    normalizedText = normalizedText.replace(/(\r\n|\n|\r)/gm, "");
+                    normalizedText = normalizedText.replace(/(\r\n|\n|\r)/gm, " ");
                 } else {
                     normalizedText = normalizedText.replace(/(\r\n|\n|\r)/gm, "").replace(/&nbsp;/gi, " ");
                 }
 
                 normalizedText = strip(normalizedText).replace(/^([\t\r\n]*)$/, "");
 
-                return config.countBytesAsChars ? (countBytes(normalizedText)) : (normalizedText.length);
+                return config.countBytesAsChars ? countBytes(normalizedText) : normalizedText.length;
             }
-        }
 
-        function countBytes(text) {
-            var count = 0, stringLength = text.length, i;
-            text = String(text || "");
-            for (i = 0; i < stringLength; i++) {
-                var partCount = encodeURI(text[i]).split("%").length;
-                count += partCount == 1 ? 1 : partCount - 1;
+            function countBytes(text) {
+                var count = 0, stringLength = text.length, i;
+                text = String(text || "");
+                for (i = 0; i < stringLength; i++) {
+                    var partCount = encodeURI(text[i]).split("%").length;
+                    count += partCount == 1 ? 1 : partCount - 1;
+                }
+                return count;
             }
-            return count;
-        }
 
-        function countParagraphs(text) {
-            return (text.replace(/&nbsp;/g, " ").replace(/(<([^>]+)>)/ig, "").replace(/^\s*$[\n\r]{1,}/gm, "++").split("++").length);
-        }
-
-        function countWords(text) {
-            var normalizedText = text.
-                replace(/(\r\n|\n|\r)/gm, " ").
-                replace(/^\s+|\s+$/g, "").
-                replace("&nbsp;", " ");
+            function countParagraphs(text) {
+                return (text.replace(/&nbsp;/g, " ").replace(/(<([^>]+)>)/ig, "").replace(/^\s*$[\n\r]{1,}/gm, "++")
+                    .split("++").length);
+            }
 
-            normalizedText = strip(normalizedText);
+            function countWords(text) {
+                var normalizedText = text.replace(/(\r\n|\n|\r)/gm, " ").replace(/^\s+|\s+$/g, "")
+                    .replace("&nbsp;", " ");
 
-            var words = normalizedText.split(/\s+/);
+                normalizedText = strip(normalizedText);
 
-            for (var wordIndex = words.length - 1; wordIndex >= 0; wordIndex--) {
-                if (words[wordIndex].match(/^([\s\t\r\n]*)$/)) {
-                    words.splice(wordIndex, 1);
+                var re = config.wordDelims ? new RegExp('[\\s'+config.wordDelims+']+') : /\s+/;
+                var words = normalizedText.split(re);
+                
+                re = config.wordDelims ? new RegExp('^([\\s\\t\\r\\n'+config.wordDelims+']*)$') : /^([\s\t\r\n]*)$/;
+                for (var wordIndex = words.length - 1; wordIndex >= 0; wordIndex--) {
+                    if (!words[wordIndex] || words[wordIndex].match(re)) {
+                        words.splice(wordIndex, 1);
+                    }
                 }
-            }
 
-            return (words.length);
-        }
+                return (words.length);
+            }
 
-        function limitReached(editorInstance, notify) {
-            limitReachedNotified = true;
-            limitRestoredNotified = false;
+            function limitReached(editorInstance, notify) {
+                limitReachedNotified = true;
+                limitRestoredNotified = false;
 
-            if (config.hardLimit) {
-                editorInstance.loadSnapshot(snapShot);
-                // lock editor
-                editorInstance.config.Locked = 1;
-            }
+                if (!config.warnOnLimitOnly) {
+                    if (config.hardLimit) {
+                        editorInstance.execCommand("undo");
+                    }
+                }
 
-            if (!notify) {
-                counterElement(editorInstance).className = "cke_path_item cke_wordcountLimitReached";
-                editorInstance.fire("limitReached", {firedBy: "wordCount.limitReached"}, editor);
+                if (!notify) {
+                    counterElement(editorInstance).className = "cke_path_item cke_wordcountLimitReached";
+                    editorInstance.fire("limitReached", { firedBy: "wordCount.limitReached" }, editor);
+                }
             }
-        }
 
-        function limitRestored(editorInstance) {
-            limitRestoredNotified = true;
-            limitReachedNotified = false;
-            editorInstance.config.Locked = 0;
-            snapShot = editor.getSnapshot();
+            function limitRestored(editorInstance) {
+                limitRestoredNotified = true;
+                limitReachedNotified = false;
 
-            counterElement(editorInstance).className = "cke_path_item";
-        }
+                if (!config.warnOnLimitOnly) {
+                    editorInstance.fire("saveSnapshot");
+                }
 
-        function updateCounter(editorInstance) {
-            if(!counterElement(editorInstance)){
-                return;
+                counterElement(editorInstance).className = "cke_path_item";
             }
 
-            var paragraphs = 0,
-                wordCount = 0,
-                charCount = 0,
-                text;
-
-            // BeforeGetData and getData events are fired when calling
-            // getData(). We can prevent this by passing true as an
-            // argument to getData(). This allows us to fire the events
-            // manually with additional event data: firedBy. This additional
-            // data helps differentiate calls to getData() made by
-            // wordCount plugin from calls made by other plugins/code.
-            editorInstance.fire("beforeGetData", {firedBy: "wordCount.updateCounter"}, editor);
-            text = editorInstance.getData(true);
-            editorInstance.fire("getData", {dataValue: text, firedBy: "wordCount.updateCounter"}, editor);
-
-            if (text)  {
-                if (config.showCharCount) {
-                    charCount = countCharacters(text, editorInstance);
+            function updateCounter(editorInstance) {
+                if (!counterElement(editorInstance)) {
+                    return;
                 }
 
-                if (config.showParagraphs) {
-                    paragraphs = countParagraphs(text);
-                }
+                var paragraphs = 0,
+                    wordCount = 0,
+                    charCount = 0,
+                    text;
 
-                if (config.showWordCount) {
-                    wordCount = countWords(text);
-                }
-            }
+                // BeforeGetData and getData events are fired when calling
+                // getData(). We can prevent this by passing true as an
+                // argument to getData(). This allows us to fire the events
+                // manually with additional event data: firedBy. This additional
+                // data helps differentiate calls to getData() made by
+                // wordCount plugin from calls made by other plugins/code.
+                editorInstance.fire("beforeGetData", { firedBy: "wordCount.updateCounter" }, editor);
+                text = editorInstance.getData(true);
+                editorInstance.fire("getData", { dataValue: text, firedBy: "wordCount.updateCounter" }, editor);
 
+                if (text) {
+                    if (config.showCharCount) {
+                        charCount = countCharacters(text);
+                    }
 
-            var html = format.replace("%paragraphs%", paragraphs);
+                    if (config.showParagraphs) {
+                        paragraphs = countParagraphs(text);
+                    }
 
-            if (config.showRemaining) {
-                if (config.maxCharCount >= 0) {
-                    html = html.replace("%charCount%", config.maxCharCount - charCount);
-                } else {
-                    html = html.replace("%charCount%", charCount);
+                    if (config.showWordCount) {
+                        wordCount = countWords(text);
+                    }
                 }
 
-                if (config.maxWordCount >= 0) {
-                    html = html.replace("%wordCount%", config.maxWordCount - wordCount);
+                var html = format;
+                if (config.showRemaining) {
+                    if (config.maxCharCount >= 0) {
+                        html = html.replace("%charCount%", config.maxCharCount - charCount);
+                    } else {
+                        html = html.replace("%charCount%", charCount);
+                    }
+
+                    if (config.maxWordCount >= 0) {
+                        html = html.replace("%wordCount%", config.maxWordCount - wordCount);
+                    } else {
+                        html = html.replace("%wordCount%", wordCount);
+                    }
+
+                    if (config.maxParagraphs >= 0) {
+                        html = html.replace("%paragraphsCount%", config.maxParagraphs - paragraphs);
+                    } else {
+                        html = html.replace("%paragraphsCount%", paragraphs);
+                    }
                 } else {
-                    html = html.replace("%wordCount%", wordCount);
+                    html = html.replace("%wordCount%", wordCount).replace("%charCount%", charCount).replace("%paragraphsCount%", paragraphs);
                 }
-            } else {
-                html = html.replace("%wordCount%", wordCount).replace("%charCount%", charCount);
-            }
 
-            (editorInstance.config.wordcount || (editorInstance.config.wordcount = {})).wordCount = wordCount;
-            (editorInstance.config.wordcount || (editorInstance.config.wordcount = {})).charCount = charCount;
+                (editorInstance.config.wordcount || (editorInstance.config.wordcount = {})).wordCount = wordCount;
+                (editorInstance.config.wordcount || (editorInstance.config.wordcount = {})).charCount = charCount;
 
-            if (CKEDITOR.env.gecko) {
-                counterElement(editorInstance).innerHTML = html;
-            } else {
-                counterElement(editorInstance).innerText = html;
-            }
-
-            if (charCount == lastCharCount && wordCount == lastWordCount) {
-                if (charCount == config.maxCharCount || wordCount == config.maxWordCount) {
-                    snapShot = editor.getSnapshot();
+                if (CKEDITOR.env.gecko) {
+                    counterElement(editorInstance).innerHTML = html;
+                } else {
+                    counterElement(editorInstance).innerText = html;
                 }
-                return true;
-            }
 
-            //If the limit is already over, allow the deletion of characters/words. Otherwise,
-            //the user would have to delete at one go the number of offending characters
-            var deltaWord = wordCount - lastWordCount;
-            var deltaChar = charCount - lastCharCount;
+                if (charCount == lastCharCount && wordCount == lastWordCount && paragraphs == lastParagraphs) {
+                    if (charCount == config.maxCharCount || wordCount == config.maxWordCount || paragraphs > config.maxParagraphs) {
+                        editorInstance.fire("saveSnapshot");
+                    }
+                    return true;
+                }
 
-            lastWordCount = wordCount;
-            lastCharCount = charCount;
+                //If the limit is already over, allow the deletion of characters/words. Otherwise,
+                //the user would have to delete at one go the number of offending characters
+                var deltaWord = wordCount - lastWordCount;
+                var deltaChar = charCount - lastCharCount;
+                var deltaParagraphs = paragraphs - lastParagraphs;
 
-            if (lastWordCount == -1) {
                 lastWordCount = wordCount;
-            }
-            if (lastCharCount == -1) {
                 lastCharCount = charCount;
-            }
+                lastParagraphs = paragraphs;
 
-            // Check for word limit and/or char limit
-            if ((config.maxWordCount > -1 && wordCount > config.maxWordCount && deltaWord > 0) ||
-                (config.maxCharCount > -1 && charCount > config.maxCharCount && deltaChar > 0)) {
+                if (lastWordCount == -1) {
+                    lastWordCount = wordCount;
+                }
+                if (lastCharCount == -1) {
+                    lastCharCount = charCount;
+                }
+                if (lastParagraphs == -1) {
+                    lastParagraphs = paragraphs;
+                }
 
-                limitReached(editorInstance, limitReachedNotified);
-            } else if ((config.maxWordCount == -1 || wordCount <= config.maxWordCount) &&
-            (config.maxCharCount == -1 || charCount <= config.maxCharCount)) {
+                // Check for word limit and/or char limit
+                if ((config.maxWordCount > -1 && wordCount > config.maxWordCount && deltaWord > 0) ||
+                    (config.maxCharCount > -1 && charCount > config.maxCharCount && deltaChar > 0) ||
+                    (config.maxParagraphs > -1 && paragraphs > config.maxParagraphs && deltaParagraphs > 0)) {
 
-                limitRestored(editorInstance);
-            } else {
-                snapShot = editorInstance.getSnapshot();
-            }
+                    limitReached(editorInstance, limitReachedNotified);
+                } else if ((config.maxWordCount == -1 || wordCount <= config.maxWordCount) &&
+                    (config.maxCharCount == -1 || charCount <= config.maxCharCount) &&
+                    (config.maxParagraphs == -1 || paragraphs <= config.maxParagraphs)) {
 
-            // Fire Custom Events
-            if (config.charCountGreaterThanMaxLengthEvent && config.charCountLessThanMaxLengthEvent) {
-                if (charCount > config.maxCharCount && config.maxCharCount > -1) {
-                    config.charCountGreaterThanMaxLengthEvent(charCount, config.maxCharCount);
+                    limitRestored(editorInstance);
                 } else {
-                    config.charCountLessThanMaxLengthEvent(charCount, config.maxCharCount);
+                    editorInstance.fire("saveSnapshot");
                 }
-            }
-
-            if (config.wordCountGreaterThanMaxLengthEvent && config.wordCountLessThanMaxLengthEvent) {
-                if (wordCount > config.maxWordCount && config.maxWordCount > -1) {
-                    config.wordCountGreaterThanMaxLengthEvent(wordCount, config.maxWordCount);
 
-                } else {
-                    config.wordCountLessThanMaxLengthEvent(wordCount, config.maxWordCount);
+                // update instance
+                editorInstance.wordCount =
+                {
+                    paragraphs: paragraphs,
+                    wordCount: wordCount,
+                    charCount: charCount
+                };
+
+
+                // Fire Custom Events
+                if (config.charCountGreaterThanMaxLengthEvent && config.charCountLessThanMaxLengthEvent) {
+                    if (charCount > config.maxCharCount && config.maxCharCount > -1) {
+                        config.charCountGreaterThanMaxLengthEvent(charCount, config.maxCharCount);
+                    } else {
+                        config.charCountLessThanMaxLengthEvent(charCount, config.maxCharCount);
+                    }
                 }
-            }
 
-            return true;
-        }
+                if (config.wordCountGreaterThanMaxLengthEvent && config.wordCountLessThanMaxLengthEvent) {
+                    if (wordCount > config.maxWordCount && config.maxWordCount > -1) {
+                        config.wordCountGreaterThanMaxLengthEvent(wordCount, config.maxWordCount);
 
-        editor.on("key", function (event) {
-            if (editor.mode === "source") {
-                updateCounter(event.editor);
-            }
-        }, editor, null, 100);
-
-        editor.on("change", function (event) {
-            updateCounter(event.editor);
-        }, editor, null, 100);
-
-        editor.on("uiSpace", function (event) {
-            if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE) {
-                if (event.data.space == "top") {
-                    event.data.html += "<div class=\"cke_wordcount\" style=\"\"" +
-                        " title=\"" +
-                        editor.lang.wordcount.title +
-                        "\"" +
-                        "><span id=\"" +
-                        counterId(event.editor) +
-                        "\" class=\"cke_path_item\">&nbsp;</span></div>";
-                }
-            } else {
-                if (event.data.space == "bottom") {
-                    event.data.html += "<div class=\"cke_wordcount\" style=\"\"" +
-                        " title=\"" +
-                        editor.lang.wordcount.title +
-                        "\"" +
-                        "><span id=\"" +
-                        counterId(event.editor) +
-                        "\" class=\"cke_path_item\">&nbsp;</span></div>";
+                    } else {
+                        config.wordCountLessThanMaxLengthEvent(wordCount, config.maxWordCount);
+                    }
                 }
-            }
-
-        }, editor, null, 100);
-
-        editor.on("dataReady", function (event) {
-            updateCounter(event.editor);
-        }, editor, null, 100);
-
-        editor.on("paste", function(event) {
-            if (config.maxWordCount > 0 || config.maxCharCount > 0) {
 
-                // Check if pasted content is above the limits
-                var wordCount = -1,
-                    charCount = -1;
-
-                // BeforeGetData and getData events are fired when calling
-                // getData(). We can prevent this by passing true as an
-                // argument to getData(). This allows us to fire the events
-                // manually with additional event data: firedBy. This additional
-                // data helps differentiate calls to getData() made by
-                // wordCount plugin from calls made by other plugins/code.
-                event.editor.fire("beforeGetData", {firedBy: "wordCount.onPaste"}, event.editor);
-                var text = event.editor.getData(true);
-                event.editor.fire("getData", {dataValue: text, firedBy: "wordCount.onPaste"}, event.editor);
-
-                text += event.data.dataValue;
+                return true;
+            }
 
-                if (config.showCharCount) {
-                    charCount = countCharacters(text, event.editor);
+            function isCloseToLimits() {
+                if (config.maxWordCount > -1 && config.maxWordCount - lastWordCount < 5) {
+                    return true;
                 }
 
-                if (config.showWordCount) {
-                    wordCount = countWords(text);
+                if (config.maxCharCount > -1 && config.maxCharCount - lastCharCount < 20) {
+                    return true;
                 }
 
-
-                // Instantiate the notification when needed and only have one instance
-                if(notification === null) {
-                    notification = new CKEDITOR.plugins.notification(event.editor, {
-                        message: event.editor.lang.wordcount.pasteWarning,
-                        type: 'warning',
-                        duration: config.pasteWarningDuration
-                    });
+                if (config.maxParagraphs > -1 && config.maxParagraphs - lastParagraphs < 1) {
+                    return true;
                 }
 
-                if (config.maxCharCount > 0 && charCount > config.maxCharCount && config.hardLimit) {
-                    if(!notification.isVisible()) {
-                        notification.show();
+                return false;
+            }
+
+            editor.on("key",
+                function(event) {
+                    if (editor.mode === "source") {
+                        clearTimeout(timeoutId);
+                        timeoutId = setTimeout(
+                            updateCounter.bind(this, event.editor),
+                            250
+                        );
                     }
-                    event.cancel();
-                }
 
-                if (config.maxWordCount > 0 && wordCount > config.maxWordCount && config.hardLimit) {
-                    if(!notification.isVisible()) {
-                        notification.show();
+                    if (event.data.keyCode == 13) {
+                        clearTimeout(timeoutId);
+                        timeoutId = setTimeout(
+                            updateCounter.bind(this, event.editor),
+                            250
+                        );
+                    }
+                },
+                editor,
+                null,
+                100);
+
+            editor.on("change",
+                function(event) {
+                    var ms = isCloseToLimits() ? 5 : 250;
+                    clearTimeout(timeoutId);
+                    timeoutId = setTimeout(
+                        updateCounter.bind(this, event.editor),
+                        ms
+                    );
+                },
+                editor,
+                null,
+                100);
+
+            editor.on("uiSpace",
+                function (event) {
+                    var wordcountClass = "cke_wordcount";
+
+                    if (editor.lang.dir == "rtl") {
+                        wordcountClass = wordcountClass + " cke_wordcount_rtl";
                     }
-                    event.cancel();
-                }
-            }
-        }, editor, null, 100);
 
-        editor.on("afterPaste", function (event) {
-            updateCounter(event.editor);
-        }, editor, null, 100);
+                    if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE) {
+                        if (event.data.space == "top") {
+                            event.data.html += "<div class=\"" + wordcountClass +"\" style=\"\"" +
+                                " title=\"" +
+                                editor.lang.wordcount.title +
+                                "\"" +
+                                "><span id=\"" +
+                                counterId(event.editor) +
+                                "\" class=\"cke_path_item\">&nbsp;</span></div>";
+                        }
+                    } else {
+                        if (event.data.space == "bottom") {
+                            event.data.html += "<div class=\""+wordcountClass+"\" style=\"\"" +
+                                " title=\"" +
+                                editor.lang.wordcount.title +
+                                "\"" +
+                                "><span id=\"" +
+                                counterId(event.editor) +
+                                "\" class=\"cke_path_item\">&nbsp;</span></div>";
+                        }
+                    }
 
-        editor.on("blur", function () {
-            if (intervalId) {
-                window.clearInterval(intervalId);
-            }
-        }, editor, null, 300);
-    }
-});
+                },
+                editor,
+                null,
+                100);
+
+            editor.on("dataReady",
+                function(event) {
+                    updateCounter(event.editor);
+                },
+                editor,
+                null,
+                100);
+
+            editor.on("paste",
+                function(event) {
+                    if (!config.warnOnLimitOnly && (config.maxWordCount > 0 || config.maxCharCount > 0 || config.maxParagraphs > 0)) {
+
+                        // Check if pasted content is above the limits
+                        var wordCount = -1,
+                            charCount = -1,
+                            paragraphs = -1;
+
+                        var mySelection = event.editor.getSelection(),
+                            selectedText = mySelection.getNative().toString().trim();
+
+
+                        // BeforeGetData and getData events are fired when calling
+                        // getData(). We can prevent this by passing true as an
+                        // argument to getData(). This allows us to fire the events
+                        // manually with additional event data: firedBy. This additional
+                        // data helps differentiate calls to getData() made by
+                        // wordCount plugin from calls made by other plugins/code.
+                        event.editor.fire("beforeGetData", { firedBy: "wordCount.onPaste" }, event.editor);
+                        var text = event.editor.getData(true);
+                        event.editor.fire("getData", { dataValue: text, firedBy: "wordCount.onPaste" }, event.editor);
+
+                        if (selectedText.length > 0) {
+                            var plaintext = event.editor.document.getBody().getText();
+
+                            if (plaintext.length === selectedText.length) {
+                                text = "";
+                            }
+                        }
+
+
+                        text += event.data.dataValue;
+
+                        if (config.showCharCount) {
+                            charCount = countCharacters(text);
+                        }
+
+                        if (config.showWordCount) {
+                            wordCount = countWords(text);
+                        }
+
+                        if (config.showParagraphs) {
+                            paragraphs = countParagraphs(text);
+                        }
+
+
+                        // Instantiate the notification when needed and only have one instance
+                        if (notification === null) {
+                            notification = new CKEDITOR.plugins.notification(event.editor,
+                                {
+                                    message: event.editor.lang.wordcount.pasteWarning,
+                                    type: "warning",
+                                    duration: config.pasteWarningDuration
+                                });
+                        }
+
+                        if (config.maxCharCount > 0 && charCount > config.maxCharCount && config.hardLimit) {
+                            if (!notification.isVisible()) {
+                                notification.show();
+                            }
+                            event.cancel();
+                        }
+
+                        if (config.maxWordCount > 0 && wordCount > config.maxWordCount && config.hardLimit) {
+                            if (!notification.isVisible()) {
+                                notification.show();
+                            }
+                            event.cancel();
+                        }
+
+                        if (config.maxParagraphs > 0 && paragraphs > config.maxParagraphs && config.hardLimit) {
+                            if (!notification.isVisible()) {
+                                notification.show();
+                            }
+                            event.cancel();
+                        }
+                    }
+                },
+                editor,
+                null,
+                100);
+
+            editor.on("afterPaste",
+                function(event) {
+                    updateCounter(event.editor);
+                },
+                editor,
+                null,
+                100);
+
+            editor.on("afterPasteFromWord",
+                function (event) {
+                    updateCounter(event.editor);
+                },
+                editor,
+                null,
+                100);
+        }
+    });
-- 
GitLab