@ckeditor/ckeditor5-word-count 37.0.0-alpha.0 → 37.0.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +17 -17
- package/src/augmentation.d.ts +19 -0
- package/src/augmentation.js +5 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +1 -0
- package/src/wordcount.d.ts +2 -101
- package/src/wordcountconfig.d.ts +92 -0
- package/src/wordcountconfig.js +5 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-word-count",
|
3
|
-
"version": "37.0.0-alpha.
|
3
|
+
"version": "37.0.0-alpha.2",
|
4
4
|
"description": "Word and character count feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,23 +13,23 @@
|
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
15
|
"lodash-es": "^4.17.15",
|
16
|
-
"ckeditor5": "^37.0.0-alpha.
|
16
|
+
"ckeditor5": "^37.0.0-alpha.2"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
|
-
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.
|
20
|
-
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.
|
21
|
-
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.
|
22
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
23
|
-
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.
|
24
|
-
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.
|
25
|
-
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.
|
26
|
-
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.
|
27
|
-
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.
|
28
|
-
"@ckeditor/ckeditor5-list": "^37.0.0-alpha.
|
29
|
-
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.
|
30
|
-
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.
|
31
|
-
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.
|
32
|
-
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.
|
19
|
+
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.2",
|
20
|
+
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.2",
|
21
|
+
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.2",
|
22
|
+
"@ckeditor/ckeditor5-dev-utils": "^35.0.0",
|
23
|
+
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.2",
|
24
|
+
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.2",
|
25
|
+
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.2",
|
26
|
+
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.2",
|
27
|
+
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.2",
|
28
|
+
"@ckeditor/ckeditor5-list": "^37.0.0-alpha.2",
|
29
|
+
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.2",
|
30
|
+
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.2",
|
31
|
+
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.2",
|
32
|
+
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.2",
|
33
33
|
"typescript": "^4.8.4",
|
34
34
|
"webpack": "^5.58.1",
|
35
35
|
"webpack-cli": "^4.9.0"
|
@@ -58,7 +58,7 @@
|
|
58
58
|
],
|
59
59
|
"scripts": {
|
60
60
|
"dll:build": "webpack",
|
61
|
-
"build": "tsc -p ./tsconfig.
|
61
|
+
"build": "tsc -p ./tsconfig.json",
|
62
62
|
"postversion": "npm run build"
|
63
63
|
},
|
64
64
|
"types": "src/index.d.ts"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { WordCount, WordCountConfig } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface EditorConfig {
|
8
|
+
/**
|
9
|
+
* The configuration of the word count feature.
|
10
|
+
* It is introduced by the {@link module:word-count/wordcount~WordCount} feature.
|
11
|
+
*
|
12
|
+
* Read more in {@link module:word-count/wordcountconfig~WordCountConfig}.
|
13
|
+
*/
|
14
|
+
wordCount?: WordCountConfig;
|
15
|
+
}
|
16
|
+
interface PluginsMap {
|
17
|
+
[WordCount.pluginName]: WordCount;
|
18
|
+
}
|
19
|
+
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/wordcount.d.ts
CHANGED
@@ -121,9 +121,9 @@ export default class WordCount extends Plugin {
|
|
121
121
|
private _refreshStats;
|
122
122
|
}
|
123
123
|
/**
|
124
|
-
* An event fired after {@link #words} and {@link #characters} are updated.
|
124
|
+
* An event fired after {@link ~WordCount#words} and {@link ~WordCount#characters} are updated.
|
125
125
|
*
|
126
|
-
* @eventName update
|
126
|
+
* @eventName ~WordCount#update
|
127
127
|
*/
|
128
128
|
export type WordCountUpdateEvent = {
|
129
129
|
name: 'update';
|
@@ -132,102 +132,3 @@ export type WordCountUpdateEvent = {
|
|
132
132
|
characters: number;
|
133
133
|
}];
|
134
134
|
};
|
135
|
-
/**
|
136
|
-
* The configuration of the word count feature.
|
137
|
-
*
|
138
|
-
* ```ts
|
139
|
-
* ClassicEditor
|
140
|
-
* .create( {
|
141
|
-
* wordCount: ... // Word count feature configuration.
|
142
|
-
* } )
|
143
|
-
* .then( ... )
|
144
|
-
* .catch( ... );
|
145
|
-
* ```
|
146
|
-
*
|
147
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
148
|
-
*/
|
149
|
-
export interface WordCountConfig {
|
150
|
-
/**
|
151
|
-
* This option allows for hiding the word counter. The element obtained through
|
152
|
-
* {@link module:word-count/wordcount~WordCount#wordCountContainer} will only preserve
|
153
|
-
* the characters part. Word counter is displayed by default when this configuration option is not defined.
|
154
|
-
*
|
155
|
-
* ```ts
|
156
|
-
* const wordCountConfig = {
|
157
|
-
* displayWords: false
|
158
|
-
* };
|
159
|
-
* ```
|
160
|
-
*
|
161
|
-
* The configuration above will result in the following container:
|
162
|
-
*
|
163
|
-
* ```html
|
164
|
-
* <div class="ck ck-word-count">
|
165
|
-
* <div class="ck-word-count__characters">Characters: 28</div>
|
166
|
-
* </div>
|
167
|
-
* ```
|
168
|
-
*/
|
169
|
-
displayWords?: boolean;
|
170
|
-
/**
|
171
|
-
* This option allows for hiding the character counter. The element obtained through
|
172
|
-
* {@link module:word-count/wordcount~WordCount#wordCountContainer} will only preserve
|
173
|
-
* the words part. Character counter is displayed by default when this configuration option is not defined.
|
174
|
-
*
|
175
|
-
* ```ts
|
176
|
-
* const wordCountConfig = {
|
177
|
-
* displayCharacters: false
|
178
|
-
* };
|
179
|
-
* ```
|
180
|
-
*
|
181
|
-
* The configuration above will result in the following container:
|
182
|
-
*
|
183
|
-
* ```html
|
184
|
-
* <div class="ck ck-word-count">
|
185
|
-
* <div class="ck-word-count__words">Words: 4</div>
|
186
|
-
* </div>
|
187
|
-
* ```
|
188
|
-
*/
|
189
|
-
displayCharacters?: boolean;
|
190
|
-
/**
|
191
|
-
* This configuration takes a function that is executed whenever the word count plugin updates its values.
|
192
|
-
* This function is called with one argument, which is an object with the `words` and `characters` keys containing
|
193
|
-
* the number of detected words and characters in the document.
|
194
|
-
*
|
195
|
-
* ```ts
|
196
|
-
* const wordCountConfig = {
|
197
|
-
* onUpdate: function( stats ) {
|
198
|
-
* doSthWithWordNumber( stats.words );
|
199
|
-
* doSthWithCharacterNumber( stats.characters );
|
200
|
-
* }
|
201
|
-
* };
|
202
|
-
* ```
|
203
|
-
*/
|
204
|
-
onUpdate?: (data: {
|
205
|
-
words: number;
|
206
|
-
characters: number;
|
207
|
-
}) => void;
|
208
|
-
/**
|
209
|
-
* Allows for providing the HTML element that the
|
210
|
-
* {@link module:word-count/wordcount~WordCount#wordCountContainer word count container} will be appended to automatically.
|
211
|
-
*
|
212
|
-
* ```ts
|
213
|
-
* const wordCountConfig = {
|
214
|
-
* container: document.getElementById( 'container-for-word-count' );
|
215
|
-
* };
|
216
|
-
* ```
|
217
|
-
*/
|
218
|
-
container?: HTMLElement;
|
219
|
-
}
|
220
|
-
declare module '@ckeditor/ckeditor5-core' {
|
221
|
-
interface PluginsMap {
|
222
|
-
[WordCount.pluginName]: WordCount;
|
223
|
-
}
|
224
|
-
interface EditorConfig {
|
225
|
-
/**
|
226
|
-
* The configuration of the word count feature.
|
227
|
-
* It is introduced by the {@link module:word-count/wordcount~WordCount} feature.
|
228
|
-
*
|
229
|
-
* Read more in {@link module:word-count/wordcount~WordCountConfig}.
|
230
|
-
*/
|
231
|
-
wordCount?: WordCountConfig;
|
232
|
-
}
|
233
|
-
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module word-count/wordcountconfig
|
7
|
+
*/
|
8
|
+
/**
|
9
|
+
* The configuration of the word count feature.
|
10
|
+
*
|
11
|
+
* ```ts
|
12
|
+
* ClassicEditor
|
13
|
+
* .create( {
|
14
|
+
* wordCount: ... // Word count feature configuration.
|
15
|
+
* } )
|
16
|
+
* .then( ... )
|
17
|
+
* .catch( ... );
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
21
|
+
*/
|
22
|
+
export interface WordCountConfig {
|
23
|
+
/**
|
24
|
+
* This option allows for hiding the word counter. The element obtained through
|
25
|
+
* {@link module:word-count/wordcount~WordCount#wordCountContainer} will only preserve
|
26
|
+
* the characters part. Word counter is displayed by default when this configuration option is not defined.
|
27
|
+
*
|
28
|
+
* ```ts
|
29
|
+
* const wordCountConfig = {
|
30
|
+
* displayWords: false
|
31
|
+
* };
|
32
|
+
* ```
|
33
|
+
*
|
34
|
+
* The configuration above will result in the following container:
|
35
|
+
*
|
36
|
+
* ```html
|
37
|
+
* <div class="ck ck-word-count">
|
38
|
+
* <div class="ck-word-count__characters">Characters: 28</div>
|
39
|
+
* </div>
|
40
|
+
* ```
|
41
|
+
*/
|
42
|
+
displayWords?: boolean;
|
43
|
+
/**
|
44
|
+
* This option allows for hiding the character counter. The element obtained through
|
45
|
+
* {@link module:word-count/wordcount~WordCount#wordCountContainer} will only preserve
|
46
|
+
* the words part. Character counter is displayed by default when this configuration option is not defined.
|
47
|
+
*
|
48
|
+
* ```ts
|
49
|
+
* const wordCountConfig = {
|
50
|
+
* displayCharacters: false
|
51
|
+
* };
|
52
|
+
* ```
|
53
|
+
*
|
54
|
+
* The configuration above will result in the following container:
|
55
|
+
*
|
56
|
+
* ```html
|
57
|
+
* <div class="ck ck-word-count">
|
58
|
+
* <div class="ck-word-count__words">Words: 4</div>
|
59
|
+
* </div>
|
60
|
+
* ```
|
61
|
+
*/
|
62
|
+
displayCharacters?: boolean;
|
63
|
+
/**
|
64
|
+
* This configuration takes a function that is executed whenever the word count plugin updates its values.
|
65
|
+
* This function is called with one argument, which is an object with the `words` and `characters` keys containing
|
66
|
+
* the number of detected words and characters in the document.
|
67
|
+
*
|
68
|
+
* ```ts
|
69
|
+
* const wordCountConfig = {
|
70
|
+
* onUpdate: function( stats ) {
|
71
|
+
* doSthWithWordNumber( stats.words );
|
72
|
+
* doSthWithCharacterNumber( stats.characters );
|
73
|
+
* }
|
74
|
+
* };
|
75
|
+
* ```
|
76
|
+
*/
|
77
|
+
onUpdate?: (data: {
|
78
|
+
words: number;
|
79
|
+
characters: number;
|
80
|
+
}) => void;
|
81
|
+
/**
|
82
|
+
* Allows for providing the HTML element that the
|
83
|
+
* {@link module:word-count/wordcount~WordCount#wordCountContainer word count container} will be appended to automatically.
|
84
|
+
*
|
85
|
+
* ```ts
|
86
|
+
* const wordCountConfig = {
|
87
|
+
* container: document.getElementById( 'container-for-word-count' );
|
88
|
+
* };
|
89
|
+
* ```
|
90
|
+
*/
|
91
|
+
container?: HTMLElement;
|
92
|
+
}
|