Rev 637 | Rev 759 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 637 | Rev 679 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. |
2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. |
3 | * Licensed under the LGPL or a commercial license. |
3 | * Licensed under the LGPL or a commercial license. |
4 | * For LGPL see License.txt in the project root for license information. |
4 | * For LGPL see License.txt in the project root for license information. |
5 | * For commercial licenses see https://www.tiny.cloud/ |
5 | * For commercial licenses see https://www.tiny.cloud/ |
6 | * |
6 | * |
7 | * Version: 5.9.2 (2021-09-08) |
7 | * Version: 5.10.2 (2021-11-17) |
8 | */ |
8 | */ |
9 | (function () { |
9 | (function () { |
10 | 'use strict'; |
10 | 'use strict'; |
11 | 11 | ||
12 | var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); |
12 | var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager'); |
Line 27... | Line 27... | ||
27 | }; |
27 | }; |
28 | return __assign.apply(this, arguments); |
28 | return __assign.apply(this, arguments); |
29 | }; |
29 | }; |
30 | 30 | ||
31 | var zeroWidth = '\uFEFF'; |
31 | var zeroWidth = '\uFEFF'; |
32 | var removeZwsp = function (s) { |
32 | var removeZwsp$1 = function (s) { |
33 | return s.replace(/\uFEFF/g, ''); |
33 | return s.replace(/\uFEFF/g, ''); |
34 | }; |
34 | }; |
35 | 35 | ||
36 | var map = function (xs, f) { |
36 | var map = function (xs, f) { |
37 | var len = xs.length; |
37 | var len = xs.length; |
Line 256... | Line 256... | ||
256 | var textBlocks = []; |
256 | var textBlocks = []; |
257 | var txt = ''; |
257 | var txt = ''; |
258 | var treeWalker = new global$1(node, node); |
258 | var treeWalker = new global$1(node, node); |
259 | while (node = treeWalker.next()) { |
259 | while (node = treeWalker.next()) { |
260 | if (node.nodeType === 3) { |
260 | if (node.nodeType === 3) { |
261 | txt += removeZwsp(node.data); |
261 | txt += removeZwsp$1(node.data); |
262 | } else if (isNewline(node) && txt.length) { |
262 | } else if (isNewline(node) && txt.length) { |
263 | textBlocks.push(txt); |
263 | textBlocks.push(txt); |
264 | txt = ''; |
264 | txt = ''; |
265 | } |
265 | } |
266 | } |
266 | } |
Line 268... | Line 268... | ||
268 | textBlocks.push(txt); |
268 | textBlocks.push(txt); |
269 | } |
269 | } |
270 | return textBlocks; |
270 | return textBlocks; |
271 | }; |
271 | }; |
272 | 272 | ||
- | 273 | var removeZwsp = function (text) { |
|
- | 274 | return text.replace(/\u200B/g, ''); |
|
- | 275 | }; |
|
273 | var strLen = function (str) { |
276 | var strLen = function (str) { |
274 | return str.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length; |
277 | return str.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '_').length; |
275 | }; |
278 | }; |
276 | var countWords = function (node, schema) { |
279 | var countWords = function (node, schema) { |
277 | var text = getText(node, schema).join('\n'); |
280 | var text = removeZwsp(getText(node, schema).join('\n')); |
278 | return getWords(text.split(''), identity).length; |
281 | return getWords(text.split(''), identity).length; |
279 | }; |
282 | }; |
280 | var countCharacters = function (node, schema) { |
283 | var countCharacters = function (node, schema) { |
281 | var text = getText(node, schema).join(''); |
284 | var text = getText(node, schema).join(''); |
282 | return strLen(text); |
285 | return strLen(text); |