@ckeditor/ckeditor5-word-count 45.2.1-alpha.4 → 45.2.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/word-count.js +1 -1
- package/package.json +5 -5
package/build/word-count.js
CHANGED
@@ -2,4 +2,4 @@
|
|
2
2
|
/*!
|
3
3
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
4
4
|
* For licensing, see LICENSE.md.
|
5
|
-
*/(()=>{var t={237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,e,r)=>{t.exports=r(237)("./src/ui.js")},584:(t,e,r)=>{t.exports=r(237)("./src/utils.js")},782:(t,e,r)=>{t.exports=r(237)("./src/core.js")}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{WordCount:()=>l});var t=r(782),e=r(311),n=r(584);function i(t){if(t.is("$text")||t.is("$textProxy"))return t.data;const e=t;let r="",o=null;for(const t of e.getChildren()){const e=i(t);o&&o.is("element")&&(r+="\n"),r+=e,o=t}return r}function s(t,e,{signal:r,edges:o}={}){let n,i=null;const s=null!=o&&o.includes("leading"),c=null==o||o.includes("trailing"),a=()=>{null!==i&&(t.apply(n,i),n=void 0,i=null)};let l=null;const u=()=>{null!=l&&clearTimeout(l),l=setTimeout((
|
5
|
+
*/(()=>{var t={237:t=>{"use strict";t.exports=CKEditor5.dll},311:(t,e,r)=>{t.exports=r(237)("./src/ui.js")},584:(t,e,r)=>{t.exports=r(237)("./src/utils.js")},782:(t,e,r)=>{t.exports=r(237)("./src/core.js")}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{WordCount:()=>l});var t=r(782),e=r(311),n=r(584);function i(t){if(t.is("$text")||t.is("$textProxy"))return t.data;const e=t;let r="",o=null;for(const t of e.getChildren()){const e=i(t);o&&o.is("element")&&(r+="\n"),r+=e,o=t}return r}function s(t,e,{signal:r,edges:o}={}){let n,i=null;const s=null!=o&&o.includes("leading"),c=null==o||o.includes("trailing"),a=()=>{null!==i&&(t.apply(n,i),n=void 0,i=null)};let l=null;const u=()=>{null!=l&&clearTimeout(l),l=setTimeout(()=>{l=null,c&&a(),h()},e)},d=()=>{null!==l&&(clearTimeout(l),l=null)},h=()=>{d(),n=void 0,i=null},g=function(...t){if(r?.aborted)return;n=this,i=t;const e=null==l;u(),s&&e&&a()};return g.schedule=u,g.cancel=h,g.flush=()=>{d(),a()},r?.addEventListener("abort",h,{once:!0}),g}function c(t,e=0,r={}){"object"!=typeof r&&(r={});const{leading:o=!0,trailing:n=!0,signal:i}=r;return function(t,e=0,r={}){"object"!=typeof r&&(r={});const{signal:o,leading:n=!1,trailing:i=!0,maxWait:c}=r,a=Array(2);let l;n&&(a[0]="leading"),i&&(a[1]="trailing");let u=null;const d=s(function(...e){l=t.apply(this,e),u=null},e,{signal:o,edges:a}),h=function(...e){if(null!=c)if(null===u)u=Date.now();else if(Date.now()-u>=c)return l=t.apply(this,e),u=Date.now(),d.cancel(),d.schedule(),l;return d.apply(this,e),l};return h.cancel=d.cancel,h.flush=()=>(d.flush(),l),h}(t,e,{leading:o,trailing:n,signal:i,maxWait:e})}function a(t){return function(t){return"object"==typeof t&&null!==t}(t)&&1===t.nodeType&&!function(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==Object.prototype.toString.call(t)){const e=t[Symbol.toStringTag];return null!=e&&(!!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable&&t.toString()===`[object ${e}]`)}let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t)}class l extends t.Plugin{_config;_outputView;_wordsMatchRegExp;constructor(t){super(t),this.set("characters",0),this.set("words",0),Object.defineProperties(this,{characters:{get(){return this.characters=this._getCharacters(this._getText())}},words:{get(){return this.words=this._getWords(this._getText())}}}),this.set("_wordsLabel",void 0),this.set("_charactersLabel",void 0),this._config=t.config.get("wordCount")||{},this._outputView=void 0,this._wordsMatchRegExp=n.env.features.isRegExpUnicodePropertySupported?new RegExp("([\\p{L}\\p{N}]+\\S?)+","gu"):/([a-zA-Z0-9À-ž]+\S?)+/gu}static get pluginName(){return"WordCount"}static get isOfficialPlugin(){return!0}init(){this.editor.model.document.on("change:data",c(this._refreshStats.bind(this),250)),"function"==typeof this._config.onUpdate&&this.on("update",(t,e)=>{this._config.onUpdate(e)}),a(this._config.container)&&this._config.container.appendChild(this.wordCountContainer)}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy()}get wordCountContainer(){const t=this.editor,r=t.t,o=t.config.get("wordCount.displayWords"),n=t.config.get("wordCount.displayCharacters"),i=e.Template.bind(this,this),s=[];return this._outputView||(this._outputView=new e.View,(o||void 0===o)&&(this.bind("_wordsLabel").to(this,"words",t=>r("Words: %0",t)),s.push({tag:"div",children:[{text:[i.to("_wordsLabel")]}],attributes:{class:"ck-word-count__words"}})),(n||void 0===n)&&(this.bind("_charactersLabel").to(this,"characters",t=>r("Characters: %0",t)),s.push({tag:"div",children:[{text:[i.to("_charactersLabel")]}],attributes:{class:"ck-word-count__characters"}})),this._outputView.setTemplate({tag:"div",attributes:{class:["ck","ck-word-count"]},children:s}),this._outputView.render()),this._outputView.element}_getText(){let t="";for(const e of this.editor.model.document.getRoots())""!==t&&(t+="\n"),t+=i(e);return t}_getCharacters(t){return t.replace(/\n/g,"").length}_getWords(t){return(t.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){const t=this._getText(),e=this.words=this._getWords(t),r=this.characters=this._getCharacters(t);this.fire("update",{words:e,characters:r})}}})(),(window.CKEditor5=window.CKEditor5||{}).wordCount=o})();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-word-count",
|
3
|
-
"version": "45.2.1-alpha.
|
3
|
+
"version": "45.2.1-alpha.5",
|
4
4
|
"description": "Word and character count feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,11 +13,11 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"@ckeditor/ckeditor5-core": "45.2.1-alpha.
|
17
|
-
"@ckeditor/ckeditor5-ui": "45.2.1-alpha.
|
18
|
-
"@ckeditor/ckeditor5-utils": "45.2.1-alpha.
|
16
|
+
"@ckeditor/ckeditor5-core": "45.2.1-alpha.5",
|
17
|
+
"@ckeditor/ckeditor5-ui": "45.2.1-alpha.5",
|
18
|
+
"@ckeditor/ckeditor5-utils": "45.2.1-alpha.5",
|
19
19
|
"es-toolkit": "1.32.0",
|
20
|
-
"ckeditor5": "45.2.1-alpha.
|
20
|
+
"ckeditor5": "45.2.1-alpha.5"
|
21
21
|
},
|
22
22
|
"author": "CKSource (http://cksource.com/)",
|
23
23
|
"license": "SEE LICENSE IN LICENSE.md",
|