Index: lams_central/web/ckeditor/README.md =================================================================== diff -u -r80be094030483dbe5d093595a0f49d533c8ad00f -rdca7fef745b8fcefbfd8aeba9df093b5ae204b0a --- lams_central/web/ckeditor/README.md (.../README.md) (revision 80be094030483dbe5d093595a0f49d533c8ad00f) +++ lams_central/web/ckeditor/README.md (.../README.md) (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -312,4 +312,9 @@ ``` type:CKEDITOR.NODE_ELEMENT,addClass:g?function(a){if(a)this.$.classList.(a);return this} ``` -(As in [https://code.lamsfoundation.org/fisheye/changelog/lams-github?cs=cfec5d4c0ffe681e5e2604dc1163b309974e21f0](https://code.lamsfoundation.org/fisheye/changelog/lams-github?cs=cfec5d4c0ffe681e5e2604dc1163b309974e21f0)) \ No newline at end of file +(As in [https://code.lamsfoundation.org/fisheye/changelog/lams-github?cs=cfec5d4c0ffe681e5e2604dc1163b309974e21f0](https://code.lamsfoundation.org/fisheye/changelog/lams-github?cs=cfec5d4c0ffe681e5e2604dc1163b309974e21f0)) + +- Add wordcount and notification plugins +These plugins are required for checking max word count in essay questions. +They are a part of CKEditor build file already, but they can be added manually too. +The sking office2013 does not have a notification.css file nor its import is added to editor.css. It can be taken from existing LAMS code or directly from another skin. \ No newline at end of file Index: lams_central/web/ckeditor/build-config.js =================================================================== diff -u -r5727272c3f2b0021f872d499995b3f4b82738274 -rdca7fef745b8fcefbfd8aeba9df093b5ae204b0a --- lams_central/web/ckeditor/build-config.js (.../build-config.js) (revision 5727272c3f2b0021f872d499995b3f4b82738274) +++ lams_central/web/ckeditor/build-config.js (.../build-config.js) (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -89,6 +89,8 @@ 'list' : 1, 'liststyle' : 1, 'maximize' : 1, + 'maxwords' : 1, + 'notification' : 1, 'pastefromword' : 1, 'preview' : 1, 'resize' : 1, Index: lams_central/web/ckeditor/plugins/notification/lang/az.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/az.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/az.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'az', { + closed: 'Xəbərdarlıq pəncərəsi bağlanıb' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/bg.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/bg.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/bg.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'bg', { + closed: 'Известието е затворено.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ca.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ca.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ca.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ca', { + closed: 'Notificació tancada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/cs.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/cs.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/cs.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'cs', { + closed: 'Oznámení zavřeno.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/da.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/da.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/da.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'da', { + closed: 'Notifikation lukket.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/de-ch.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/de-ch.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/de-ch.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'de-ch', { + closed: 'Benachrichtigung geschlossen.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/de.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/de.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/de.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'de', { + closed: 'Benachrichtigung geschlossen.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/en-au.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/en-au.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/en-au.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'en-au', { + closed: 'Notification closed.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/en.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/en.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/en.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'en', { + closed: 'Notification closed.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/eo.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/eo.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/eo.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'eo', { + closed: 'Sciigo fermita' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/es-mx.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/es-mx.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/es-mx.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'es-mx', { + closed: 'Notificación cerrada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/es.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/es.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/es.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'es', { + closed: 'Notificación cerrada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/et.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/et.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/et.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'et', { + closed: 'Teavitused on suletud.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/eu.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/eu.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/eu.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'eu', { + closed: 'Jakinarazpena itxita.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/fa.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/fa.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/fa.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'fa', { + closed: 'آگاهسازی بسته شد' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/fr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/fr.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/fr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'fr', { + closed: 'Notification fermée.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/gl.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/gl.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/gl.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'gl', { + closed: 'Notificación pechada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/hr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/hr.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/hr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'hr', { + closed: 'Obavijest zatvorena.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/hu.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/hu.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/hu.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'hu', { + closed: 'Értesítés bezárva.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/id.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/id.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/id.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'id', { + closed: 'Pemberitahuan ditutup' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/it.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/it.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/it.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'it', { + closed: 'Notifica chiusa.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ja.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ja.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ja.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ja', { + closed: '通知を閉じました。' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/km.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/km.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/km.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'km', { + closed: 'បានបិទការផ្ដល់ដំណឹង។' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ko.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ko.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ko.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ko', { + closed: '알림이 닫힘.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ku.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ku.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ku.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ku', { + closed: 'ئاگادارکەرەوەکە داخرا.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/lt.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/lt.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/lt.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'lt', { + closed: 'Pranešimas uždarytas.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/lv.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/lv.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/lv.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'lv', { + closed: 'Paziņojums aizvērts.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/nb.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/nb.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/nb.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'nb', { + closed: 'Varsling lukket.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/nl.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/nl.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/nl.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'nl', { + closed: 'Melding gesloten.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/oc.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/oc.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/oc.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'oc', { + closed: 'Notificacion tampada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/pl.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/pl.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/pl.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'pl', { + closed: 'Powiadomienie zostało zamknięte.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/pt-br.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/pt-br.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/pt-br.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'pt-br', { + closed: 'Notificação fechada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/pt.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/pt.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/pt.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'pt', { + closed: 'Notificação encerrada.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ro.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ro.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ro.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ro', { + closed: 'Notificare închisă.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ru.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ru.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ru.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ru', { + closed: 'Уведомление закрыто' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/sk.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/sk.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/sk.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'sk', { + closed: 'Notifikácia zatvorená.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/sq.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/sq.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/sq.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'sq', { + closed: 'Njoftimi është mbyllur.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/sr-latn.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/sr-latn.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/sr-latn.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'sr-latn', { + closed: 'Obaveštenje zatvoreno' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/sr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/sr.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/sr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'sr', { + closed: 'Обавештење затворено' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/sv.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/sv.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/sv.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'sv', { + closed: 'Notifiering stängd.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/tr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/tr.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/tr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'tr', { + closed: 'Uyarılar kapatıldı.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/ug.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/ug.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/ug.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'ug', { + closed: 'ئوقتۇرۇش تاقالدى.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/uk.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/uk.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/uk.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'uk', { + closed: 'Сповіщення закрито.' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/zh-cn.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/zh-cn.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/zh-cn.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'zh-cn', { + closed: '通知已关闭' +} ); Index: lams_central/web/ckeditor/plugins/notification/lang/zh.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/lang/zh.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/lang/zh.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,7 @@ +/* +Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license +*/ +CKEDITOR.plugins.setLang( 'notification', 'zh', { + closed: '通知已關閉。' +} ); Index: lams_central/web/ckeditor/plugins/notification/plugin.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/notification/plugin.js (revision 0) +++ lams_central/web/ckeditor/plugins/notification/plugin.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,933 @@ +/** + * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/** + * @fileOverview The "Notification" plugin. + * + */ + +'use strict'; + +( function() { + + CKEDITOR.plugins.add( 'notification', { + lang: 'az,bg,ca,cs,da,de,de-ch,en,en-au,eo,es,es-mx,et,eu,fa,fr,gl,hr,hu,id,it,ja,km,ko,ku,lt,lv,nb,nl,oc,pl,pt,pt-br,ro,ru,sk,sq,sr,sr-latn,sv,tr,ug,uk,zh,zh-cn', // %REMOVE_LINE_CORE% + + init: function( editor ) { + editor._.notificationArea = new Area( editor ); + + // Overwrites default `editor.showNotification`. + editor.showNotification = function( message, type, progressOrDuration ) { + var progress, duration; + + if ( type == 'progress' ) { + progress = progressOrDuration; + } else { + duration = progressOrDuration; + } + + var notification = new CKEDITOR.plugins.notification( editor, { + message: message, + type: type, + progress: progress, + duration: duration + } ); + + notification.show(); + + return notification; + }; + + // Close the last notification on ESC. + editor.on( 'key', function( evt ) { + if ( evt.data.keyCode == 27 ) { /* ESC */ + var notifications = editor._.notificationArea.notifications; + + if ( !notifications.length ) { + return; + } + + // As long as this is not a common practice to inform screen-reader users about actions, in this case + // this is the best solution (unfortunately there is no standard for accessibility for notifications). + // Notification has an `alert` aria role what means that it does not get a focus nor is needed to be + // closed (unlike `alertdialog`). However notification will capture ESC key so we need to inform user + // why it does not do other actions. + say( editor.lang.notification.closed ); + + // Hide last. + notifications[ notifications.length - 1 ].hide(); + + evt.cancel(); + } + } ); + + // Send the message to the screen readers. + function say( text ) { + var message = new CKEDITOR.dom.element( 'div' ); + message.setStyles( { + position: 'fixed', + 'margin-left': '-9999px' + } ); + message.setAttributes( { + 'aria-live': 'assertive', + 'aria-atomic': 'true' + } ); + message.setText( text ); + + CKEDITOR.document.getBody().append( message ); + + setTimeout( function() { + message.remove(); + }, 100 ); + } + } + } ); + + /** + * Notification class. Notifications are used to display short messages to the user. They might be used to show the result of + * asynchronous actions or information about changes in the editor content. It is recommended to use them instead of + * alert dialogs. They should **not** be used if a user response is required nor with dialog windows (e.g. in dialog validation). + * + * There are four types of notifications available, see the {@link #type} property. + * + * Note that the notification constructor only creates a notification instance. To show it, use the {@link #show} method: + * + * var notification = new CKEDITOR.plugins.notification( editor, { message: 'Foo' } ); + * notification.show(); + * + * You can also use the {@link CKEDITOR.editor#showNotification} method: + * + * editor.showNotification( 'Foo' ); + * + * All of the notification actions: ({@link #show}, {@link #update} and {@link #hide}) fire cancelable events + * on the related {@link CKEDITOR.editor} instance so you can integrate editor notifications with your website notifications. + * + * Refer to the [Notifications](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_notifications.html) article for more information about this feature. + * + * @since 4.5.0 + * @class CKEDITOR.plugins.notification + * @constructor Create a notification object. Call {@link #show} to show the created notification. + * @param {CKEDITOR.editor} editor The editor instance. + * @param {Object} options + * @param {String} options.message The message displayed in the notification. + * @param {String} [options.type='info'] Notification type, see {@link #type}. + * @param {Number} [options.progress=0] If the type is `progress` this may be a progress from 0 to 1. + * @param {Number} [options.duration] How long the notification will be visible, see {@link #duration}. + */ + function Notification( editor, options ) { + CKEDITOR.tools.extend( this, options, { + editor: editor, + id: 'cke-' + CKEDITOR.tools.getUniqueId(), + area: editor._.notificationArea + } ); + + if ( !options.type ) { + this.type = 'info'; + } + + this.element = this._createElement(); + + // Don't allow dragging on notification (https://dev.ckeditor.com/ticket/13184). + editor.plugins.clipboard && CKEDITOR.plugins.clipboard.preventDefaultDropOnElement( this.element ); + } + + /** + * The editor instance. + * + * @readonly + * @property {CKEDITOR.editor} editor + */ + + /** + * Message displayed in the notification. + * + * @readonly + * @property {String} message + */ + + /** + * Notification type. There are four types available: + * + * * `info` (default) – Information for the user (e.g. "File is uploading.", "ACF modified content."), + * * `warning` – Warning or error message (e.g. "This type of file is not supported.", + * "You cannot paste the script."), + * * `success` – Information that an operation finished successfully (e.g. "File uploaded.", "Data imported."). + * * `progress` – Information about the progress of an operation. When the operation is done, the notification + * type should be changed to `success`. + * + * @readonly + * @property {String} type + */ + + /** + * If the notification {@link #type} is `'progress'`, this is the progress from `0` to `1`. + * + * @readonly + * @property {Number} progress + */ + + /** + * Notification duration. Determines after how many milliseconds the notification should close automatically. + * `0` means that the notification will not close automatically and that the user needs to close it manually. + * The default value for `warning` and `progress` notifications is `0`. For `info` and `success` the value can + * either be set through the {@link CKEDITOR.config#notification_duration} configuration option or equals `5000` + * if the configuration option is not set. + * + * @readonly + * @property {Number} duration + */ + + /** + * Unique notification ID. + * + * @readonly + * @property {Number} id + */ + + /** + * Notification DOM element. There is one element per notification. It is created when the notification is created, + * even if it is not shown. If the notification is hidden, the element is detached from the document but not deleted. + * It will be reused if the notification is shown again. + * + * @readonly + * @property {CKEDITOR.dom.element} element + */ + + /** + * {@link CKEDITOR.plugins.notification.area Notification area} reference. + * + * @readonly + * @property {CKEDITOR.plugins.notification.area} area + */ + + Notification.prototype = { + /** + * Adds the notification element to the notification area. The notification will be hidden automatically if + * {@link #duration} is set. + * + * Fires the {@link CKEDITOR.editor#notificationShow} event. + */ + show: function() { + if ( this.editor.fire( 'notificationShow', { notification: this } ) === false ) { + return; + } + + this.area.add( this ); + + this._hideAfterTimeout(); + }, + + /** + * Updates the notification object and element. + * + * Fires the {@link CKEDITOR.editor#notificationUpdate} event. + * + * @param {Object} options + * @param {String} [options.message] {@link #message} + * @param {String} [options.type] {@link #type} + * @param {Number} [options.progress] {@link #progress} + * @param {Number} [options.duration] {@link #duration} + * @param {Boolean} [options.important=false] If the update is important, the notification will be shown + * if it was hidden and read by screen readers. + */ + update: function( options ) { + var show = true; + + if ( this.editor.fire( 'notificationUpdate', { notification: this, options: options } ) === false ) { + // The idea of cancelable event is to let user create his own way of displaying notification, so if + // `notificationUpdate` event will be canceled there will be no interaction with notification area, but on + // the other hand the logic should work anyway so object will be updated (including `element` property). + // Note: we can safely update the element's attributes below, because this element is created inside + // the constructor. If the notificatinShow event was canceled as well, the element is detached from DOM. + show = false; + } + + var element = this.element, + messageElement = element.findOne( '.cke_notification_message' ), + progressElement = element.findOne( '.cke_notification_progress' ), + type = options.type; + + element.removeAttribute( 'role' ); + + // Change type to progress if `options.progress` is set. + if ( options.progress && this.type != 'progress' ) { + type = 'progress'; + } + + if ( type ) { + element.removeClass( this._getClass() ); + element.removeAttribute( 'aria-label' ); + + this.type = type; + + element.addClass( this._getClass() ); + element.setAttribute( 'aria-label', this.type ); + + if ( this.type == 'progress' && !progressElement ) { + progressElement = this._createProgressElement(); + progressElement.insertBefore( messageElement ); + } else if ( this.type != 'progress' && progressElement ) { + progressElement.remove(); + } + } + + if ( options.message !== undefined ) { + this.message = options.message; + messageElement.setHtml( this.message ); + } + + if ( options.progress !== undefined ) { + this.progress = options.progress; + + if ( progressElement ) { + progressElement.setStyle( 'width', this._getPercentageProgress() ); + } + } + + if ( show && options.important ) { + element.setAttribute( 'role', 'alert' ); + + if ( !this.isVisible() ) { + this.area.add( this ); + } + } + + // Overwrite even if it is undefined. + this.duration = options.duration; + + this._hideAfterTimeout(); + }, + + /** + * Removes the notification element from the notification area. + * + * Fires the {@link CKEDITOR.editor#notificationHide} event. + */ + hide: function() { + if ( this.editor.fire( 'notificationHide', { notification: this } ) === false ) { + return; + } + + this.area.remove( this ); + }, + + /** + * Returns `true` if the notification is in the notification area. + * + * @returns {Boolean} `true` if the notification is in the notification area. + */ + isVisible: function() { + return CKEDITOR.tools.indexOf( this.area.notifications, this ) >= 0; + }, + + /** + * Creates the notification DOM element. + * + * @private + * @returns {CKEDITOR.dom.element} Notification DOM element. + */ + _createElement: function() { + var notification = this, + notificationElement, notificationMessageElement, notificationCloseElement, + close = this.editor.lang.common.close; + + notificationElement = new CKEDITOR.dom.element( 'div' ); + notificationElement.addClass( 'cke_notification' ); + notificationElement.addClass( this._getClass() ); + notificationElement.setAttributes( { + id: this.id, + role: 'alert', + 'aria-label': this.type + } ); + + if ( this.type == 'progress' ) + notificationElement.append( this._createProgressElement() ); + + notificationMessageElement = new CKEDITOR.dom.element( 'p' ); + notificationMessageElement.addClass( 'cke_notification_message' ); + notificationMessageElement.setHtml( this.message ); + notificationElement.append( notificationMessageElement ); + + notificationCloseElement = CKEDITOR.dom.element.createFromHtml( + '' + + 'X' + + '' ); + notificationElement.append( notificationCloseElement ); + + notificationCloseElement.on( 'click', function() { + // Focus editor on close (https://dev.ckeditor.com/ticket/12865) + notification.editor.focus(); + + notification.hide(); + } ); + + return notificationElement; + }, + + /** + * Gets the notification CSS class. + * + * @private + * @returns {String} Notification CSS class. + */ + _getClass: function() { + return ( this.type == 'progress' ) ? + 'cke_notification_info' : + ( 'cke_notification_' + this.type ); + }, + + /** + * Creates a progress element for the notification element. + * + * @private + * @returns {CKEDITOR.dom.element} Progress element for the notification element. + */ + _createProgressElement: function() { + var element = new CKEDITOR.dom.element( 'span' ); + element.addClass( 'cke_notification_progress' ); + element.setStyle( 'width', this._getPercentageProgress() ); + return element; + }, + + /** + * Gets the progress as a percentage (ex. `0.3` -> `30%`). + * + * @private + * @returns {String} Progress as a percentage. + */ + _getPercentageProgress: function() { + return Math.round( ( this.progress || 0 ) * 100 ) + '%'; + }, + + /** + * Hides the notification after a timeout. + * + * @private + */ + _hideAfterTimeout: function() { + var notification = this, + duration; + + if ( this._hideTimeoutId ) { + clearTimeout( this._hideTimeoutId ); + } + + if ( typeof this.duration == 'number' ) { + duration = this.duration; + } else if ( this.type == 'info' || this.type == 'success' ) { + duration = ( typeof this.editor.config.notification_duration == 'number' ) ? + this.editor.config.notification_duration : + 5000; + } + + if ( duration ) { + notification._hideTimeoutId = setTimeout( function() { + notification.hide(); + }, duration ); + } + } + }; + + /** + * Notification area is an area where all notifications are put. The area is laid out dynamically. + * When the first notification is added, the area is shown and all listeners are added. + * When the last notification is removed, the area is hidden and all listeners are removed. + * + * @since 4.5.0 + * @private + * @class CKEDITOR.plugins.notification.area + * @constructor + * @param {CKEDITOR.editor} editor The editor instance. + */ + function Area( editor ) { + var that = this; + + this.editor = editor; + this.notifications = []; + this.element = this._createElement(); + this._uiBuffer = CKEDITOR.tools.eventsBuffer( 10, this._layout, this ); + this._changeBuffer = CKEDITOR.tools.eventsBuffer( 500, this._layout, this ); + + editor.on( 'destroy', function() { + that._removeListeners(); + that.element.remove(); + } ); + } + + /** + * The editor instance. + * + * @readonly + * @property {CKEDITOR.editor} editor + */ + + /** + * The array of added notifications. + * + * @readonly + * @property {Array} notifications + */ + + /** + * Notification area DOM element. This element is created when the area object is created. It will be attached to the document + * when the first notification is added and removed when the last notification is removed. + * + * @readonly + * @property {CKEDITOR.dom.element} element + */ + + /** + * Notification width. Cached for performance reasons. + * + * @private + * @property {CKEDITOR.dom.element} _notificationWidth + */ + + /** + * Notification margin. Cached for performance reasons. + * + * @private + * @property {CKEDITOR.dom.element} _notificationMargin + */ + + /** + * Event buffer object for UI events to optimize performance. + * + * @private + * @property {Object} _uiBuffer + */ + + /** + * Event buffer object for editor change events to optimize performance. + * + * @private + * @property {Object} _changeBuffer + */ + + Area.prototype = { + /** + * Adds the notification to the notification area. If it is the first notification, the area will also be attached to + * the document and listeners will be attached. + * + * Note that the proper way to show a notification is to call the {@link CKEDITOR.plugins.notification#show} method. + * + * @param {CKEDITOR.plugins.notification} notification Notification to add. + */ + add: function( notification ) { + this.notifications.push( notification ); + + this.element.append( notification.element ); + + if ( this.element.getChildCount() == 1 ) { + CKEDITOR.document.getBody().append( this.element ); + this._attachListeners(); + } + + this._layout(); + }, + + /** + * Removes the notification from the notification area. If it is the last notification, the area will also be + * detached from the document and listeners will be detached. + * + * Note that the proper way to hide a notification is to call the {@link CKEDITOR.plugins.notification#hide} method. + * + * @param {CKEDITOR.plugins.notification} notification Notification to remove. + */ + remove: function( notification ) { + var i = CKEDITOR.tools.indexOf( this.notifications, notification ); + + if ( i < 0 ) { + return; + } + + this.notifications.splice( i, 1 ); + + notification.element.remove(); + + if ( !this.element.getChildCount() ) { + this._removeListeners(); + this.element.remove(); + } + }, + + /** + * Creates the notification area element. + * + * @private + * @returns {CKEDITOR.dom.element} Notification area element. + */ + _createElement: function() { + var editor = this.editor, + config = editor.config, + notificationArea = new CKEDITOR.dom.element( 'div' ); + + notificationArea.addClass( 'cke_notifications_area' ); + notificationArea.setAttribute( 'id', 'cke_notifications_area_' + editor.name ); + notificationArea.setStyle( 'z-index', config.baseFloatZIndex - 2 ); + + return notificationArea; + }, + + /** + * Attaches listeners to the notification area. + * + * @private + */ + _attachListeners: function() { + var win = CKEDITOR.document.getWindow(), + editor = this.editor; + + win.on( 'scroll', this._uiBuffer.input ); + win.on( 'resize', this._uiBuffer.input ); + editor.on( 'change', this._changeBuffer.input ); + editor.on( 'floatingSpaceLayout', this._layout, this, null, 20 ); + editor.on( 'blur', this._layout, this, null, 20 ); + }, + + /** + * Detaches listeners from the notification area. + * + * @private + */ + _removeListeners: function() { + var win = CKEDITOR.document.getWindow(), + editor = this.editor; + + win.removeListener( 'scroll', this._uiBuffer.input ); + win.removeListener( 'resize', this._uiBuffer.input ); + editor.removeListener( 'change', this._changeBuffer.input ); + editor.removeListener( 'floatingSpaceLayout', this._layout ); + editor.removeListener( 'blur', this._layout ); + }, + + /** + * Sets the position of the notification area based on the editor content, toolbar as well as + * viewport position and dimensions. + * + * @private + */ + _layout: function() { + var area = this.element, + editor = this.editor, + contentsRect = editor.ui.contentsElement.getClientRect(), + contentsPos = editor.ui.contentsElement.getDocumentPosition(), + top, + topRect, + areaRect = area.getClientRect(), + notification, + notificationWidth = this._notificationWidth, + notificationMargin = this._notificationMargin, + win = CKEDITOR.document.getWindow(), + scrollPos = win.getScrollPosition(), + viewRect = win.getViewPaneSize(), + body = CKEDITOR.document.getBody(), + bodyPos = body.getDocumentPosition(), + cssLength = CKEDITOR.tools.cssLength; + + // Cache for optimization + if ( !notificationWidth || !notificationMargin ) { + notification = this.element.getChild( 0 ); + notificationWidth = this._notificationWidth = notification.getClientRect().width; + notificationMargin = this._notificationMargin = + parseInt( notification.getComputedStyle( 'margin-left' ), 10 ) + + parseInt( notification.getComputedStyle( 'margin-right' ), 10 ); + } + + // Check if toolbar exist and if so, then assign values to it (#491). + if ( editor.toolbar ) { + top = editor.ui.space( editor.config.toolbarLocation ); + topRect = top.getClientRect(); + } + + + // --------------------------------------- Horizontal layout ---------------------------------------- + + // +---Viewport-------------------------------+ +---Viewport-------------------------------+ + // | | | | + // | +---Toolbar----------------------------+ | | +---Content----------------------------+ | + // | | | | | | | | + // | +---Content----------------------------+ | | | | | + // | | | | | +---Toolbar----------------------+ | | + // | | +------Notification------+ | | | | | | | + // | | | | OR | +--------------------------------+ | | + // | | | | | | | | + // | | | | | | +------Notification------+ | | + // | | | | | | | | + // | | | | | | | | + // | +--------------------------------------+ | | +--------------------------------------+ | + // +------------------------------------------+ +------------------------------------------+ + if ( top && top.isVisible() && + topRect.bottom > contentsRect.top && + topRect.bottom < contentsRect.bottom - areaRect.height ) { + setBelowToolbar(); + + // +---Viewport-------------------------------+ + // | | + // | +---Content----------------------------+ | + // | | | | + // | | +------Notification------+ | | + // | | | | + // | | | | + // | | | | + // | +--------------------------------------+ | + // | | + // +------------------------------------------+ + } else if ( contentsRect.top > 0 ) { + setTopStandard(); + + // +---Content----------------------------+ + // | | + // +---Viewport-------------------------------+ + // | | | | + // | | +------Notification------+ | | + // | | | | + // | | | | + // | | | | + // | +--------------------------------------+ | + // | | + // +------------------------------------------+ + } else if ( contentsPos.y + contentsRect.height - areaRect.height > scrollPos.y ) { + setTopFixed(); + + // +---Content----------------------------+ +---Content----------------------------+ + // | | | | + // | | | | + // | | | +------Notification------+ | + // | | | | + // | | OR +--------------------------------------+ + // +---Viewport-------------------------------+ + // | | +------Notification------+ | | +---Viewport-------------------------------+ + // | | | | | | + // | +--------------------------------------+ | | | + // | | | | + // +------------------------------------------+ +------------------------------------------+ + } else { + setBottom(); + } + + function setTopStandard() { + area.setStyles( { + position: 'absolute', + top: cssLength( contentsPos.y ) + } ); + } + + function setBelowToolbar() { + area.setStyles( { + position: 'fixed', + top: cssLength( topRect.bottom ) + } ); + } + + function setTopFixed() { + area.setStyles( { + position: 'fixed', + top: 0 + } ); + } + + function setBottom() { + area.setStyles( { + position: 'absolute', + top: cssLength( contentsPos.y + contentsRect.height - areaRect.height ) + } ); + } + + // ---------------------------------------- Vertical layout ----------------------------------------- + + var leftBase = area.getStyle( 'position' ) == 'fixed' ? + contentsRect.left : + body.getComputedStyle( 'position' ) != 'static' ? contentsPos.x - bodyPos.x : contentsPos.x; + + // Content is narrower than notification + if ( contentsRect.width < notificationWidth + notificationMargin ) { + + // +---Viewport-------------------------------+ + // | | + // | +---Content------------+ | + // | | | | + // | +------Notification------+ | | + // | | | | + // | +----------------------+ | + // | | + // +------------------------------------------+ + if ( contentsPos.x + notificationWidth + notificationMargin > scrollPos.x + viewRect.width ) { + setRight(); + + // +---Viewport-------------------------------+ +---Viewport--------------------------+ + // | | | | + // | +---Content------------+ | +---Content------------+ | + // | | | | | | | | + // | | +------Notification------+ | OR | +------Notification------+ | + // | | | | | | | | + // | +----------------------+ | +----------------------+ | + // | | | | + // +------------------------------------------+ +-------------------------------------+ + } else { + setLeft(); + } + + // Content is wider than notification. + } else { + + // +--+Viewport+------------------------+ + // | | + // | +---Content-----------------------------------------+ + // | | | | + // | | +-----+Notification+-----+ | + // | | | | + // | | | | + // | | | | + // | +---------------------------------------------------+ + // | | + // +------------------------------------+ + if ( contentsPos.x + notificationWidth + notificationMargin > scrollPos.x + viewRect.width ) { + setLeft(); + + // +---Viewport-------------------------+ + // | | + // | +---Content----------------------------------------------+ + // | | | | + // | | +------Notification------+ | | + // | | | | + // | | | | + // | +--------------------------------------------------------+ + // | | + // +------------------------------------+ + } else if ( contentsPos.x + contentsRect.width / 2 + + notificationWidth / 2 + notificationMargin > scrollPos.x + viewRect.width ) { + setRightFixed(); + + // +---Viewport-------------------------+ + // | | + // +---Content----------------------------+ | + // | | | | + // | +------Notification------+ | | + // | | | | + // | | | | + // +--------------------------------------+ | + // | | + // +------------------------------------+ + } else if ( contentsRect.left + contentsRect.width - notificationWidth - notificationMargin < 0 ) { + setRight(); + + // +---Viewport-------------------------+ + // | | + // +---Content---------------------------------------------+ | + // | | | | + // | | +------Notification------+ | | + // | | | | + // | | | | + // +-------------------------------------------------------+ | + // | | + // +------------------------------------+ + } else if ( contentsRect.left + contentsRect.width / 2 - notificationWidth / 2 < 0 ) { + setLeftFixed(); + + // +---Viewport-------------------------+ + // | | + // | +---Content----------------------+ | + // | | | | + // | | +-----Notification-----+ | | + // | | | | + // | | | | + // | +--------------------------------+ | + // | | + // +------------------------------------+ + } else { + setCenter(); + } + } + + function setLeft() { + area.setStyle( 'left', cssLength( leftBase ) ); + } + + function setLeftFixed() { + area.setStyle( 'left', cssLength( leftBase - contentsPos.x + scrollPos.x ) ); + } + + function setCenter() { + area.setStyle( 'left', cssLength( leftBase + contentsRect.width / 2 - notificationWidth / 2 - notificationMargin / 2 ) ); + } + + function setRight() { + area.setStyle( 'left', cssLength( leftBase + contentsRect.width - notificationWidth - notificationMargin ) ); + } + + function setRightFixed() { + area.setStyle( 'left', cssLength( leftBase - contentsPos.x + scrollPos.x + viewRect.width - + notificationWidth - notificationMargin ) ); + } + } + }; + + CKEDITOR.plugins.notification = Notification; + + /** + * After how many milliseconds the notification of the `info` and `success` + * {@link CKEDITOR.plugins.notification#type type} should close automatically. + * `0` means that notifications will not close automatically. + * Note that `warning` and `progress` notifications will never close automatically. + * + * Refer to the [Notifications](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_notifications.html) article + * for more information about this feature. + * + * @since 4.5.0 + * @cfg {Number} [notification_duration=5000] + * @member CKEDITOR.config + */ + + /** + * Event fired when the {@link CKEDITOR.plugins.notification#show} method is called, before the + * notification is shown. If this event is canceled, the notification will not be shown. + * + * Using this event allows you to fully customize how a notification will be shown. It may be used to integrate + * the CKEditor notification system with your web page notifications. + * + * @since 4.5.0 + * @event notificationShow + * @member CKEDITOR.editor + * @param data + * @param {CKEDITOR.plugins.notification} data.notification Notification which will be shown. + * @param {CKEDITOR.editor} editor The editor instance. + */ + + /** + * Event fired when the {@link CKEDITOR.plugins.notification#update} method is called, before the + * notification is updated. If this event is canceled, the notification will not be shown even if the update was important, + * but the object will be updated anyway. Note that canceling this event does not prevent updating {@link #element} + * attributes, but if {@link #notificationShow} was canceled as well, this element is detached from the DOM. + * + * Using this event allows you to fully customize how a notification will be updated. It may be used to integrate + * the CKEditor notification system with your web page notifications. + * + * @since 4.5.0 + * @event notificationUpdate + * @member CKEDITOR.editor + * @param data + * @param {CKEDITOR.plugins.notification} data.notification Notification which will be updated. + * Note that it contains the data that has not been updated yet. + * @param {Object} data.options Update options, see {@link CKEDITOR.plugins.notification#update}. + * @param {CKEDITOR.editor} editor The editor instance. + */ + + /** + * Event fired when the {@link CKEDITOR.plugins.notification#hide} method is called, before the + * notification is hidden. If this event is canceled, the notification will not be hidden. + * + * Using this event allows you to fully customize how a notification will be hidden. It may be used to integrate + * the CKEditor notification system with your web page notifications. + * + * @since 4.5.0 + * @event notificationHide + * @member CKEDITOR.editor + * @param data + * @param {CKEDITOR.plugins.notification} data.notification Notification which will be hidden. + * @param {CKEDITOR.editor} editor The editor instance. + */ + +} )(); Index: lams_central/web/ckeditor/plugins/wordcount/css/wordcount.css =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/css/wordcount.css (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/css/wordcount.css (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,3 @@ +.cke_wordcount {display:block;float:right;margin-top:-2px;margin-right:3px;color:black;} +.cke_wordcount_rtl {float:left;} +.cke_wordcountLimitReached {color:red! important} Index: lams_central/web/ckeditor/plugins/wordcount/lang/ar.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ar.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ar.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,12 @@ +// Arabic Translation by Amine BENHAMIDA + +CKEDITOR.plugins.setLang('wordcount', 'ar', { + WordCount: 'كلمات:', + CharCount: 'حروف:', + CharCountWithHTML: 'حروف مع إتش تي إم إل', + Paragraphs: 'فقرات', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: 'لا يمكن اضافة هذا المحتوى لانه تجاوز الحد الاقصى', + Selected: 'محدد: ', + title: 'احصائيات' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/bg.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/bg.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/bg.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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: 'Статистика' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/ca.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ca.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ca.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'ca', { + WordCount: 'Paraules:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/cs.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/cs.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/cs.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,15 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'cs', + { + WordCount: 'Slov: ', + CharCount: 'Znaků: ', + CharCountWithHTML: 'Znaků (s HTML): ', + Paragraphs: 'Odstavců: ', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: 'Obsah nelze vložit', + Selected: 'Výběr: ', + title: 'Statistika' + }); \ No newline at end of file Index: lams_central/web/ckeditor/plugins/wordcount/lang/da.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/da.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/da.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'da', { + WordCount: 'Ord:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/de.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/de.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/de.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'de', { + WordCount: 'Wörter:', + CharCount: 'Zeichen:', + CharCountWithHTML: 'Zeichen (inkl. HTML):', + Paragraphs: 'Absätze:', + ParagraphsRemaining: 'Verbleibende Absätze', + pasteWarning: 'Text kann nicht eingefügt werden. Text ist zu lang.', + Selected: 'Ausgewählt: ', + title: 'Statistik' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/el.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/el.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/el.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'el', { + WordCount: 'Λέξεις:', + CharCount: 'Χαρακτήρες:', + CharCountWithHTML: 'Χαρακτήρες (μαζί με HTML):', + Paragraphs: 'Paragraphs:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: 'Content can not be pasted because it is above the allowed limit', + Selected: 'Selected: ', + title: 'Στατιστικά' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/en.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/en.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/en.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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', 'en', { + WordCount: 'Words:', + WordCountRemaining: 'Words remaining', + CharCount: 'Characters:', + CharCountRemaining: 'Characters remaining', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/es.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/es.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/es.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'es', { + WordCount: 'Palabras:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/eu.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/eu.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/eu.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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', '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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/fa.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/fa.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/fa.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,13 @@ +/* +Its The Persian (Farsi) Language Translate For Iranian By "Mohsen Esmaili" +*/ +CKEDITOR.plugins.setLang('wordcount', 'fa', { + WordCount: 'لغت:', + CharCount: 'کاراکتر:', + CharCountWithHTML: 'کاراکترها (با HTML):', + Paragraphs: 'پاراگراف:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: 'محتوای مورد نظر را نمی توان چسباند. زیرا این بیشتر از حد مجاز است.', + Selected: 'انتخاب شده: ', + title: 'آمار' +}); \ No newline at end of file Index: lams_central/web/ckeditor/plugins/wordcount/lang/fi.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/fi.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/fi.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,15 @@ +/** + * Finnish localisation. + * + * @author Joel Posti / Response200.pro + */ +CKEDITOR.plugins.setLang('wordcount', 'fi', { + WordCount: 'Sanoja:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/fr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/fr.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/fr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,12 @@ +// French Translation by Nicolas M. et Pierre-Luc Auclair + +CKEDITOR.plugins.setLang('wordcount', 'fr', { + WordCount: 'Mots :', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/he.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/he.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/he.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'he', { + WordCount: 'מילים:', + CharCount: 'תווים:', + CharCountWithHTML: 'תווים (כולל HTML):', + Paragraphs: 'פסקאות:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: 'לא ניתן להדביק תוכן בשל עודף תווים', + Selected: 'נבחר: ', + title: 'סטטיסטיקות' +}); \ No newline at end of file Index: lams_central/web/ckeditor/plugins/wordcount/lang/hr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/hr.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/hr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +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:", + ParagraphsRemaining: "Paragraphs remaining", + pasteWarning: "Content can not be pasted because it is above the allowed limit", + Selected: "Selected: ", + title: "Statistika" +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/hu.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/hu.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/hu.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'hu', { + WordCount: 'Szavak:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/it.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/it.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/it.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,15 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +@author translation: Davide Montorio +*/ +CKEDITOR.plugins.setLang('wordcount', 'it', { + WordCount: 'Parole:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/ja.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ja.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ja.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'ja', { + WordCount: '単語数:', + CharCount: '文字数:', + CharCountWithHTML: '文字数 (HTMLタグを含む):', + Paragraphs: '段落数:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: '文字数/単語数の上限を超えるため、貼り付けできません。', + Selected: '選択中の字数:', + title: 'ワードカウント' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/ka.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ka.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ka.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,18 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +GEO Translation by E404R +*/ +CKEDITOR.plugins.setLang('wordcount', 'ka', { + WordCount: 'სიტყვები:', + WordCountRemaining: 'დარჩენილი სიტყვები', + CharCount: 'სიმბოლო:', + CharCountRemaining: 'დარჩენილი სიმბოლო', + CharCountWithHTML: 'სიმბოლოები (HTML ით):', + CharCountWithHTMLRemaining: 'სიმბოლოები (HTML ით) დარჩენილი', + Paragraphs: 'პარაგრაფი:', + ParagraphsRemaining: 'დარჩენილი პარაგრაფი', + pasteWarning: 'ჩასმა შეუძლებელია, რადგან ის აღემატება დასაშვებ ლიმიტს', + Selected: 'არჩეული: ', + title: 'სტატისტიკა' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/ko.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ko.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ko.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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: '통계' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/nl.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/nl.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/nl.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'nl', { + WordCount: 'Woorden:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/no.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/no.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/no.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,11 @@ +// Norwegian translation by Vegard S. +CKEDITOR.plugins.setLang('wordcount', 'no', { + WordCount: 'Ord:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/pl.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/pl.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/pl.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'pl', { + WordCount: 'Słów:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/pt-br.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/pt-br.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/pt-br.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'pt-br', { + WordCount: 'Contagem de palavras:', + CharCount: 'Contagem de caracteres:', + CharCountWithHTML: 'Caracteres (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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/pt.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/pt.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/pt.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,10 @@ +CKEDITOR.plugins.setLang('wordcount', 'pt', { + WordCount: 'Palavras:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/ro.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ro.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ro.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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 Index: lams_central/web/ckeditor/plugins/wordcount/lang/ru.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/ru.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/ru.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'ru', { + WordCount: 'Слов:', + CharCount: 'Символов:', + CharCountWithHTML: ' (включая HTML-разметку):', + Paragraphs: 'Параграфов:', + ParagraphsRemaining: 'Параграфов осталось', + pasteWarning: 'Контент не может быть вставлен, т.к. привышает допустимый лимит', + Selected: 'Выделено: ', + title: 'Статистика' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/sk.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/sk.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/sk.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,15 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ +CKEDITOR.plugins.setLang('wordcount', 'sk', { + WordCount: 'Slov:', + CharCount: 'Znakov:', + CharCountWithHTML: 'Znakov (vrátane HTML):', + Paragraphs: 'Odstavcov:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: 'Obsah sa nedá prilepiť.', + Selected: 'Výber: ', + title: 'Štatistika' +}); + Index: lams_central/web/ckeditor/plugins/wordcount/lang/sv.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/sv.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/sv.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,15 @@ +/* +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. +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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/tr.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/tr.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/tr.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,14 @@ +/* +Mesut ÇAKIR +mesut.cakir@hotmail.com.tr +*/ +CKEDITOR.plugins.setLang('wordcount', 'tr', { + WordCount: 'Kelime:', + 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' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/uk.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/uk.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/uk.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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: 'Статистика' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/zh-cn.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/zh-cn.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/zh-cn.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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', 'zh-cn', { + WordCount: '词数:', + WordCountRemaining: 'Words remaining', + CharCount: '字符:', + CharCountRemaining: '个剩余字符', + CharCountWithHTML: '字符 (含HTML)', + CharCountWithHTMLRemaining: 'Characters (with HTML) remaining', + Paragraphs: '段落:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: '由于上限允许,内容不能粘贴', + Selected: '已选择: ', + title: '统计' +}); Index: lams_central/web/ckeditor/plugins/wordcount/lang/zh.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/lang/zh.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/lang/zh.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -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', 'zh', { + WordCount: '詞數:', + WordCountRemaining: 'Words remaining', + CharCount: '字數:', + CharCountRemaining: '個剩餘字元', + CharCountWithHTML: '字數 (含HTML)', + CharCountWithHTMLRemaining: 'Characters (with HTML) remaining', + Paragraphs: '段落:', + ParagraphsRemaining: 'Paragraphs remaining', + pasteWarning: '由於字數達到上限,內容不能粘貼', + Selected: '已選擇: ', + title: '統計' +}); \ No newline at end of file Index: lams_central/web/ckeditor/plugins/wordcount/plugin.js =================================================================== diff -u --- lams_central/web/ckeditor/plugins/wordcount/plugin.js (revision 0) +++ lams_central/web/ckeditor/plugins/wordcount/plugin.js (revision dca7fef745b8fcefbfd8aeba9df093b5ae204b0a) @@ -0,0 +1,638 @@ +/** + * @license Copyright (c) CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.html or http://ckeditor.com/license + */ + +CKEDITOR.plugins.add("wordcount", + { + 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.9", + 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; + + 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); + }; + + // 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); + } + }; + + // 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%"; + } + } + + 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%"; + + defaultFormat += "/" + config.maxWordCount; + } + } else { + defaultFormat += editor.lang.wordcount.WordCount + " %wordCount%"; + } + } + + 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"]; + } else { + defaultFormat += editor.lang.wordcount[config.countHTML + ? "CharCountWithHTML" + : "CharCount"] + + " %charCount%"; + + defaultFormat += "/" + config.maxCharCount; + } + } else { + defaultFormat += editor.lang.wordcount[config.countHTML ? "CharCountWithHTML" : "CharCount"] + + " %charCount%"; + } + } + + var format = defaultFormat; + + bbcodePluginLoaded = typeof editor.plugins.bbcode != "undefined"; + + function counterId(editorInstance) { + return "cke_wordcount_" + editorInstance.name; + } + + function counterElement(editorInstance) { + return document.getElementById(counterId(editorInstance)); + } + + function strip(html) { + if (bbcodePluginLoaded) { + // stripping out BBCode tags [...][/...] + return html.replace(/\[.*?\]/gi, ""); + } + + var tmp = document.createElement("div"); + + // Add filter before strip + html = filter(html); + + tmp.innerHTML = html; + + if (tmp.textContent == "" && typeof tmp.innerText == "undefined") { + return ""; + } + + return tmp.textContent || tmp.innerText; + } + + /** + * 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 + if (editor.config.fullPage) { + var i = text.search(new RegExp("
", "i")); + if (i != -1) { + var j = text.search(new RegExp("", "i")); + text = text.substring(i + 6, j); + } + + } + + normalizedText = text; + + if (!config.countSpacesAsChars) { + normalizedText = text.replace(/\s/g, "").replace(/ /g, ""); + } + + if (config.countLineBreaks) { + normalizedText = normalizedText.replace(/(\r\n|\n|\r)/gm, " "); + } else { + normalizedText = normalizedText.replace(/(\r\n|\n|\r)/gm, "").replace(/ /gi, " "); + } + + normalizedText = strip(normalizedText).replace(/^([\t\r\n]*)$/, ""); + + 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; + } + return count; + } + + function countParagraphs(text) { + return (text.replace(/ /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(" ", " "); + + normalizedText = strip(normalizedText); + + 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); + } + + function limitReached(editorInstance, notify) { + limitReachedNotified = true; + limitRestoredNotified = false; + + if (!config.warnOnLimitOnly) { + if (config.hardLimit) { + if (editor.mode === "source" && editor.plugins.codemirror) { + window["codemirror_" + editor.id].undo(); + } else { + editorInstance.execCommand("undo"); + editorInstance.execCommand("undo"); + } + + } + } + + if (!notify) { + counterElement(editorInstance).className = "cke_path_item cke_wordcountLimitReached"; + editorInstance.fire("limitReached", { firedBy: "wordCount.limitReached" }, editor); + } + } + + function limitRestored(editorInstance) { + limitRestoredNotified = true; + limitReachedNotified = false; + + if (!config.warnOnLimitOnly) { + editorInstance.fire("saveSnapshot"); + } + + counterElement(editorInstance).className = "cke_path_item"; + } + + function updateCounter(editorInstance) { + if (!counterElement(editorInstance)) { + return; + } + + 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); + } + + if (config.showParagraphs) { + paragraphs = countParagraphs(text); + } + + if (config.showWordCount) { + wordCount = countWords(text); + } + } + + 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).replace("%charCount%", charCount).replace("%paragraphsCount%", paragraphs); + } + + (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 && paragraphs == lastParagraphs) { + if (charCount == config.maxCharCount || wordCount == config.maxWordCount || paragraphs > config.maxParagraphs) { + editorInstance.fire("saveSnapshot"); + } + 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; + var deltaParagraphs = paragraphs - lastParagraphs; + + lastWordCount = wordCount; + lastCharCount = charCount; + lastParagraphs = paragraphs; + + if (lastWordCount == -1) { + lastWordCount = wordCount; + } + if (lastCharCount == -1) { + lastCharCount = charCount; + } + if (lastParagraphs == -1) { + 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) || + (config.maxParagraphs > -1 && paragraphs > config.maxParagraphs && deltaParagraphs > 0)) { + + limitReached(editorInstance, limitReachedNotified); + } else if ((config.maxWordCount == -1 || wordCount <= config.maxWordCount) && + (config.maxCharCount == -1 || charCount <= config.maxCharCount) && + (config.maxParagraphs == -1 || paragraphs <= config.maxParagraphs)) { + + limitRestored(editorInstance); + } else { + editorInstance.fire("saveSnapshot"); + } + + // 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); + } + } + + if (config.wordCountGreaterThanMaxLengthEvent && config.wordCountLessThanMaxLengthEvent) { + if (wordCount > config.maxWordCount && config.maxWordCount > -1) { + config.wordCountGreaterThanMaxLengthEvent(wordCount, config.maxWordCount); + + } else { + config.wordCountLessThanMaxLengthEvent(wordCount, config.maxWordCount); + } + } + + return true; + } + + function isCloseToLimits() { + if (config.maxWordCount > -1 && config.maxWordCount - lastWordCount < 5) { + return true; + } + + if (config.maxCharCount > -1 && config.maxCharCount - lastCharCount < 20) { + return true; + } + + if (config.maxParagraphs > -1 && config.maxParagraphs - lastParagraphs < 1) { + return true; + } + + return false; + } + + editor.on("key", + function (event) { + var ms = isCloseToLimits() ? 5 : 250; + + if (editor.mode === "source") { + clearTimeout(timeoutId); + timeoutId = setTimeout( + updateCounter.bind(this, event.editor), + ms + ); + } + + if (event.data.keyCode == 13) { + clearTimeout(timeoutId); + timeoutId = setTimeout( + updateCounter.bind(this, event.editor), + ms + ); + } + }, + editor); + + editor.on("change", + function(event) { + var ms = isCloseToLimits() ? 5 : 250; + clearTimeout(timeoutId); + timeoutId = setTimeout( + updateCounter.bind(this, event.editor), + ms + ); + }, + editor); + + editor.on("uiSpace", + function (event) { + var wordcountClass = "cke_wordcount"; + + if (editor.lang.dir == "rtl") { + wordcountClass = wordcountClass + " cke_wordcount_rtl"; + } + + if (editor.elementMode === CKEDITOR.ELEMENT_MODE_INLINE) { + if (event.data.space == "top") { + event.data.html += "+ WordCount Plugin for CKEditor that counts the words an shows the word count in the footer of the editor.. +
+
+ In order to use the new plugin, include it in the config.extraPlugins
configuration setting.
+
+CKEDITOR.replace( 'textarea_id', { + extraPlugins: 'wordcount' +} ); ++
+ WordCount Plugin for CKEditor that counts the words an shows the word count in the footer of the editor.. +
+
+ In order to use the new plugin, include it in the config.extraPlugins
configuration setting.
+
+CKEDITOR.replace( 'textarea_id', { + extraPlugins: 'wordcount', + maxWordCount: 4, + maxCharCount: 10, + // optional events + paragraphsCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) { + $("#informationparagraphs").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - paragraphs").show(); + }, + wordCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) { + $("#informationword").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - word").show(); + }, + charCountGreaterThanMaxLengthEvent: function (currentLength, maxLength) { + $("#informationchar").css("background-color", "crimson").css("color", "white").text(currentLength + "/" + maxLength + " - char").show(); + }, + charCountLessThanMaxLengthEvent: function (currentLength, maxLength) { + $("#informationchar").css("background-color", "white").css("color", "black").hide(); + }, + paragraphsCountLessThanMaxLengthEvent: function (currentLength, maxLength) { + $("#informationparagraphs").css("background-color", "white").css("color", "black").hide(); + }, + wordCountLessThanMaxLengthEvent: function (currentLength, maxLength) { + $("#informationword").css("background-color", "white").css("color", "black").hide(); + } +} ); ++