@ckeditor/ckeditor5-word-count 41.4.2 → 42.0.0-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -0
- package/dist/index.js +97 -57
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
@@ -15,6 +15,12 @@ Check out the demo in the [word count and character count feature guide](https:/
|
|
15
15
|
|
16
16
|
See the [`@ckeditor/ckeditor5-word-count` package](https://ckeditor.com/docs/ckeditor5/latest/api/word-count.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
|
17
17
|
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
```bash
|
21
|
+
npm install ckeditor5
|
22
|
+
```
|
23
|
+
|
18
24
|
## License
|
19
25
|
|
20
26
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
|
package/dist/index.js
CHANGED
@@ -11,6 +11,8 @@ import { throttle, isElement } from 'lodash-es';
|
|
11
11
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
12
12
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
13
13
|
*/ /**
|
14
|
+
* @module word-count/utils
|
15
|
+
*/ /**
|
14
16
|
* Returns a plain text representation of an element and its children.
|
15
17
|
*
|
16
18
|
* @returns Plain text representing the model's data.
|
@@ -33,15 +35,84 @@ import { throttle, isElement } from 'lodash-es';
|
|
33
35
|
return text;
|
34
36
|
}
|
35
37
|
|
36
|
-
|
38
|
+
/**
|
39
|
+
* The word count plugin.
|
40
|
+
*
|
41
|
+
* This plugin calculates all words and characters in all {@link module:engine/model/text~Text text nodes} available in the model.
|
42
|
+
* It also provides an HTML element that updates its state whenever the editor content is changed.
|
43
|
+
*
|
44
|
+
* The model's data is first converted to plain text using {@link module:word-count/utils~modelElementToPlainText}.
|
45
|
+
* The number of words and characters in your text are determined based on the created plain text. Please keep in mind
|
46
|
+
* that every block in the editor is separated with a newline character, which is included in the calculation.
|
47
|
+
*
|
48
|
+
* Here are some examples of how the word and character calculations are made:
|
49
|
+
*
|
50
|
+
* ```html
|
51
|
+
* <paragraph>foo</paragraph>
|
52
|
+
* <paragraph>bar</paragraph>
|
53
|
+
* // Words: 2, Characters: 7
|
54
|
+
*
|
55
|
+
* <paragraph><$text bold="true">foo</$text>bar</paragraph>
|
56
|
+
* // Words: 1, Characters: 6
|
57
|
+
*
|
58
|
+
* <paragraph>*&^%)</paragraph>
|
59
|
+
* // Words: 0, Characters: 5
|
60
|
+
*
|
61
|
+
* <paragraph>foo(bar)</paragraph>
|
62
|
+
* //Words: 1, Characters: 8
|
63
|
+
*
|
64
|
+
* <paragraph>12345</paragraph>
|
65
|
+
* // Words: 1, Characters: 5
|
66
|
+
* ```
|
67
|
+
*/ class WordCount extends Plugin {
|
68
|
+
/**
|
69
|
+
* The configuration of this plugin.
|
70
|
+
*/ _config;
|
71
|
+
/**
|
72
|
+
* The reference to a {@link module:ui/view~View view object} that contains the self-updating HTML container.
|
73
|
+
*/ _outputView;
|
37
74
|
/**
|
38
|
-
|
39
|
-
|
75
|
+
* A regular expression used to recognize words in the editor's content.
|
76
|
+
*/ _wordsMatchRegExp;
|
77
|
+
/**
|
78
|
+
* @inheritDoc
|
79
|
+
*/ constructor(editor){
|
80
|
+
super(editor);
|
81
|
+
this.set('characters', 0);
|
82
|
+
this.set('words', 0);
|
83
|
+
// Don't wait for the #update event to set the value of the properties but obtain it right away.
|
84
|
+
// This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.
|
85
|
+
// If not accessed directly, the properties will be refreshed upon #update anyway.
|
86
|
+
Object.defineProperties(this, {
|
87
|
+
characters: {
|
88
|
+
get () {
|
89
|
+
return this.characters = this._getCharacters(this._getText());
|
90
|
+
}
|
91
|
+
},
|
92
|
+
words: {
|
93
|
+
get () {
|
94
|
+
return this.words = this._getWords(this._getText());
|
95
|
+
}
|
96
|
+
}
|
97
|
+
});
|
98
|
+
this.set('_wordsLabel', undefined);
|
99
|
+
this.set('_charactersLabel', undefined);
|
100
|
+
this._config = editor.config.get('wordCount') || {};
|
101
|
+
this._outputView = undefined;
|
102
|
+
this._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ? // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).
|
103
|
+
// Groups:
|
104
|
+
// {L} - Any kind of letter from any language.
|
105
|
+
// {N} - Any kind of numeric character in any script.
|
106
|
+
new RegExp('([\\p{L}\\p{N}]+\\S?)+', 'gu') : /([a-zA-Z0-9À-ž]+\S?)+/gu;
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* @inheritDoc
|
110
|
+
*/ static get pluginName() {
|
40
111
|
return 'WordCount';
|
41
112
|
}
|
42
113
|
/**
|
43
|
-
|
44
|
-
|
114
|
+
* @inheritDoc
|
115
|
+
*/ init() {
|
45
116
|
const editor = this.editor;
|
46
117
|
editor.model.document.on('change:data', throttle(this._refreshStats.bind(this), 250));
|
47
118
|
if (typeof this._config.onUpdate == 'function') {
|
@@ -54,8 +125,8 @@ class WordCount extends Plugin {
|
|
54
125
|
}
|
55
126
|
}
|
56
127
|
/**
|
57
|
-
|
58
|
-
|
128
|
+
* @inheritDoc
|
129
|
+
*/ destroy() {
|
59
130
|
if (this._outputView) {
|
60
131
|
this._outputView.element.remove();
|
61
132
|
this._outputView.destroy();
|
@@ -63,16 +134,16 @@ class WordCount extends Plugin {
|
|
63
134
|
super.destroy();
|
64
135
|
}
|
65
136
|
/**
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
137
|
+
* Creates a self-updating HTML element. Repeated executions return the same element.
|
138
|
+
* The returned element has the following HTML structure:
|
139
|
+
*
|
140
|
+
* ```html
|
141
|
+
* <div class="ck ck-word-count">
|
142
|
+
* <div class="ck-word-count__words">Words: 4</div>
|
143
|
+
* <div class="ck-word-count__characters">Characters: 28</div>
|
144
|
+
* </div>
|
145
|
+
* ```
|
146
|
+
*/ get wordCountContainer() {
|
76
147
|
const editor = this.editor;
|
77
148
|
const t = editor.t;
|
78
149
|
const displayWords = editor.config.get('wordCount.displayWords');
|
@@ -143,22 +214,22 @@ class WordCount extends Plugin {
|
|
143
214
|
return txt;
|
144
215
|
}
|
145
216
|
/**
|
146
|
-
|
147
|
-
|
217
|
+
* Determines the number of characters in the current editor's model.
|
218
|
+
*/ _getCharacters(txt) {
|
148
219
|
return txt.replace(/\n/g, '').length;
|
149
220
|
}
|
150
221
|
/**
|
151
|
-
|
152
|
-
|
222
|
+
* Determines the number of words in the current editor's model.
|
223
|
+
*/ _getWords(txt) {
|
153
224
|
const detectedWords = txt.match(this._wordsMatchRegExp) || [];
|
154
225
|
return detectedWords.length;
|
155
226
|
}
|
156
227
|
/**
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
228
|
+
* Determines the number of words and characters in the current editor's model and assigns it to {@link #characters} and {@link #words}.
|
229
|
+
* It also fires the {@link #event:update}.
|
230
|
+
*
|
231
|
+
* @fires update
|
232
|
+
*/ _refreshStats() {
|
162
233
|
const txt = this._getText();
|
163
234
|
const words = this.words = this._getWords(txt);
|
164
235
|
const characters = this.characters = this._getCharacters(txt);
|
@@ -167,37 +238,6 @@ class WordCount extends Plugin {
|
|
167
238
|
characters
|
168
239
|
});
|
169
240
|
}
|
170
|
-
/**
|
171
|
-
* @inheritDoc
|
172
|
-
*/ constructor(editor){
|
173
|
-
super(editor);
|
174
|
-
this.set('characters', 0);
|
175
|
-
this.set('words', 0);
|
176
|
-
// Don't wait for the #update event to set the value of the properties but obtain it right away.
|
177
|
-
// This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.
|
178
|
-
// If not accessed directly, the properties will be refreshed upon #update anyway.
|
179
|
-
Object.defineProperties(this, {
|
180
|
-
characters: {
|
181
|
-
get () {
|
182
|
-
return this.characters = this._getCharacters(this._getText());
|
183
|
-
}
|
184
|
-
},
|
185
|
-
words: {
|
186
|
-
get () {
|
187
|
-
return this.words = this._getWords(this._getText());
|
188
|
-
}
|
189
|
-
}
|
190
|
-
});
|
191
|
-
this.set('_wordsLabel', undefined);
|
192
|
-
this.set('_charactersLabel', undefined);
|
193
|
-
this._config = editor.config.get('wordCount') || {};
|
194
|
-
this._outputView = undefined;
|
195
|
-
this._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ? // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).
|
196
|
-
// Groups:
|
197
|
-
// {L} - Any kind of letter from any language.
|
198
|
-
// {N} - Any kind of numeric character in any script.
|
199
|
-
new RegExp('([\\p{L}\\p{N}]+\\S?)+', 'gu') : /([a-zA-Z0-9À-ž]+\S?)+/gu;
|
200
|
-
}
|
201
241
|
}
|
202
242
|
|
203
243
|
export { WordCount };
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js","../src/utils.ts","../src/wordcount.ts"],"names":["modelElementToPlainText","item","is","data","element","text","prev","child","getChildren","childText","WordCount","Plugin","pluginName","init","editor","model","document","on","throttle","_refreshStats","bind","_config","onUpdate","evt","isElement","container","appendChild","wordCountContainer","destroy","_outputView","remove","t","displayWords","config","get","displayCharacters","Template","children","View","undefined","to","words","push","tag","attributes","class","setTemplate","render","_getText","txt","root","getRoots","_getCharacters","replace","length","_getWords","detectedWords","match","_wordsMatchRegExp","characters","fire","constructor","set","Object","defineProperties","env","features","isRegExpUnicodePropertySupported","RegExp"],"mappings":";;;;AAAA,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAA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dist/index.js';\nimport { env } from '@ckeditor/ckeditor5-utils/dist/index.js';\nimport { throttle, isElement } from 'lodash-es';\n\n/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */ /**\n * Returns a plain text representation of an element and its children.\n *\n * @returns Plain text representing the model's data.\n */ function modelElementToPlainText(item) {\n if (item.is('$text') || item.is('$textProxy')) {\n return item.data;\n }\n const element = item;\n let text = '';\n let prev = null;\n for (const child of element.getChildren()){\n const childText = modelElementToPlainText(child);\n // If last block was finish, start from new line.\n if (prev && prev.is('element')) {\n text += '\\n';\n }\n text += childText;\n prev = child;\n }\n return text;\n}\n\nclass WordCount extends Plugin {\n /**\n * @inheritDoc\n */ static get pluginName() {\n return 'WordCount';\n }\n /**\n * @inheritDoc\n */ init() {\n const editor = this.editor;\n editor.model.document.on('change:data', throttle(this._refreshStats.bind(this), 250));\n if (typeof this._config.onUpdate == 'function') {\n this.on('update', (evt, data)=>{\n this._config.onUpdate(data);\n });\n }\n if (isElement(this._config.container)) {\n this._config.container.appendChild(this.wordCountContainer);\n }\n }\n /**\n * @inheritDoc\n */ destroy() {\n if (this._outputView) {\n this._outputView.element.remove();\n this._outputView.destroy();\n }\n super.destroy();\n }\n /**\n * Creates a self-updating HTML element. Repeated executions return the same element.\n * The returned element has the following HTML structure:\n *\n * ```html\n * <div class=\"ck ck-word-count\">\n * \t<div class=\"ck-word-count__words\">Words: 4</div>\n * \t<div class=\"ck-word-count__characters\">Characters: 28</div>\n * </div>\n * ```\n */ get wordCountContainer() {\n const editor = this.editor;\n const t = editor.t;\n const displayWords = editor.config.get('wordCount.displayWords');\n const displayCharacters = editor.config.get('wordCount.displayCharacters');\n const bind = Template.bind(this, this);\n const children = [];\n if (!this._outputView) {\n this._outputView = new View();\n if (displayWords || displayWords === undefined) {\n this.bind('_wordsLabel').to(this, 'words', (words)=>{\n return t('Words: %0', words);\n });\n children.push({\n tag: 'div',\n children: [\n {\n text: [\n bind.to('_wordsLabel')\n ]\n }\n ],\n attributes: {\n class: 'ck-word-count__words'\n }\n });\n }\n if (displayCharacters || displayCharacters === undefined) {\n this.bind('_charactersLabel').to(this, 'characters', (words)=>{\n return t('Characters: %0', words);\n });\n children.push({\n tag: 'div',\n children: [\n {\n text: [\n bind.to('_charactersLabel')\n ]\n }\n ],\n attributes: {\n class: 'ck-word-count__characters'\n }\n });\n }\n this._outputView.setTemplate({\n tag: 'div',\n attributes: {\n class: [\n 'ck',\n 'ck-word-count'\n ]\n },\n children\n });\n this._outputView.render();\n }\n return this._outputView.element;\n }\n _getText() {\n let txt = '';\n for (const root of this.editor.model.document.getRoots()){\n if (txt !== '') {\n // Add a delimiter, so words from each root are treated independently.\n txt += '\\n';\n }\n txt += modelElementToPlainText(root);\n }\n return txt;\n }\n /**\n * Determines the number of characters in the current editor's model.\n */ _getCharacters(txt) {\n return txt.replace(/\\n/g, '').length;\n }\n /**\n * Determines the number of words in the current editor's model.\n */ _getWords(txt) {\n const detectedWords = txt.match(this._wordsMatchRegExp) || [];\n return detectedWords.length;\n }\n /**\n * Determines the number of words and characters in the current editor's model and assigns it to {@link #characters} and {@link #words}.\n * It also fires the {@link #event:update}.\n *\n * @fires update\n */ _refreshStats() {\n const txt = this._getText();\n const words = this.words = this._getWords(txt);\n const characters = this.characters = this._getCharacters(txt);\n this.fire('update', {\n words,\n characters\n });\n }\n /**\n * @inheritDoc\n */ constructor(editor){\n super(editor);\n this.set('characters', 0);\n this.set('words', 0);\n // Don't wait for the #update event to set the value of the properties but obtain it right away.\n // This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.\n // If not accessed directly, the properties will be refreshed upon #update anyway.\n Object.defineProperties(this, {\n characters: {\n get () {\n return this.characters = this._getCharacters(this._getText());\n }\n },\n words: {\n get () {\n return this.words = this._getWords(this._getText());\n }\n }\n });\n this.set('_wordsLabel', undefined);\n this.set('_charactersLabel', undefined);\n this._config = editor.config.get('wordCount') || {};\n this._outputView = undefined;\n this._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ? // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n // Groups:\n // {L} - Any kind of letter from any language.\n // {N} - Any kind of numeric character in any script.\n new RegExp('([\\\\p{L}\\\\p{N}]+\\\\S?)+', 'gu') : /([a-zA-Z0-9À-ž]+\\S?)+/gu;\n }\n}\n\nexport { WordCount };\n//# sourceMappingURL=index.js.map\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module word-count/utils\n */\n\nimport type { Element, Item } from 'ckeditor5/src/engine.js';\n\n/**\n * Returns a plain text representation of an element and its children.\n *\n * @returns Plain text representing the model's data.\n */\nexport function modelElementToPlainText( item: Item ): string {\n\tif ( item.is( '$text' ) || item.is( '$textProxy' ) ) {\n\t\treturn item.data;\n\t}\n\n\tconst element = item as Element;\n\tlet text = '';\n\tlet prev = null;\n\n\tfor ( const child of element.getChildren() ) {\n\t\tconst childText = modelElementToPlainText( child );\n\n\t\t// If last block was finish, start from new line.\n\t\tif ( prev && prev.is( 'element' ) ) {\n\t\t\ttext += '\\n';\n\t\t}\n\n\t\ttext += childText;\n\n\t\tprev = child;\n\t}\n\n\treturn text;\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module word-count/wordcount\n */\n\nimport { type DocumentChangeEvent } from 'ckeditor5/src/engine.js';\nimport { Plugin, type Editor } from 'ckeditor5/src/core.js';\nimport { Template, View } from 'ckeditor5/src/ui.js';\nimport { env } from 'ckeditor5/src/utils.js';\n\nimport { modelElementToPlainText } from './utils.js';\nimport type { WordCountConfig } from './wordcountconfig.js';\n\nimport { throttle, isElement } from 'lodash-es';\n\n/**\n * The word count plugin.\n *\n * This plugin calculates all words and characters in all {@link module:engine/model/text~Text text nodes} available in the model.\n * It also provides an HTML element that updates its state whenever the editor content is changed.\n *\n * The model's data is first converted to plain text using {@link module:word-count/utils~modelElementToPlainText}.\n * The number of words and characters in your text are determined based on the created plain text. Please keep in mind\n * that every block in the editor is separated with a newline character, which is included in the calculation.\n *\n * Here are some examples of how the word and character calculations are made:\n *\n * ```html\n * <paragraph>foo</paragraph>\n * <paragraph>bar</paragraph>\n * // Words: 2, Characters: 7\n *\n * <paragraph><$text bold=\"true\">foo</$text>bar</paragraph>\n * // Words: 1, Characters: 6\n *\n * <paragraph>*&^%)</paragraph>\n * // Words: 0, Characters: 5\n *\n * <paragraph>foo(bar)</paragraph>\n * //Words: 1, Characters: 8\n *\n * <paragraph>12345</paragraph>\n * // Words: 1, Characters: 5\n * ```\n */\nexport default class WordCount extends Plugin {\n\t/**\n\t * The number of characters in the editor.\n\t *\n\t * @observable\n\t * @readonly\n\t */\n\tdeclare public characters: number;\n\n\t/**\n\t * The number of words in the editor.\n\t *\n\t * @observable\n\t * @readonly\n\t */\n\tdeclare public words: number;\n\n\t/**\n\t * The label used to display the words value in the {@link #wordCountContainer output container}.\n\t *\n\t * @observable\n\t * @private\n\t * @readonly\n\t */\n\tdeclare public _wordsLabel: string | undefined;\n\n\t/**\n\t * The label used to display the characters value in the {@link #wordCountContainer output container}.\n\t *\n\t * @observable\n\t * @private\n\t * @readonly\n\t */\n\tdeclare public _charactersLabel: string | undefined;\n\n\t/**\n\t * The configuration of this plugin.\n\t */\n\tprivate _config: WordCountConfig;\n\n\t/**\n\t * The reference to a {@link module:ui/view~View view object} that contains the self-updating HTML container.\n\t */\n\tprivate _outputView: View | undefined;\n\n\t/**\n\t * A regular expression used to recognize words in the editor's content.\n\t */\n\tprivate readonly _wordsMatchRegExp: RegExp;\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor: Editor ) {\n\t\tsuper( editor );\n\n\t\tthis.set( 'characters', 0 );\n\t\tthis.set( 'words', 0 );\n\n\t\t// Don't wait for the #update event to set the value of the properties but obtain it right away.\n\t\t// This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.\n\t\t// If not accessed directly, the properties will be refreshed upon #update anyway.\n\t\tObject.defineProperties( this, {\n\t\t\tcharacters: {\n\t\t\t\tget() {\n\t\t\t\t\treturn ( this.characters = this._getCharacters( this._getText() ) );\n\t\t\t\t}\n\t\t\t},\n\t\t\twords: {\n\t\t\t\tget() {\n\t\t\t\t\treturn ( this.words = this._getWords( this._getText() ) );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\tthis.set( '_wordsLabel', undefined );\n\t\tthis.set( '_charactersLabel', undefined );\n\n\t\tthis._config = editor.config.get( 'wordCount' ) || {};\n\n\t\tthis._outputView = undefined;\n\n\t\tthis._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ?\n\t\t\t// Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n\t\t\t// Groups:\n\t\t\t// {L} - Any kind of letter from any language.\n\t\t\t// {N} - Any kind of numeric character in any script.\n\t\t\tnew RegExp( '([\\\\p{L}\\\\p{N}]+\\\\S?)+', 'gu' ) :\n\t\t\t/([a-zA-Z0-9À-ž]+\\S?)+/gu;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'WordCount' as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic init(): void {\n\t\tconst editor = this.editor;\n\n\t\teditor.model.document.on<DocumentChangeEvent>( 'change:data', throttle( this._refreshStats.bind( this ), 250 ) );\n\n\t\tif ( typeof this._config.onUpdate == 'function' ) {\n\t\t\tthis.on<WordCountUpdateEvent>( 'update', ( evt, data ) => {\n\t\t\t\tthis._config.onUpdate!( data );\n\t\t\t} );\n\t\t}\n\n\t\tif ( isElement( this._config.container ) ) {\n\t\t\tthis._config.container!.appendChild( this.wordCountContainer );\n\t\t}\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic override destroy(): void {\n\t\tif ( this._outputView ) {\n\t\t\tthis._outputView.element!.remove();\n\t\t\tthis._outputView.destroy();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n\n\t/**\n\t * Creates a self-updating HTML element. Repeated executions return the same element.\n\t * The returned element has the following HTML structure:\n\t *\n\t * ```html\n\t * <div class=\"ck ck-word-count\">\n\t * \t<div class=\"ck-word-count__words\">Words: 4</div>\n\t * \t<div class=\"ck-word-count__characters\">Characters: 28</div>\n\t * </div>\n\t * ```\n\t */\n\tpublic get wordCountContainer(): HTMLElement {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst displayWords = editor.config.get( 'wordCount.displayWords' );\n\t\tconst displayCharacters = editor.config.get( 'wordCount.displayCharacters' );\n\t\tconst bind = Template.bind( this, this );\n\t\tconst children = [];\n\n\t\tif ( !this._outputView ) {\n\t\t\tthis._outputView = new View();\n\n\t\t\tif ( displayWords || displayWords === undefined ) {\n\t\t\t\tthis.bind( '_wordsLabel' ).to( this, 'words', words => {\n\t\t\t\t\treturn t( 'Words: %0', words );\n\t\t\t\t} );\n\n\t\t\t\tchildren.push( {\n\t\t\t\t\ttag: 'div',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: [ bind.to( '_wordsLabel' ) ]\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tclass: 'ck-word-count__words'\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( displayCharacters || displayCharacters === undefined ) {\n\t\t\t\tthis.bind( '_charactersLabel' ).to( this, 'characters', words => {\n\t\t\t\t\treturn t( 'Characters: %0', words );\n\t\t\t\t} );\n\n\t\t\t\tchildren.push( {\n\t\t\t\t\ttag: 'div',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: [ bind.to( '_charactersLabel' ) ]\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tclass: 'ck-word-count__characters'\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tthis._outputView.setTemplate( {\n\t\t\t\ttag: 'div',\n\t\t\t\tattributes: {\n\t\t\t\t\tclass: [\n\t\t\t\t\t\t'ck',\n\t\t\t\t\t\t'ck-word-count'\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\tchildren\n\t\t\t} );\n\n\t\t\tthis._outputView.render();\n\t\t}\n\n\t\treturn this._outputView.element!;\n\t}\n\n\tprivate _getText(): string {\n\t\tlet txt = '';\n\n\t\tfor ( const root of this.editor.model.document.getRoots() ) {\n\t\t\tif ( txt !== '' ) {\n\t\t\t\t// Add a delimiter, so words from each root are treated independently.\n\t\t\t\ttxt += '\\n';\n\t\t\t}\n\n\t\t\ttxt += modelElementToPlainText( root );\n\t\t}\n\n\t\treturn txt;\n\t}\n\n\t/**\n\t * Determines the number of characters in the current editor's model.\n\t */\n\tprivate _getCharacters( txt: string ): number {\n\t\treturn txt.replace( /\\n/g, '' ).length;\n\t}\n\n\t/**\n\t * Determines the number of words in the current editor's model.\n\t */\n\tprivate _getWords( txt: string ): number {\n\t\tconst detectedWords = txt.match( this._wordsMatchRegExp ) || [];\n\n\t\treturn detectedWords.length;\n\t}\n\n\t/**\n\t * Determines the number of words and characters in the current editor's model and assigns it to {@link #characters} and {@link #words}.\n\t * It also fires the {@link #event:update}.\n\t *\n\t * @fires update\n\t */\n\tprivate _refreshStats(): void {\n\t\tconst txt = this._getText();\n\t\tconst words = this.words = this._getWords( txt );\n\t\tconst characters = this.characters = this._getCharacters( txt );\n\n\t\tthis.fire<WordCountUpdateEvent>( 'update', {\n\t\t\twords,\n\t\t\tcharacters\n\t\t} );\n\t}\n}\n\n/**\n * An event fired after {@link ~WordCount#words} and {@link ~WordCount#characters} are updated.\n *\n * @eventName ~WordCount#update\n */\nexport type WordCountUpdateEvent = {\n\tname: 'update';\n\targs: [ { words: number; characters: number } ];\n};\n"]}
|
1
|
+
{"version":3,"sources":["index.js","../src/utils.ts","../src/wordcount.ts"],"names":["modelElementToPlainText","item","is","data","element","text","prev","child","getChildren","childText","WordCount","Plugin","constructor","editor","set","Object","defineProperties","characters","get","_getCharacters","_getText","words","_getWords","undefined","_config","config","_outputView","_wordsMatchRegExp","env","features","isRegExpUnicodePropertySupported","RegExp","pluginName","model","document","on","throttle","_refreshStats","bind","onUpdate","evt","isElement","container","appendChild","wordCountContainer","remove","destroy","t","displayWords","displayCharacters","Template","children","View","to","push","tag","attributes","class","setTemplate","render","txt","root","getRoots","replace","length","detectedWords","match","fire"],"mappings":";;;;AAAA,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACtE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC9D,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChD;ACJA,CAAA,CAAA,CAAA;ADMA,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC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;AACD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACD,CAAA,CAAA,CAAA,CAAA,CAAA;AACD,CAAA;AF/DA;AACA,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG","file":"index.js.map","sourcesContent":["import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';\nimport { Template, View } from '@ckeditor/ckeditor5-ui/dist/index.js';\nimport { env } from '@ckeditor/ckeditor5-utils/dist/index.js';\nimport { throttle, isElement } from 'lodash-es';\n\n/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */ /**\n * @module word-count/utils\n */ /**\n * Returns a plain text representation of an element and its children.\n *\n * @returns Plain text representing the model's data.\n */ function modelElementToPlainText(item) {\n if (item.is('$text') || item.is('$textProxy')) {\n return item.data;\n }\n const element = item;\n let text = '';\n let prev = null;\n for (const child of element.getChildren()){\n const childText = modelElementToPlainText(child);\n // If last block was finish, start from new line.\n if (prev && prev.is('element')) {\n text += '\\n';\n }\n text += childText;\n prev = child;\n }\n return text;\n}\n\n/**\n * The word count plugin.\n *\n * This plugin calculates all words and characters in all {@link module:engine/model/text~Text text nodes} available in the model.\n * It also provides an HTML element that updates its state whenever the editor content is changed.\n *\n * The model's data is first converted to plain text using {@link module:word-count/utils~modelElementToPlainText}.\n * The number of words and characters in your text are determined based on the created plain text. Please keep in mind\n * that every block in the editor is separated with a newline character, which is included in the calculation.\n *\n * Here are some examples of how the word and character calculations are made:\n *\n * ```html\n * <paragraph>foo</paragraph>\n * <paragraph>bar</paragraph>\n * // Words: 2, Characters: 7\n *\n * <paragraph><$text bold=\"true\">foo</$text>bar</paragraph>\n * // Words: 1, Characters: 6\n *\n * <paragraph>*&^%)</paragraph>\n * // Words: 0, Characters: 5\n *\n * <paragraph>foo(bar)</paragraph>\n * //Words: 1, Characters: 8\n *\n * <paragraph>12345</paragraph>\n * // Words: 1, Characters: 5\n * ```\n */ class WordCount extends Plugin {\n /**\n\t * The configuration of this plugin.\n\t */ _config;\n /**\n\t * The reference to a {@link module:ui/view~View view object} that contains the self-updating HTML container.\n\t */ _outputView;\n /**\n\t * A regular expression used to recognize words in the editor's content.\n\t */ _wordsMatchRegExp;\n /**\n\t * @inheritDoc\n\t */ constructor(editor){\n super(editor);\n this.set('characters', 0);\n this.set('words', 0);\n // Don't wait for the #update event to set the value of the properties but obtain it right away.\n // This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.\n // If not accessed directly, the properties will be refreshed upon #update anyway.\n Object.defineProperties(this, {\n characters: {\n get () {\n return this.characters = this._getCharacters(this._getText());\n }\n },\n words: {\n get () {\n return this.words = this._getWords(this._getText());\n }\n }\n });\n this.set('_wordsLabel', undefined);\n this.set('_charactersLabel', undefined);\n this._config = editor.config.get('wordCount') || {};\n this._outputView = undefined;\n this._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ? // Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n // Groups:\n // {L} - Any kind of letter from any language.\n // {N} - Any kind of numeric character in any script.\n new RegExp('([\\\\p{L}\\\\p{N}]+\\\\S?)+', 'gu') : /([a-zA-Z0-9À-ž]+\\S?)+/gu;\n }\n /**\n\t * @inheritDoc\n\t */ static get pluginName() {\n return 'WordCount';\n }\n /**\n\t * @inheritDoc\n\t */ init() {\n const editor = this.editor;\n editor.model.document.on('change:data', throttle(this._refreshStats.bind(this), 250));\n if (typeof this._config.onUpdate == 'function') {\n this.on('update', (evt, data)=>{\n this._config.onUpdate(data);\n });\n }\n if (isElement(this._config.container)) {\n this._config.container.appendChild(this.wordCountContainer);\n }\n }\n /**\n\t * @inheritDoc\n\t */ destroy() {\n if (this._outputView) {\n this._outputView.element.remove();\n this._outputView.destroy();\n }\n super.destroy();\n }\n /**\n\t * Creates a self-updating HTML element. Repeated executions return the same element.\n\t * The returned element has the following HTML structure:\n\t *\n\t * ```html\n\t * <div class=\"ck ck-word-count\">\n\t * \t<div class=\"ck-word-count__words\">Words: 4</div>\n\t * \t<div class=\"ck-word-count__characters\">Characters: 28</div>\n\t * </div>\n\t * ```\n\t */ get wordCountContainer() {\n const editor = this.editor;\n const t = editor.t;\n const displayWords = editor.config.get('wordCount.displayWords');\n const displayCharacters = editor.config.get('wordCount.displayCharacters');\n const bind = Template.bind(this, this);\n const children = [];\n if (!this._outputView) {\n this._outputView = new View();\n if (displayWords || displayWords === undefined) {\n this.bind('_wordsLabel').to(this, 'words', (words)=>{\n return t('Words: %0', words);\n });\n children.push({\n tag: 'div',\n children: [\n {\n text: [\n bind.to('_wordsLabel')\n ]\n }\n ],\n attributes: {\n class: 'ck-word-count__words'\n }\n });\n }\n if (displayCharacters || displayCharacters === undefined) {\n this.bind('_charactersLabel').to(this, 'characters', (words)=>{\n return t('Characters: %0', words);\n });\n children.push({\n tag: 'div',\n children: [\n {\n text: [\n bind.to('_charactersLabel')\n ]\n }\n ],\n attributes: {\n class: 'ck-word-count__characters'\n }\n });\n }\n this._outputView.setTemplate({\n tag: 'div',\n attributes: {\n class: [\n 'ck',\n 'ck-word-count'\n ]\n },\n children\n });\n this._outputView.render();\n }\n return this._outputView.element;\n }\n _getText() {\n let txt = '';\n for (const root of this.editor.model.document.getRoots()){\n if (txt !== '') {\n // Add a delimiter, so words from each root are treated independently.\n txt += '\\n';\n }\n txt += modelElementToPlainText(root);\n }\n return txt;\n }\n /**\n\t * Determines the number of characters in the current editor's model.\n\t */ _getCharacters(txt) {\n return txt.replace(/\\n/g, '').length;\n }\n /**\n\t * Determines the number of words in the current editor's model.\n\t */ _getWords(txt) {\n const detectedWords = txt.match(this._wordsMatchRegExp) || [];\n return detectedWords.length;\n }\n /**\n\t * Determines the number of words and characters in the current editor's model and assigns it to {@link #characters} and {@link #words}.\n\t * It also fires the {@link #event:update}.\n\t *\n\t * @fires update\n\t */ _refreshStats() {\n const txt = this._getText();\n const words = this.words = this._getWords(txt);\n const characters = this.characters = this._getCharacters(txt);\n this.fire('update', {\n words,\n characters\n });\n }\n}\n\nexport { WordCount };\n//# sourceMappingURL=index.js.map\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module word-count/utils\n */\n\nimport type { Element, Item } from 'ckeditor5/src/engine.js';\n\n/**\n * Returns a plain text representation of an element and its children.\n *\n * @returns Plain text representing the model's data.\n */\nexport function modelElementToPlainText( item: Item ): string {\n\tif ( item.is( '$text' ) || item.is( '$textProxy' ) ) {\n\t\treturn item.data;\n\t}\n\n\tconst element = item as Element;\n\tlet text = '';\n\tlet prev = null;\n\n\tfor ( const child of element.getChildren() ) {\n\t\tconst childText = modelElementToPlainText( child );\n\n\t\t// If last block was finish, start from new line.\n\t\tif ( prev && prev.is( 'element' ) ) {\n\t\t\ttext += '\\n';\n\t\t}\n\n\t\ttext += childText;\n\n\t\tprev = child;\n\t}\n\n\treturn text;\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module word-count/wordcount\n */\n\nimport { type DocumentChangeEvent } from 'ckeditor5/src/engine.js';\nimport { Plugin, type Editor } from 'ckeditor5/src/core.js';\nimport { Template, View } from 'ckeditor5/src/ui.js';\nimport { env } from 'ckeditor5/src/utils.js';\n\nimport { modelElementToPlainText } from './utils.js';\nimport type { WordCountConfig } from './wordcountconfig.js';\n\nimport { throttle, isElement } from 'lodash-es';\n\n/**\n * The word count plugin.\n *\n * This plugin calculates all words and characters in all {@link module:engine/model/text~Text text nodes} available in the model.\n * It also provides an HTML element that updates its state whenever the editor content is changed.\n *\n * The model's data is first converted to plain text using {@link module:word-count/utils~modelElementToPlainText}.\n * The number of words and characters in your text are determined based on the created plain text. Please keep in mind\n * that every block in the editor is separated with a newline character, which is included in the calculation.\n *\n * Here are some examples of how the word and character calculations are made:\n *\n * ```html\n * <paragraph>foo</paragraph>\n * <paragraph>bar</paragraph>\n * // Words: 2, Characters: 7\n *\n * <paragraph><$text bold=\"true\">foo</$text>bar</paragraph>\n * // Words: 1, Characters: 6\n *\n * <paragraph>*&^%)</paragraph>\n * // Words: 0, Characters: 5\n *\n * <paragraph>foo(bar)</paragraph>\n * //Words: 1, Characters: 8\n *\n * <paragraph>12345</paragraph>\n * // Words: 1, Characters: 5\n * ```\n */\nexport default class WordCount extends Plugin {\n\t/**\n\t * The number of characters in the editor.\n\t *\n\t * @observable\n\t * @readonly\n\t */\n\tdeclare public characters: number;\n\n\t/**\n\t * The number of words in the editor.\n\t *\n\t * @observable\n\t * @readonly\n\t */\n\tdeclare public words: number;\n\n\t/**\n\t * The label used to display the words value in the {@link #wordCountContainer output container}.\n\t *\n\t * @observable\n\t * @private\n\t * @readonly\n\t */\n\tdeclare public _wordsLabel: string | undefined;\n\n\t/**\n\t * The label used to display the characters value in the {@link #wordCountContainer output container}.\n\t *\n\t * @observable\n\t * @private\n\t * @readonly\n\t */\n\tdeclare public _charactersLabel: string | undefined;\n\n\t/**\n\t * The configuration of this plugin.\n\t */\n\tprivate _config: WordCountConfig;\n\n\t/**\n\t * The reference to a {@link module:ui/view~View view object} that contains the self-updating HTML container.\n\t */\n\tprivate _outputView: View | undefined;\n\n\t/**\n\t * A regular expression used to recognize words in the editor's content.\n\t */\n\tprivate readonly _wordsMatchRegExp: RegExp;\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor: Editor ) {\n\t\tsuper( editor );\n\n\t\tthis.set( 'characters', 0 );\n\t\tthis.set( 'words', 0 );\n\n\t\t// Don't wait for the #update event to set the value of the properties but obtain it right away.\n\t\t// This way, accessing the properties directly returns precise numbers, e.g. for validation, etc.\n\t\t// If not accessed directly, the properties will be refreshed upon #update anyway.\n\t\tObject.defineProperties( this, {\n\t\t\tcharacters: {\n\t\t\t\tget() {\n\t\t\t\t\treturn ( this.characters = this._getCharacters( this._getText() ) );\n\t\t\t\t}\n\t\t\t},\n\t\t\twords: {\n\t\t\t\tget() {\n\t\t\t\t\treturn ( this.words = this._getWords( this._getText() ) );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\tthis.set( '_wordsLabel', undefined );\n\t\tthis.set( '_charactersLabel', undefined );\n\n\t\tthis._config = editor.config.get( 'wordCount' ) || {};\n\n\t\tthis._outputView = undefined;\n\n\t\tthis._wordsMatchRegExp = env.features.isRegExpUnicodePropertySupported ?\n\t\t\t// Usage of regular expression literal cause error during build (ckeditor/ckeditor5-dev#534).\n\t\t\t// Groups:\n\t\t\t// {L} - Any kind of letter from any language.\n\t\t\t// {N} - Any kind of numeric character in any script.\n\t\t\tnew RegExp( '([\\\\p{L}\\\\p{N}]+\\\\S?)+', 'gu' ) :\n\t\t\t/([a-zA-Z0-9À-ž]+\\S?)+/gu;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'WordCount' as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic init(): void {\n\t\tconst editor = this.editor;\n\n\t\teditor.model.document.on<DocumentChangeEvent>( 'change:data', throttle( this._refreshStats.bind( this ), 250 ) );\n\n\t\tif ( typeof this._config.onUpdate == 'function' ) {\n\t\t\tthis.on<WordCountUpdateEvent>( 'update', ( evt, data ) => {\n\t\t\t\tthis._config.onUpdate!( data );\n\t\t\t} );\n\t\t}\n\n\t\tif ( isElement( this._config.container ) ) {\n\t\t\tthis._config.container!.appendChild( this.wordCountContainer );\n\t\t}\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic override destroy(): void {\n\t\tif ( this._outputView ) {\n\t\t\tthis._outputView.element!.remove();\n\t\t\tthis._outputView.destroy();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n\n\t/**\n\t * Creates a self-updating HTML element. Repeated executions return the same element.\n\t * The returned element has the following HTML structure:\n\t *\n\t * ```html\n\t * <div class=\"ck ck-word-count\">\n\t * \t<div class=\"ck-word-count__words\">Words: 4</div>\n\t * \t<div class=\"ck-word-count__characters\">Characters: 28</div>\n\t * </div>\n\t * ```\n\t */\n\tpublic get wordCountContainer(): HTMLElement {\n\t\tconst editor = this.editor;\n\t\tconst t = editor.t;\n\t\tconst displayWords = editor.config.get( 'wordCount.displayWords' );\n\t\tconst displayCharacters = editor.config.get( 'wordCount.displayCharacters' );\n\t\tconst bind = Template.bind( this, this );\n\t\tconst children = [];\n\n\t\tif ( !this._outputView ) {\n\t\t\tthis._outputView = new View();\n\n\t\t\tif ( displayWords || displayWords === undefined ) {\n\t\t\t\tthis.bind( '_wordsLabel' ).to( this, 'words', words => {\n\t\t\t\t\treturn t( 'Words: %0', words );\n\t\t\t\t} );\n\n\t\t\t\tchildren.push( {\n\t\t\t\t\ttag: 'div',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: [ bind.to( '_wordsLabel' ) ]\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tclass: 'ck-word-count__words'\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( displayCharacters || displayCharacters === undefined ) {\n\t\t\t\tthis.bind( '_charactersLabel' ).to( this, 'characters', words => {\n\t\t\t\t\treturn t( 'Characters: %0', words );\n\t\t\t\t} );\n\n\t\t\t\tchildren.push( {\n\t\t\t\t\ttag: 'div',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: [ bind.to( '_charactersLabel' ) ]\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tclass: 'ck-word-count__characters'\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tthis._outputView.setTemplate( {\n\t\t\t\ttag: 'div',\n\t\t\t\tattributes: {\n\t\t\t\t\tclass: [\n\t\t\t\t\t\t'ck',\n\t\t\t\t\t\t'ck-word-count'\n\t\t\t\t\t]\n\t\t\t\t},\n\t\t\t\tchildren\n\t\t\t} );\n\n\t\t\tthis._outputView.render();\n\t\t}\n\n\t\treturn this._outputView.element!;\n\t}\n\n\tprivate _getText(): string {\n\t\tlet txt = '';\n\n\t\tfor ( const root of this.editor.model.document.getRoots() ) {\n\t\t\tif ( txt !== '' ) {\n\t\t\t\t// Add a delimiter, so words from each root are treated independently.\n\t\t\t\ttxt += '\\n';\n\t\t\t}\n\n\t\t\ttxt += modelElementToPlainText( root );\n\t\t}\n\n\t\treturn txt;\n\t}\n\n\t/**\n\t * Determines the number of characters in the current editor's model.\n\t */\n\tprivate _getCharacters( txt: string ): number {\n\t\treturn txt.replace( /\\n/g, '' ).length;\n\t}\n\n\t/**\n\t * Determines the number of words in the current editor's model.\n\t */\n\tprivate _getWords( txt: string ): number {\n\t\tconst detectedWords = txt.match( this._wordsMatchRegExp ) || [];\n\n\t\treturn detectedWords.length;\n\t}\n\n\t/**\n\t * Determines the number of words and characters in the current editor's model and assigns it to {@link #characters} and {@link #words}.\n\t * It also fires the {@link #event:update}.\n\t *\n\t * @fires update\n\t */\n\tprivate _refreshStats(): void {\n\t\tconst txt = this._getText();\n\t\tconst words = this.words = this._getWords( txt );\n\t\tconst characters = this.characters = this._getCharacters( txt );\n\n\t\tthis.fire<WordCountUpdateEvent>( 'update', {\n\t\t\twords,\n\t\t\tcharacters\n\t\t} );\n\t}\n}\n\n/**\n * An event fired after {@link ~WordCount#words} and {@link ~WordCount#characters} are updated.\n *\n * @eventName ~WordCount#update\n */\nexport type WordCountUpdateEvent = {\n\tname: 'update';\n\targs: [ { words: number; characters: number } ];\n};\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-word-count",
|
3
|
-
"version": "
|
3
|
+
"version": "42.0.0-alpha.1",
|
4
4
|
"description": "Word and character count feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
16
|
"lodash-es": "4.17.21",
|
17
|
-
"ckeditor5": "
|
17
|
+
"ckeditor5": "42.0.0-alpha.1"
|
18
18
|
},
|
19
19
|
"author": "CKSource (http://cksource.com/)",
|
20
20
|
"license": "GPL-2.0-or-later",
|