@dangl/angular-material-shared 2.5.1-beta0012 → 2.6.0-beta0019
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/README.md +1 -7
- package/esm2022/lib/angular-material-shared.module.mjs +2 -2
- package/esm2022/lib/components/tiny-mce/tiny-mce.component.mjs +16 -19
- package/fesm2022/dangl-angular-material-shared.mjs +16 -19
- package/fesm2022/dangl-angular-material-shared.mjs.map +1 -1
- package/lib/components/tiny-mce/tiny-mce.component.d.ts +7 -8
- package/package.json +1 -1
- package/tinymce-assets/icons/default/icons.js +187 -171
- package/tinymce-assets/icons/default/icons.min.js +1 -1
- package/tinymce-assets/langs/it.js +1 -1
- package/tinymce-assets/plugins/accordion/index.js +7 -0
- package/tinymce-assets/plugins/accordion/plugin.js +1054 -0
- package/tinymce-assets/plugins/accordion/plugin.min.js +4 -0
- package/tinymce-assets/plugins/advlist/plugin.js +185 -187
- package/tinymce-assets/plugins/advlist/plugin.min.js +2 -7
- package/tinymce-assets/plugins/anchor/plugin.js +79 -81
- package/tinymce-assets/plugins/anchor/plugin.min.js +2 -7
- package/tinymce-assets/plugins/autolink/plugin.js +209 -194
- package/tinymce-assets/plugins/autolink/plugin.min.js +2 -7
- package/tinymce-assets/plugins/autoresize/plugin.js +110 -102
- package/tinymce-assets/plugins/autoresize/plugin.min.js +2 -7
- package/tinymce-assets/plugins/autosave/plugin.js +125 -104
- package/tinymce-assets/plugins/autosave/plugin.min.js +2 -7
- package/tinymce-assets/plugins/charmap/plugin.js +275 -313
- package/tinymce-assets/plugins/charmap/plugin.min.js +2 -7
- package/tinymce-assets/plugins/code/plugin.js +18 -24
- package/tinymce-assets/plugins/code/plugin.min.js +2 -7
- package/tinymce-assets/plugins/codesample/plugin.js +2075 -2074
- package/tinymce-assets/plugins/codesample/plugin.min.js +2 -7
- package/tinymce-assets/plugins/directionality/plugin.js +247 -305
- package/tinymce-assets/plugins/directionality/plugin.min.js +2 -7
- package/tinymce-assets/plugins/emoticons/js/emojiimages.js +1 -9424
- package/tinymce-assets/plugins/emoticons/js/emojiimages.min.js +1 -1
- package/tinymce-assets/plugins/emoticons/js/emojis.js +1 -9423
- package/tinymce-assets/plugins/emoticons/js/emojis.min.js +1 -1
- package/tinymce-assets/plugins/emoticons/plugin.js +334 -374
- package/tinymce-assets/plugins/emoticons/plugin.min.js +2 -7
- package/tinymce-assets/plugins/fullscreen/plugin.js +740 -837
- package/tinymce-assets/plugins/fullscreen/plugin.min.js +2 -7
- package/tinymce-assets/plugins/help/js/i18n/keynav/ar.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ca.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/cs.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/da.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/de.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/el.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/en.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/es.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/eu.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/fa.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/fi.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/he_IL.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/hi.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/hr.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/id.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/it.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ja.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/kk.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ms.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/nl.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/pl.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ro.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/ru.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/sk.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/th_TH.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/tr.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/uk.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/vi.js +90 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
- package/tinymce-assets/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
- package/tinymce-assets/plugins/help/plugin.js +411 -355
- package/tinymce-assets/plugins/help/plugin.min.js +2 -7
- package/tinymce-assets/plugins/image/plugin.js +876 -1037
- package/tinymce-assets/plugins/image/plugin.min.js +2 -7
- package/tinymce-assets/plugins/importcss/plugin.js +146 -144
- package/tinymce-assets/plugins/importcss/plugin.min.js +2 -7
- package/tinymce-assets/plugins/insertdatetime/plugin.js +93 -88
- package/tinymce-assets/plugins/insertdatetime/plugin.min.js +2 -7
- package/tinymce-assets/plugins/link/plugin.js +718 -768
- package/tinymce-assets/plugins/link/plugin.min.js +2 -7
- package/tinymce-assets/plugins/lists/plugin.js +1235 -1375
- package/tinymce-assets/plugins/lists/plugin.min.js +2 -7
- package/tinymce-assets/plugins/media/plugin.js +614 -756
- package/tinymce-assets/plugins/media/plugin.min.js +2 -7
- package/tinymce-assets/plugins/nonbreaking/plugin.js +71 -48
- package/tinymce-assets/plugins/nonbreaking/plugin.min.js +2 -7
- package/tinymce-assets/plugins/pagebreak/plugin.js +53 -40
- package/tinymce-assets/plugins/pagebreak/plugin.min.js +2 -7
- package/tinymce-assets/plugins/preview/plugin.js +36 -65
- package/tinymce-assets/plugins/preview/plugin.min.js +2 -7
- package/tinymce-assets/plugins/quickbars/plugin.js +304 -331
- package/tinymce-assets/plugins/quickbars/plugin.min.js +2 -7
- package/tinymce-assets/plugins/save/plugin.js +49 -50
- package/tinymce-assets/plugins/save/plugin.min.js +2 -7
- package/tinymce-assets/plugins/searchreplace/plugin.js +499 -571
- package/tinymce-assets/plugins/searchreplace/plugin.min.js +2 -7
- package/tinymce-assets/plugins/table/plugin.js +2572 -10617
- package/tinymce-assets/plugins/table/plugin.min.js +2 -7
- package/tinymce-assets/plugins/visualblocks/plugin.js +41 -46
- package/tinymce-assets/plugins/visualblocks/plugin.min.js +2 -7
- package/tinymce-assets/plugins/visualchars/plugin.js +346 -312
- package/tinymce-assets/plugins/visualchars/plugin.min.js +2 -7
- package/tinymce-assets/plugins/wordcount/plugin.js +159 -179
- package/tinymce-assets/plugins/wordcount/plugin.min.js +2 -7
- package/tinymce-assets/skins/content/dark/content.css +2 -8
- package/tinymce-assets/skins/content/dark/content.js +2 -0
- package/tinymce-assets/skins/content/dark/content.min.css +1 -7
- package/tinymce-assets/skins/content/default/content.css +0 -6
- package/tinymce-assets/skins/content/default/content.js +2 -0
- package/tinymce-assets/skins/content/default/content.min.css +0 -6
- package/tinymce-assets/skins/content/document/content.css +0 -6
- package/tinymce-assets/skins/content/document/content.js +2 -0
- package/tinymce-assets/skins/content/document/content.min.css +0 -6
- package/tinymce-assets/skins/content/tinymce-5/content.css +61 -0
- package/tinymce-assets/skins/content/tinymce-5/content.js +2 -0
- package/tinymce-assets/skins/content/tinymce-5/content.min.css +1 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.css +66 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.js +2 -0
- package/tinymce-assets/skins/content/tinymce-5-dark/content.min.css +1 -0
- package/tinymce-assets/skins/content/writer/content.css +0 -6
- package/tinymce-assets/skins/content/writer/content.js +2 -0
- package/tinymce-assets/skins/content/writer/content.min.css +0 -6
- package/tinymce-assets/skins/ui/oxide/content.css +73 -20
- package/tinymce-assets/skins/ui/oxide/content.inline.css +73 -20
- package/tinymce-assets/skins/ui/oxide/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/oxide/content.inline.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide/content.js +2 -0
- package/tinymce-assets/skins/ui/oxide/content.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide/skin.css +1480 -435
- package/tinymce-assets/skins/ui/oxide/skin.js +2 -0
- package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.css +1 -8
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/oxide/skin.shadowdom.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/content.css +71 -19
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +73 -20
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/content.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/content.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/skin.css +1498 -450
- package/tinymce-assets/skins/ui/oxide-dark/skin.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -7
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.css +1 -8
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -7
- package/tinymce-assets/skins/ui/tinymce-5/content.css +785 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.css +779 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.inline.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/content.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.css +4185 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.css +766 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.css +779 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/content.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.css +4185 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.min.css +1 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
- package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
- package/tinymce-assets/themes/silver/theme.js +25226 -28188
- package/tinymce-assets/themes/silver/theme.min.js +2 -7
- package/tinymce-assets/plugins/bbcode/index.js +0 -7
- package/tinymce-assets/plugins/bbcode/plugin.js +0 -99
- package/tinymce-assets/plugins/bbcode/plugin.min.js +0 -9
- package/tinymce-assets/plugins/colorpicker/index.js +0 -7
- package/tinymce-assets/plugins/colorpicker/plugin.js +0 -21
- package/tinymce-assets/plugins/colorpicker/plugin.min.js +0 -9
- package/tinymce-assets/plugins/contextmenu/index.js +0 -7
- package/tinymce-assets/plugins/contextmenu/plugin.js +0 -21
- package/tinymce-assets/plugins/contextmenu/plugin.min.js +0 -9
- package/tinymce-assets/plugins/fullpage/index.js +0 -7
- package/tinymce-assets/plugins/fullpage/plugin.js +0 -544
- package/tinymce-assets/plugins/fullpage/plugin.min.js +0 -9
- package/tinymce-assets/plugins/hr/index.js +0 -7
- package/tinymce-assets/plugins/hr/plugin.js +0 -45
- package/tinymce-assets/plugins/hr/plugin.min.js +0 -9
- package/tinymce-assets/plugins/imagetools/index.js +0 -7
- package/tinymce-assets/plugins/imagetools/plugin.js +0 -1531
- package/tinymce-assets/plugins/imagetools/plugin.min.js +0 -9
- package/tinymce-assets/plugins/legacyoutput/index.js +0 -7
- package/tinymce-assets/plugins/legacyoutput/plugin.js +0 -199
- package/tinymce-assets/plugins/legacyoutput/plugin.min.js +0 -9
- package/tinymce-assets/plugins/noneditable/index.js +0 -7
- package/tinymce-assets/plugins/noneditable/plugin.js +0 -117
- package/tinymce-assets/plugins/noneditable/plugin.min.js +0 -9
- package/tinymce-assets/plugins/paste/index.js +0 -7
- package/tinymce-assets/plugins/paste/plugin.js +0 -1803
- package/tinymce-assets/plugins/paste/plugin.min.js +0 -9
- package/tinymce-assets/plugins/print/index.js +0 -7
- package/tinymce-assets/plugins/print/plugin.js +0 -52
- package/tinymce-assets/plugins/print/plugin.min.js +0 -9
- package/tinymce-assets/plugins/spellchecker/index.js +0 -7
- package/tinymce-assets/plugins/spellchecker/plugin.js +0 -730
- package/tinymce-assets/plugins/spellchecker/plugin.min.js +0 -9
- package/tinymce-assets/plugins/tabfocus/index.js +0 -7
- package/tinymce-assets/plugins/tabfocus/plugin.js +0 -130
- package/tinymce-assets/plugins/tabfocus/plugin.min.js +0 -9
- package/tinymce-assets/plugins/template/index.js +0 -7
- package/tinymce-assets/plugins/template/plugin.js +0 -591
- package/tinymce-assets/plugins/template/plugin.min.js +0 -9
- package/tinymce-assets/plugins/textcolor/index.js +0 -7
- package/tinymce-assets/plugins/textcolor/plugin.js +0 -21
- package/tinymce-assets/plugins/textcolor/plugin.min.js +0 -9
- package/tinymce-assets/plugins/textpattern/index.js +0 -7
- package/tinymce-assets/plugins/textpattern/plugin.js +0 -1374
- package/tinymce-assets/plugins/textpattern/plugin.min.js +0 -9
- package/tinymce-assets/plugins/toc/index.js +0 -7
- package/tinymce-assets/plugins/toc/plugin.js +0 -238
- package/tinymce-assets/plugins/toc/plugin.min.js +0 -9
- package/tinymce-assets/skins/ui/oxide/content.mobile.css +0 -29
- package/tinymce-assets/skins/ui/oxide/content.mobile.min.css +0 -7
- package/tinymce-assets/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- package/tinymce-assets/skins/ui/oxide/skin.mobile.css +0 -673
- package/tinymce-assets/skins/ui/oxide/skin.mobile.min.css +0 -7
- package/tinymce-assets/skins/ui/oxide-dark/content.mobile.css +0 -29
- package/tinymce-assets/skins/ui/oxide-dark/content.mobile.min.css +0 -7
- package/tinymce-assets/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
- package/tinymce-assets/skins/ui/oxide-dark/skin.mobile.css +0 -673
- package/tinymce-assets/skins/ui/oxide-dark/skin.mobile.min.css +0 -7
- package/tinymce-assets/themes/mobile/index.js +0 -7
- package/tinymce-assets/themes/mobile/theme.js +0 -13130
- package/tinymce-assets/themes/mobile/theme.min.js +0 -9
|
@@ -1,215 +1,200 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Licensed under the LGPL or a commercial license.
|
|
4
|
-
* For LGPL see License.txt in the project root for license information.
|
|
5
|
-
* For commercial licenses see https://www.tiny.cloud/
|
|
6
|
-
*
|
|
7
|
-
* Version: 5.10.9 (2023-11-15)
|
|
2
|
+
* TinyMCE version 7.0.1 (2024-04-10)
|
|
8
3
|
*/
|
|
4
|
+
|
|
9
5
|
(function () {
|
|
10
6
|
'use strict';
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const Cell = initial => {
|
|
9
|
+
let value = initial;
|
|
10
|
+
const get = () => {
|
|
15
11
|
return value;
|
|
16
12
|
};
|
|
17
|
-
|
|
13
|
+
const set = v => {
|
|
18
14
|
value = v;
|
|
19
15
|
};
|
|
20
16
|
return {
|
|
21
|
-
get
|
|
22
|
-
set
|
|
17
|
+
get,
|
|
18
|
+
set
|
|
23
19
|
};
|
|
24
20
|
};
|
|
25
21
|
|
|
26
22
|
var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
return t;
|
|
37
|
-
};
|
|
38
|
-
return __assign.apply(this, arguments);
|
|
24
|
+
const hasProto = (v, constructor, predicate) => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (predicate(v, constructor.prototype)) {
|
|
27
|
+
return true;
|
|
28
|
+
} else {
|
|
29
|
+
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
|
30
|
+
}
|
|
39
31
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var t = typeof x;
|
|
32
|
+
const typeOf = x => {
|
|
33
|
+
const t = typeof x;
|
|
43
34
|
if (x === null) {
|
|
44
35
|
return 'null';
|
|
45
|
-
} else if (t === 'object' &&
|
|
36
|
+
} else if (t === 'object' && Array.isArray(x)) {
|
|
46
37
|
return 'array';
|
|
47
|
-
} else if (t === 'object' && (String
|
|
38
|
+
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
48
39
|
return 'string';
|
|
49
40
|
} else {
|
|
50
41
|
return t;
|
|
51
42
|
}
|
|
52
43
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
var isString = isType$1('string');
|
|
64
|
-
var isArray = isType$1('array');
|
|
65
|
-
var isBoolean = isSimpleType('boolean');
|
|
66
|
-
var isNumber = isSimpleType('number');
|
|
44
|
+
const isType$1 = type => value => typeOf(value) === type;
|
|
45
|
+
const isSimpleType = type => value => typeof value === type;
|
|
46
|
+
const isString = isType$1('string');
|
|
47
|
+
const isArray = isType$1('array');
|
|
48
|
+
const isBoolean = isSimpleType('boolean');
|
|
49
|
+
const isNullable = a => a === null || a === undefined;
|
|
50
|
+
const isNonNullable = a => !isNullable(a);
|
|
51
|
+
const isNumber = isSimpleType('number');
|
|
67
52
|
|
|
68
|
-
|
|
53
|
+
const noop = () => {
|
|
69
54
|
};
|
|
70
|
-
|
|
71
|
-
return
|
|
55
|
+
const constant = value => {
|
|
56
|
+
return () => {
|
|
72
57
|
return value;
|
|
73
58
|
};
|
|
74
59
|
};
|
|
75
|
-
|
|
76
|
-
return x;
|
|
77
|
-
};
|
|
78
|
-
var never = constant(false);
|
|
79
|
-
var always = constant(true);
|
|
60
|
+
const always = constant(true);
|
|
80
61
|
|
|
81
|
-
|
|
62
|
+
const punctuationStr = `[~\u2116|!-*+-\\/:;?@\\[-\`{}\u00A1\u00AB\u00B7\u00BB\u00BF;\u00B7\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1361-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u3008\u3009\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30\u2E31\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]`;
|
|
82
63
|
|
|
83
|
-
|
|
64
|
+
const punctuation$1 = constant(punctuationStr);
|
|
84
65
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
getOrDie: function (msg) {
|
|
102
|
-
throw new Error(msg || 'error: getOrDie called on none.');
|
|
103
|
-
},
|
|
104
|
-
getOrNull: constant(null),
|
|
105
|
-
getOrUndefined: constant(undefined),
|
|
106
|
-
or: id,
|
|
107
|
-
orThunk: call,
|
|
108
|
-
map: none,
|
|
109
|
-
each: noop,
|
|
110
|
-
bind: none,
|
|
111
|
-
exists: never,
|
|
112
|
-
forall: always,
|
|
113
|
-
filter: function () {
|
|
114
|
-
return none();
|
|
115
|
-
},
|
|
116
|
-
toArray: function () {
|
|
117
|
-
return [];
|
|
118
|
-
},
|
|
119
|
-
toString: constant('none()')
|
|
120
|
-
};
|
|
121
|
-
return me;
|
|
122
|
-
}();
|
|
123
|
-
var some = function (a) {
|
|
124
|
-
var constant_a = constant(a);
|
|
125
|
-
var self = function () {
|
|
126
|
-
return me;
|
|
127
|
-
};
|
|
128
|
-
var bind = function (f) {
|
|
129
|
-
return f(a);
|
|
130
|
-
};
|
|
131
|
-
var me = {
|
|
132
|
-
fold: function (n, s) {
|
|
133
|
-
return s(a);
|
|
134
|
-
},
|
|
135
|
-
isSome: always,
|
|
136
|
-
isNone: never,
|
|
137
|
-
getOr: constant_a,
|
|
138
|
-
getOrThunk: constant_a,
|
|
139
|
-
getOrDie: constant_a,
|
|
140
|
-
getOrNull: constant_a,
|
|
141
|
-
getOrUndefined: constant_a,
|
|
142
|
-
or: self,
|
|
143
|
-
orThunk: self,
|
|
144
|
-
map: function (f) {
|
|
145
|
-
return some(f(a));
|
|
146
|
-
},
|
|
147
|
-
each: function (f) {
|
|
148
|
-
f(a);
|
|
149
|
-
},
|
|
150
|
-
bind: bind,
|
|
151
|
-
exists: bind,
|
|
152
|
-
forall: bind,
|
|
153
|
-
filter: function (f) {
|
|
154
|
-
return f(a) ? me : NONE;
|
|
155
|
-
},
|
|
156
|
-
toArray: function () {
|
|
157
|
-
return [a];
|
|
158
|
-
},
|
|
159
|
-
toString: function () {
|
|
160
|
-
return 'some(' + a + ')';
|
|
66
|
+
class Optional {
|
|
67
|
+
constructor(tag, value) {
|
|
68
|
+
this.tag = tag;
|
|
69
|
+
this.value = value;
|
|
70
|
+
}
|
|
71
|
+
static some(value) {
|
|
72
|
+
return new Optional(true, value);
|
|
73
|
+
}
|
|
74
|
+
static none() {
|
|
75
|
+
return Optional.singletonNone;
|
|
76
|
+
}
|
|
77
|
+
fold(onNone, onSome) {
|
|
78
|
+
if (this.tag) {
|
|
79
|
+
return onSome(this.value);
|
|
80
|
+
} else {
|
|
81
|
+
return onNone();
|
|
161
82
|
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
83
|
+
}
|
|
84
|
+
isSome() {
|
|
85
|
+
return this.tag;
|
|
86
|
+
}
|
|
87
|
+
isNone() {
|
|
88
|
+
return !this.tag;
|
|
89
|
+
}
|
|
90
|
+
map(mapper) {
|
|
91
|
+
if (this.tag) {
|
|
92
|
+
return Optional.some(mapper(this.value));
|
|
93
|
+
} else {
|
|
94
|
+
return Optional.none();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
bind(binder) {
|
|
98
|
+
if (this.tag) {
|
|
99
|
+
return binder(this.value);
|
|
100
|
+
} else {
|
|
101
|
+
return Optional.none();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exists(predicate) {
|
|
105
|
+
return this.tag && predicate(this.value);
|
|
106
|
+
}
|
|
107
|
+
forall(predicate) {
|
|
108
|
+
return !this.tag || predicate(this.value);
|
|
109
|
+
}
|
|
110
|
+
filter(predicate) {
|
|
111
|
+
if (!this.tag || predicate(this.value)) {
|
|
112
|
+
return this;
|
|
113
|
+
} else {
|
|
114
|
+
return Optional.none();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
getOr(replacement) {
|
|
118
|
+
return this.tag ? this.value : replacement;
|
|
119
|
+
}
|
|
120
|
+
or(replacement) {
|
|
121
|
+
return this.tag ? this : replacement;
|
|
122
|
+
}
|
|
123
|
+
getOrThunk(thunk) {
|
|
124
|
+
return this.tag ? this.value : thunk();
|
|
125
|
+
}
|
|
126
|
+
orThunk(thunk) {
|
|
127
|
+
return this.tag ? this : thunk();
|
|
128
|
+
}
|
|
129
|
+
getOrDie(message) {
|
|
130
|
+
if (!this.tag) {
|
|
131
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
132
|
+
} else {
|
|
133
|
+
return this.value;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
static from(value) {
|
|
137
|
+
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
138
|
+
}
|
|
139
|
+
getOrNull() {
|
|
140
|
+
return this.tag ? this.value : null;
|
|
141
|
+
}
|
|
142
|
+
getOrUndefined() {
|
|
143
|
+
return this.value;
|
|
144
|
+
}
|
|
145
|
+
each(worker) {
|
|
146
|
+
if (this.tag) {
|
|
147
|
+
worker(this.value);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
toArray() {
|
|
151
|
+
return this.tag ? [this.value] : [];
|
|
152
|
+
}
|
|
153
|
+
toString() {
|
|
154
|
+
return this.tag ? `some(${ this.value })` : 'none()';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
Optional.singletonNone = new Optional(false);
|
|
173
158
|
|
|
174
|
-
|
|
159
|
+
const punctuation = punctuation$1;
|
|
175
160
|
|
|
176
161
|
var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
|
|
177
162
|
|
|
178
163
|
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
179
164
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
for (
|
|
186
|
-
|
|
165
|
+
const nativeSlice = Array.prototype.slice;
|
|
166
|
+
const nativePush = Array.prototype.push;
|
|
167
|
+
const map = (xs, f) => {
|
|
168
|
+
const len = xs.length;
|
|
169
|
+
const r = new Array(len);
|
|
170
|
+
for (let i = 0; i < len; i++) {
|
|
171
|
+
const x = xs[i];
|
|
187
172
|
r[i] = f(x, i);
|
|
188
173
|
}
|
|
189
174
|
return r;
|
|
190
175
|
};
|
|
191
|
-
|
|
192
|
-
for (
|
|
193
|
-
|
|
176
|
+
const each = (xs, f) => {
|
|
177
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
178
|
+
const x = xs[i];
|
|
194
179
|
f(x, i);
|
|
195
180
|
}
|
|
196
181
|
};
|
|
197
|
-
|
|
198
|
-
for (
|
|
199
|
-
|
|
182
|
+
const eachr = (xs, f) => {
|
|
183
|
+
for (let i = xs.length - 1; i >= 0; i--) {
|
|
184
|
+
const x = xs[i];
|
|
200
185
|
f(x, i);
|
|
201
186
|
}
|
|
202
187
|
};
|
|
203
|
-
|
|
188
|
+
const groupBy = (xs, f) => {
|
|
204
189
|
if (xs.length === 0) {
|
|
205
190
|
return [];
|
|
206
191
|
} else {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
for (
|
|
211
|
-
|
|
212
|
-
|
|
192
|
+
let wasType = f(xs[0]);
|
|
193
|
+
const r = [];
|
|
194
|
+
let group = [];
|
|
195
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
196
|
+
const x = xs[i];
|
|
197
|
+
const type = f(x);
|
|
213
198
|
if (type !== wasType) {
|
|
214
199
|
r.push(group);
|
|
215
200
|
group = [];
|
|
@@ -223,15 +208,15 @@
|
|
|
223
208
|
return r;
|
|
224
209
|
}
|
|
225
210
|
};
|
|
226
|
-
|
|
227
|
-
each(xs,
|
|
211
|
+
const foldl = (xs, f, acc) => {
|
|
212
|
+
each(xs, (x, i) => {
|
|
228
213
|
acc = f(acc, x, i);
|
|
229
214
|
});
|
|
230
215
|
return acc;
|
|
231
216
|
};
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
for (
|
|
217
|
+
const flatten = xs => {
|
|
218
|
+
const r = [];
|
|
219
|
+
for (let i = 0, len = xs.length; i < len; ++i) {
|
|
235
220
|
if (!isArray(xs[i])) {
|
|
236
221
|
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
|
|
237
222
|
}
|
|
@@ -239,38 +224,28 @@
|
|
|
239
224
|
}
|
|
240
225
|
return r;
|
|
241
226
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
var sort = function (xs, comparator) {
|
|
246
|
-
var copy = nativeSlice.call(xs, 0);
|
|
227
|
+
const bind = (xs, f) => flatten(map(xs, f));
|
|
228
|
+
const sort = (xs, comparator) => {
|
|
229
|
+
const copy = nativeSlice.call(xs, 0);
|
|
247
230
|
copy.sort(comparator);
|
|
248
231
|
return copy;
|
|
249
232
|
};
|
|
250
233
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return hasOwnProperty.call(obj, key);
|
|
254
|
-
};
|
|
234
|
+
const hasOwnProperty = Object.hasOwnProperty;
|
|
235
|
+
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
255
236
|
|
|
256
237
|
typeof window !== 'undefined' ? window : Function('return this;')();
|
|
257
238
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
239
|
+
const DOCUMENT = 9;
|
|
240
|
+
const DOCUMENT_FRAGMENT = 11;
|
|
241
|
+
const ELEMENT = 1;
|
|
242
|
+
const TEXT = 3;
|
|
262
243
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
var isType = function (t) {
|
|
267
|
-
return function (element) {
|
|
268
|
-
return type(element) === t;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
var isText$1 = isType(TEXT);
|
|
244
|
+
const type = element => element.dom.nodeType;
|
|
245
|
+
const isType = t => element => type(element) === t;
|
|
246
|
+
const isText$1 = isType(TEXT);
|
|
272
247
|
|
|
273
|
-
|
|
248
|
+
const rawSet = (dom, key, value) => {
|
|
274
249
|
if (isString(value) || isBoolean(value) || isNumber(value)) {
|
|
275
250
|
dom.setAttribute(key, value + '');
|
|
276
251
|
} else {
|
|
@@ -278,164 +253,130 @@
|
|
|
278
253
|
throw new Error('Attribute value was not simple');
|
|
279
254
|
}
|
|
280
255
|
};
|
|
281
|
-
|
|
256
|
+
const set = (element, key, value) => {
|
|
282
257
|
rawSet(element.dom, key, value);
|
|
283
258
|
};
|
|
284
259
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var documentPositionPreceding = function (a, b) {
|
|
289
|
-
return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING);
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
var fromHtml = function (html, scope) {
|
|
293
|
-
var doc = scope || document;
|
|
294
|
-
var div = doc.createElement('div');
|
|
260
|
+
const fromHtml = (html, scope) => {
|
|
261
|
+
const doc = scope || document;
|
|
262
|
+
const div = doc.createElement('div');
|
|
295
263
|
div.innerHTML = html;
|
|
296
264
|
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
|
297
|
-
|
|
298
|
-
|
|
265
|
+
const message = 'HTML does not have a single root node';
|
|
266
|
+
console.error(message, html);
|
|
267
|
+
throw new Error(message);
|
|
299
268
|
}
|
|
300
269
|
return fromDom(div.childNodes[0]);
|
|
301
270
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
271
|
+
const fromTag = (tag, scope) => {
|
|
272
|
+
const doc = scope || document;
|
|
273
|
+
const node = doc.createElement(tag);
|
|
305
274
|
return fromDom(node);
|
|
306
275
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
276
|
+
const fromText = (text, scope) => {
|
|
277
|
+
const doc = scope || document;
|
|
278
|
+
const node = doc.createTextNode(text);
|
|
310
279
|
return fromDom(node);
|
|
311
280
|
};
|
|
312
|
-
|
|
281
|
+
const fromDom = node => {
|
|
313
282
|
if (node === null || node === undefined) {
|
|
314
283
|
throw new Error('Node cannot be null or undefined');
|
|
315
284
|
}
|
|
316
285
|
return { dom: node };
|
|
317
286
|
};
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
fromDom: fromDom,
|
|
326
|
-
fromPoint: fromPoint
|
|
287
|
+
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
288
|
+
const SugarElement = {
|
|
289
|
+
fromHtml,
|
|
290
|
+
fromTag,
|
|
291
|
+
fromText,
|
|
292
|
+
fromDom,
|
|
293
|
+
fromPoint
|
|
327
294
|
};
|
|
328
295
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
var all = function (selector, scope) {
|
|
333
|
-
var base = scope === undefined ? document : scope.dom;
|
|
296
|
+
const bypassSelector = dom => dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
|
|
297
|
+
const all = (selector, scope) => {
|
|
298
|
+
const base = scope === undefined ? document : scope.dom;
|
|
334
299
|
return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);
|
|
335
300
|
};
|
|
336
301
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
element: element,
|
|
346
|
-
offset: offset
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
var leaf = function (element, offset) {
|
|
350
|
-
var cs = children(element);
|
|
302
|
+
const parent = element => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
|
|
303
|
+
const children = element => map(element.dom.childNodes, SugarElement.fromDom);
|
|
304
|
+
const spot = (element, offset) => ({
|
|
305
|
+
element,
|
|
306
|
+
offset
|
|
307
|
+
});
|
|
308
|
+
const leaf = (element, offset) => {
|
|
309
|
+
const cs = children(element);
|
|
351
310
|
return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
|
|
352
311
|
};
|
|
353
312
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
parent$1.each(
|
|
313
|
+
const before = (marker, element) => {
|
|
314
|
+
const parent$1 = parent(marker);
|
|
315
|
+
parent$1.each(v => {
|
|
357
316
|
v.dom.insertBefore(element.dom, marker.dom);
|
|
358
317
|
});
|
|
359
318
|
};
|
|
360
|
-
|
|
319
|
+
const append = (parent, element) => {
|
|
361
320
|
parent.dom.appendChild(element.dom);
|
|
362
321
|
};
|
|
363
|
-
|
|
322
|
+
const wrap = (element, wrapper) => {
|
|
364
323
|
before(element, wrapper);
|
|
365
324
|
append(wrapper, element);
|
|
366
325
|
};
|
|
367
326
|
|
|
368
|
-
|
|
369
|
-
|
|
327
|
+
const NodeValue = (is, name) => {
|
|
328
|
+
const get = element => {
|
|
370
329
|
if (!is(element)) {
|
|
371
330
|
throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
|
|
372
331
|
}
|
|
373
332
|
return getOption(element).getOr('');
|
|
374
333
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
};
|
|
378
|
-
var set = function (element, value) {
|
|
334
|
+
const getOption = element => is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();
|
|
335
|
+
const set = (element, value) => {
|
|
379
336
|
if (!is(element)) {
|
|
380
337
|
throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
|
|
381
338
|
}
|
|
382
339
|
element.dom.nodeValue = value;
|
|
383
340
|
};
|
|
384
341
|
return {
|
|
385
|
-
get
|
|
386
|
-
getOption
|
|
387
|
-
set
|
|
342
|
+
get,
|
|
343
|
+
getOption,
|
|
344
|
+
set
|
|
388
345
|
};
|
|
389
346
|
};
|
|
390
347
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
return api.get(element);
|
|
394
|
-
};
|
|
348
|
+
const api = NodeValue(isText$1, 'text');
|
|
349
|
+
const get$1 = element => api.get(element);
|
|
395
350
|
|
|
396
|
-
|
|
397
|
-
return
|
|
351
|
+
const compareDocumentPosition = (a, b, match) => {
|
|
352
|
+
return (a.compareDocumentPosition(b) & match) !== 0;
|
|
353
|
+
};
|
|
354
|
+
const documentPositionPreceding = (a, b) => {
|
|
355
|
+
return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING);
|
|
398
356
|
};
|
|
399
357
|
|
|
358
|
+
const descendants = (scope, selector) => all(selector, scope);
|
|
359
|
+
|
|
400
360
|
var global = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
|
|
401
361
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
};
|
|
417
|
-
var isText = function (node) {
|
|
418
|
-
return node.nodeType === 3;
|
|
419
|
-
};
|
|
420
|
-
var nuSection = function () {
|
|
421
|
-
return {
|
|
422
|
-
sOffset: 0,
|
|
423
|
-
fOffset: 0,
|
|
424
|
-
elements: []
|
|
425
|
-
};
|
|
426
|
-
};
|
|
427
|
-
var toLeaf = function (node, offset) {
|
|
428
|
-
return leaf(SugarElement.fromDom(node), offset);
|
|
429
|
-
};
|
|
430
|
-
var walk = function (dom, walkerFn, startNode, callbacks, endNode, skipStart) {
|
|
431
|
-
if (skipStart === void 0) {
|
|
432
|
-
skipStart = true;
|
|
433
|
-
}
|
|
434
|
-
var next = skipStart ? walkerFn(false) : startNode;
|
|
362
|
+
const isSimpleBoundary = (dom, node) => dom.isBlock(node) || has(dom.schema.getVoidElements(), node.nodeName);
|
|
363
|
+
const isContentEditableFalse = (dom, node) => !dom.isEditable(node);
|
|
364
|
+
const isContentEditableTrueInCef = (dom, node) => dom.getContentEditable(node) === 'true' && node.parentNode && !dom.isEditable(node.parentNode);
|
|
365
|
+
const isHidden = (dom, node) => !dom.isBlock(node) && has(dom.schema.getWhitespaceElements(), node.nodeName);
|
|
366
|
+
const isBoundary = (dom, node) => isSimpleBoundary(dom, node) || isContentEditableFalse(dom, node) || isHidden(dom, node) || isContentEditableTrueInCef(dom, node);
|
|
367
|
+
const isText = node => node.nodeType === 3;
|
|
368
|
+
const nuSection = () => ({
|
|
369
|
+
sOffset: 0,
|
|
370
|
+
fOffset: 0,
|
|
371
|
+
elements: []
|
|
372
|
+
});
|
|
373
|
+
const toLeaf = (node, offset) => leaf(SugarElement.fromDom(node), offset);
|
|
374
|
+
const walk = (dom, walkerFn, startNode, callbacks, endNode, skipStart = true) => {
|
|
375
|
+
let next = skipStart ? walkerFn(false) : startNode;
|
|
435
376
|
while (next) {
|
|
436
|
-
|
|
377
|
+
const isCefNode = isContentEditableFalse(dom, next);
|
|
437
378
|
if (isCefNode || isHidden(dom, next)) {
|
|
438
|
-
|
|
379
|
+
const stopWalking = isCefNode ? callbacks.cef(next) : callbacks.boundary(next);
|
|
439
380
|
if (stopWalking) {
|
|
440
381
|
break;
|
|
441
382
|
} else {
|
|
@@ -456,17 +397,18 @@
|
|
|
456
397
|
}
|
|
457
398
|
}
|
|
458
399
|
};
|
|
459
|
-
|
|
400
|
+
const collectTextToBoundary = (dom, section, node, rootNode, forwards) => {
|
|
401
|
+
var _a;
|
|
460
402
|
if (isBoundary(dom, node)) {
|
|
461
403
|
return;
|
|
462
404
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
405
|
+
const rootBlock = (_a = dom.getParent(rootNode, dom.isBlock)) !== null && _a !== void 0 ? _a : dom.getRoot();
|
|
406
|
+
const walker = new global(node, rootBlock);
|
|
407
|
+
const walkerFn = forwards ? walker.next.bind(walker) : walker.prev.bind(walker);
|
|
466
408
|
walk(dom, walkerFn, node, {
|
|
467
409
|
boundary: always,
|
|
468
410
|
cef: always,
|
|
469
|
-
text:
|
|
411
|
+
text: next => {
|
|
470
412
|
if (forwards) {
|
|
471
413
|
section.fOffset += next.length;
|
|
472
414
|
} else {
|
|
@@ -476,15 +418,12 @@
|
|
|
476
418
|
}
|
|
477
419
|
});
|
|
478
420
|
};
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
var walker = new global(startNode, rootNode);
|
|
484
|
-
var sections = [];
|
|
485
|
-
var current = nuSection();
|
|
421
|
+
const collect = (dom, rootNode, startNode, endNode, callbacks, skipStart = true) => {
|
|
422
|
+
const walker = new global(startNode, rootNode);
|
|
423
|
+
const sections = [];
|
|
424
|
+
let current = nuSection();
|
|
486
425
|
collectTextToBoundary(dom, current, startNode, rootNode, false);
|
|
487
|
-
|
|
426
|
+
const finishSection = () => {
|
|
488
427
|
if (current.elements.length > 0) {
|
|
489
428
|
sections.push(current);
|
|
490
429
|
current = nuSection();
|
|
@@ -493,14 +432,14 @@
|
|
|
493
432
|
};
|
|
494
433
|
walk(dom, walker.next.bind(walker), startNode, {
|
|
495
434
|
boundary: finishSection,
|
|
496
|
-
cef:
|
|
435
|
+
cef: node => {
|
|
497
436
|
finishSection();
|
|
498
437
|
if (callbacks) {
|
|
499
|
-
sections.push
|
|
438
|
+
sections.push(...callbacks.cef(node));
|
|
500
439
|
}
|
|
501
440
|
return false;
|
|
502
441
|
},
|
|
503
|
-
text:
|
|
442
|
+
text: next => {
|
|
504
443
|
current.elements.push(SugarElement.fromDom(next));
|
|
505
444
|
if (callbacks) {
|
|
506
445
|
callbacks.text(next, current);
|
|
@@ -513,59 +452,45 @@
|
|
|
513
452
|
finishSection();
|
|
514
453
|
return sections;
|
|
515
454
|
};
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
455
|
+
const collectRangeSections = (dom, rng) => {
|
|
456
|
+
const start = toLeaf(rng.startContainer, rng.startOffset);
|
|
457
|
+
const startNode = start.element.dom;
|
|
458
|
+
const end = toLeaf(rng.endContainer, rng.endOffset);
|
|
459
|
+
const endNode = end.element.dom;
|
|
521
460
|
return collect(dom, rng.commonAncestorContainer, startNode, endNode, {
|
|
522
|
-
text:
|
|
461
|
+
text: (node, section) => {
|
|
523
462
|
if (node === endNode) {
|
|
524
463
|
section.fOffset += node.length - end.offset;
|
|
525
464
|
} else if (node === startNode) {
|
|
526
465
|
section.sOffset += start.offset;
|
|
527
466
|
}
|
|
528
467
|
},
|
|
529
|
-
cef:
|
|
530
|
-
|
|
531
|
-
|
|
468
|
+
cef: node => {
|
|
469
|
+
const sections = bind(descendants(SugarElement.fromDom(node), '*[contenteditable=true]'), e => {
|
|
470
|
+
const ceTrueNode = e.dom;
|
|
532
471
|
return collect(dom, ceTrueNode, ceTrueNode);
|
|
533
472
|
});
|
|
534
|
-
return sort(sections,
|
|
535
|
-
return documentPositionPreceding(a.elements[0].dom, b.elements[0].dom) ? 1 : -1;
|
|
536
|
-
});
|
|
473
|
+
return sort(sections, (a, b) => documentPositionPreceding(a.elements[0].dom, b.elements[0].dom) ? 1 : -1);
|
|
537
474
|
}
|
|
538
475
|
}, false);
|
|
539
476
|
};
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
var fromNode = function (dom, node) {
|
|
544
|
-
var rng = dom.createRng();
|
|
477
|
+
const fromRng = (dom, rng) => rng.collapsed ? [] : collectRangeSections(dom, rng);
|
|
478
|
+
const fromNode = (dom, node) => {
|
|
479
|
+
const rng = dom.createRng();
|
|
545
480
|
rng.selectNode(node);
|
|
546
481
|
return fromRng(dom, rng);
|
|
547
482
|
};
|
|
548
|
-
|
|
549
|
-
return bind(nodes, function (node) {
|
|
550
|
-
return fromNode(dom, node);
|
|
551
|
-
});
|
|
552
|
-
};
|
|
483
|
+
const fromNodes = (dom, nodes) => bind(nodes, node => fromNode(dom, node));
|
|
553
484
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
start = 0;
|
|
557
|
-
}
|
|
558
|
-
if (finish === void 0) {
|
|
559
|
-
finish = text.length;
|
|
560
|
-
}
|
|
561
|
-
var regex = pattern.regex;
|
|
485
|
+
const find$2 = (text, pattern, start = 0, finish = text.length) => {
|
|
486
|
+
const regex = pattern.regex;
|
|
562
487
|
regex.lastIndex = start;
|
|
563
|
-
|
|
564
|
-
|
|
488
|
+
const results = [];
|
|
489
|
+
let match;
|
|
565
490
|
while (match = regex.exec(text)) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
491
|
+
const matchedText = match[pattern.matchIndex];
|
|
492
|
+
const matchStart = match.index + match[0].indexOf(matchedText);
|
|
493
|
+
const matchFinish = matchStart + matchedText.length;
|
|
569
494
|
if (matchFinish > finish) {
|
|
570
495
|
break;
|
|
571
496
|
}
|
|
@@ -577,15 +502,15 @@
|
|
|
577
502
|
}
|
|
578
503
|
return results;
|
|
579
504
|
};
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
505
|
+
const extract = (elements, matches) => {
|
|
506
|
+
const nodePositions = foldl(elements, (acc, element) => {
|
|
507
|
+
const content = get$1(element);
|
|
508
|
+
const start = acc.last;
|
|
509
|
+
const finish = start + content.length;
|
|
510
|
+
const positions = bind(matches, (match, matchIdx) => {
|
|
586
511
|
if (match.start < finish && match.finish > start) {
|
|
587
512
|
return [{
|
|
588
|
-
element
|
|
513
|
+
element,
|
|
589
514
|
start: Math.max(start, match.start) - start,
|
|
590
515
|
finish: Math.min(finish, match.finish) - start,
|
|
591
516
|
matchId: matchIdx
|
|
@@ -602,64 +527,56 @@
|
|
|
602
527
|
results: [],
|
|
603
528
|
last: 0
|
|
604
529
|
}).results;
|
|
605
|
-
return groupBy(nodePositions,
|
|
606
|
-
return position.matchId;
|
|
607
|
-
});
|
|
530
|
+
return groupBy(nodePositions, position => position.matchId);
|
|
608
531
|
};
|
|
609
532
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
eachr(match, function (pos) {
|
|
621
|
-
var wrapper = SugarElement.fromDom(replacementNode.cloneNode(false));
|
|
533
|
+
const find$1 = (pattern, sections) => bind(sections, section => {
|
|
534
|
+
const elements = section.elements;
|
|
535
|
+
const content = map(elements, get$1).join('');
|
|
536
|
+
const positions = find$2(content, pattern, section.sOffset, content.length - section.fOffset);
|
|
537
|
+
return extract(elements, positions);
|
|
538
|
+
});
|
|
539
|
+
const mark = (matches, replacementNode) => {
|
|
540
|
+
eachr(matches, (match, idx) => {
|
|
541
|
+
eachr(match, pos => {
|
|
542
|
+
const wrapper = SugarElement.fromDom(replacementNode.cloneNode(false));
|
|
622
543
|
set(wrapper, 'data-mce-index', idx);
|
|
623
|
-
|
|
544
|
+
const textNode = pos.element.dom;
|
|
624
545
|
if (textNode.length === pos.finish && pos.start === 0) {
|
|
625
546
|
wrap(pos.element, wrapper);
|
|
626
547
|
} else {
|
|
627
548
|
if (textNode.length !== pos.finish) {
|
|
628
549
|
textNode.splitText(pos.finish);
|
|
629
550
|
}
|
|
630
|
-
|
|
551
|
+
const matchNode = textNode.splitText(pos.start);
|
|
631
552
|
wrap(SugarElement.fromDom(matchNode), wrapper);
|
|
632
553
|
}
|
|
633
554
|
});
|
|
634
555
|
});
|
|
635
556
|
};
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
557
|
+
const findAndMark = (dom, pattern, node, replacementNode) => {
|
|
558
|
+
const textSections = fromNode(dom, node);
|
|
559
|
+
const matches = find$1(pattern, textSections);
|
|
639
560
|
mark(matches, replacementNode);
|
|
640
561
|
return matches.length;
|
|
641
562
|
};
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
563
|
+
const findAndMarkInSelection = (dom, pattern, selection, replacementNode) => {
|
|
564
|
+
const bookmark = selection.getBookmark();
|
|
565
|
+
const nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');
|
|
566
|
+
const textSections = nodes.length > 0 ? fromNodes(dom, nodes) : fromRng(dom, selection.getRng());
|
|
567
|
+
const matches = find$1(pattern, textSections);
|
|
647
568
|
mark(matches, replacementNode);
|
|
648
569
|
selection.moveToBookmark(bookmark);
|
|
649
570
|
return matches.length;
|
|
650
571
|
};
|
|
651
572
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
if (typeof value === 'number') {
|
|
655
|
-
return '' + value;
|
|
656
|
-
}
|
|
657
|
-
return value;
|
|
573
|
+
const getElmIndex = elm => {
|
|
574
|
+
return elm.getAttribute('data-mce-index');
|
|
658
575
|
};
|
|
659
|
-
|
|
660
|
-
|
|
576
|
+
const markAllMatches = (editor, currentSearchState, pattern, inSelection) => {
|
|
577
|
+
const marker = editor.dom.create('span', { 'data-mce-bogus': 1 });
|
|
661
578
|
marker.className = 'mce-match-marker';
|
|
662
|
-
|
|
579
|
+
const node = editor.getBody();
|
|
663
580
|
done(editor, currentSearchState, false);
|
|
664
581
|
if (inSelection) {
|
|
665
582
|
return findAndMarkInSelection(editor.dom, pattern, editor.selection, marker);
|
|
@@ -667,19 +584,20 @@
|
|
|
667
584
|
return findAndMark(editor.dom, pattern, node, marker);
|
|
668
585
|
}
|
|
669
586
|
};
|
|
670
|
-
|
|
671
|
-
var
|
|
587
|
+
const unwrap = node => {
|
|
588
|
+
var _a;
|
|
589
|
+
const parentNode = node.parentNode;
|
|
672
590
|
if (node.firstChild) {
|
|
673
591
|
parentNode.insertBefore(node.firstChild, node);
|
|
674
592
|
}
|
|
675
|
-
node.parentNode.removeChild(node);
|
|
593
|
+
(_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(node);
|
|
676
594
|
};
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
595
|
+
const findSpansByIndex = (editor, index) => {
|
|
596
|
+
const spans = [];
|
|
597
|
+
const nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
|
|
680
598
|
if (nodes.length) {
|
|
681
|
-
for (
|
|
682
|
-
|
|
599
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
600
|
+
const nodeIndex = getElmIndex(nodes[i]);
|
|
683
601
|
if (nodeIndex === null || !nodeIndex.length) {
|
|
684
602
|
continue;
|
|
685
603
|
}
|
|
@@ -690,11 +608,10 @@
|
|
|
690
608
|
}
|
|
691
609
|
return spans;
|
|
692
610
|
};
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
forward = forward !== false;
|
|
611
|
+
const moveSelection = (editor, currentSearchState, forward) => {
|
|
612
|
+
const searchState = currentSearchState.get();
|
|
613
|
+
let testIndex = searchState.index;
|
|
614
|
+
const dom = editor.dom;
|
|
698
615
|
if (forward) {
|
|
699
616
|
if (testIndex + 1 === searchState.count) {
|
|
700
617
|
testIndex = 0;
|
|
@@ -709,7 +626,7 @@
|
|
|
709
626
|
}
|
|
710
627
|
}
|
|
711
628
|
dom.removeClass(findSpansByIndex(editor, searchState.index), 'mce-match-marker-selected');
|
|
712
|
-
|
|
629
|
+
const spans = findSpansByIndex(editor, testIndex);
|
|
713
630
|
if (spans.length) {
|
|
714
631
|
dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');
|
|
715
632
|
editor.selection.scrollIntoView(spans[0]);
|
|
@@ -717,68 +634,74 @@
|
|
|
717
634
|
}
|
|
718
635
|
return -1;
|
|
719
636
|
};
|
|
720
|
-
|
|
721
|
-
|
|
637
|
+
const removeNode = (dom, node) => {
|
|
638
|
+
const parent = node.parentNode;
|
|
722
639
|
dom.remove(node);
|
|
723
|
-
if (dom.isEmpty(parent)) {
|
|
640
|
+
if (parent && dom.isEmpty(parent)) {
|
|
724
641
|
dom.remove(parent);
|
|
725
642
|
}
|
|
726
643
|
};
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
return wholeWord ?
|
|
644
|
+
const escapeSearchText = (text, wholeWord) => {
|
|
645
|
+
const escapedText = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&').replace(/\s/g, '[^\\S\\r\\n\\uFEFF]');
|
|
646
|
+
const wordRegex = '(' + escapedText + ')';
|
|
647
|
+
return wholeWord ? `(?:^|\\s|${ punctuation() })` + wordRegex + `(?=$|\\s|${ punctuation() })` : wordRegex;
|
|
731
648
|
};
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
649
|
+
const find = (editor, currentSearchState, text, matchCase, wholeWord, inSelection) => {
|
|
650
|
+
const selection = editor.selection;
|
|
651
|
+
const escapedText = escapeSearchText(text, wholeWord);
|
|
652
|
+
const isForwardSelection = selection.isForward();
|
|
653
|
+
const pattern = {
|
|
737
654
|
regex: new RegExp(escapedText, matchCase ? 'g' : 'gi'),
|
|
738
655
|
matchIndex: 1
|
|
739
656
|
};
|
|
740
|
-
|
|
657
|
+
const count = markAllMatches(editor, currentSearchState, pattern, inSelection);
|
|
741
658
|
if (global$2.browser.isSafari()) {
|
|
742
659
|
selection.setRng(selection.getRng(), isForwardSelection);
|
|
743
660
|
}
|
|
744
661
|
if (count) {
|
|
745
|
-
|
|
662
|
+
const newIndex = moveSelection(editor, currentSearchState, true);
|
|
746
663
|
currentSearchState.set({
|
|
747
664
|
index: newIndex,
|
|
748
|
-
count
|
|
749
|
-
text
|
|
750
|
-
matchCase
|
|
751
|
-
wholeWord
|
|
752
|
-
inSelection
|
|
665
|
+
count,
|
|
666
|
+
text,
|
|
667
|
+
matchCase,
|
|
668
|
+
wholeWord,
|
|
669
|
+
inSelection
|
|
753
670
|
});
|
|
754
671
|
}
|
|
755
672
|
return count;
|
|
756
673
|
};
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
currentSearchState.set(
|
|
674
|
+
const next = (editor, currentSearchState) => {
|
|
675
|
+
const index = moveSelection(editor, currentSearchState, true);
|
|
676
|
+
currentSearchState.set({
|
|
677
|
+
...currentSearchState.get(),
|
|
678
|
+
index
|
|
679
|
+
});
|
|
760
680
|
};
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
currentSearchState.set(
|
|
681
|
+
const prev = (editor, currentSearchState) => {
|
|
682
|
+
const index = moveSelection(editor, currentSearchState, false);
|
|
683
|
+
currentSearchState.set({
|
|
684
|
+
...currentSearchState.get(),
|
|
685
|
+
index
|
|
686
|
+
});
|
|
764
687
|
};
|
|
765
|
-
|
|
766
|
-
|
|
688
|
+
const isMatchSpan = node => {
|
|
689
|
+
const matchIndex = getElmIndex(node);
|
|
767
690
|
return matchIndex !== null && matchIndex.length > 0;
|
|
768
691
|
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
692
|
+
const replace = (editor, currentSearchState, text, forward, all) => {
|
|
693
|
+
const searchState = currentSearchState.get();
|
|
694
|
+
const currentIndex = searchState.index;
|
|
695
|
+
let currentMatchIndex, nextIndex = currentIndex;
|
|
773
696
|
forward = forward !== false;
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
for (
|
|
777
|
-
|
|
778
|
-
|
|
697
|
+
const node = editor.getBody();
|
|
698
|
+
const nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);
|
|
699
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
700
|
+
const nodeIndex = getElmIndex(nodes[i]);
|
|
701
|
+
let matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
|
|
779
702
|
if (all || matchIndex === searchState.index) {
|
|
780
703
|
if (text.length) {
|
|
781
|
-
nodes[i].
|
|
704
|
+
nodes[i].innerText = text;
|
|
782
705
|
unwrap(nodes[i]);
|
|
783
706
|
} else {
|
|
784
707
|
removeNode(editor.dom, nodes[i]);
|
|
@@ -799,10 +722,11 @@
|
|
|
799
722
|
nodes[i].setAttribute('data-mce-index', String(currentMatchIndex - 1));
|
|
800
723
|
}
|
|
801
724
|
}
|
|
802
|
-
currentSearchState.set(
|
|
725
|
+
currentSearchState.set({
|
|
726
|
+
...searchState,
|
|
803
727
|
count: all ? 0 : searchState.count - 1,
|
|
804
728
|
index: nextIndex
|
|
805
|
-
})
|
|
729
|
+
});
|
|
806
730
|
if (forward) {
|
|
807
731
|
next(editor, currentSearchState);
|
|
808
732
|
} else {
|
|
@@ -810,12 +734,13 @@
|
|
|
810
734
|
}
|
|
811
735
|
return !all && currentSearchState.get().count > 0;
|
|
812
736
|
};
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
737
|
+
const done = (editor, currentSearchState, keepEditorSelection) => {
|
|
738
|
+
let startContainer;
|
|
739
|
+
let endContainer;
|
|
740
|
+
const searchState = currentSearchState.get();
|
|
741
|
+
const nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
|
|
742
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
743
|
+
const nodeIndex = getElmIndex(nodes[i]);
|
|
819
744
|
if (nodeIndex !== null && nodeIndex.length) {
|
|
820
745
|
if (nodeIndex === searchState.index.toString()) {
|
|
821
746
|
if (!startContainer) {
|
|
@@ -826,45 +751,41 @@
|
|
|
826
751
|
unwrap(nodes[i]);
|
|
827
752
|
}
|
|
828
753
|
}
|
|
829
|
-
currentSearchState.set(
|
|
754
|
+
currentSearchState.set({
|
|
755
|
+
...searchState,
|
|
830
756
|
index: -1,
|
|
831
757
|
count: 0,
|
|
832
758
|
text: ''
|
|
833
|
-
})
|
|
759
|
+
});
|
|
834
760
|
if (startContainer && endContainer) {
|
|
835
|
-
|
|
761
|
+
const rng = editor.dom.createRng();
|
|
836
762
|
rng.setStart(startContainer, 0);
|
|
837
763
|
rng.setEnd(endContainer, endContainer.data.length);
|
|
838
764
|
if (keepEditorSelection !== false) {
|
|
839
765
|
editor.selection.setRng(rng);
|
|
840
766
|
}
|
|
841
767
|
return rng;
|
|
768
|
+
} else {
|
|
769
|
+
return undefined;
|
|
842
770
|
}
|
|
843
771
|
};
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
};
|
|
847
|
-
var hasPrev = function (editor, currentSearchState) {
|
|
848
|
-
return currentSearchState.get().count > 1;
|
|
849
|
-
};
|
|
772
|
+
const hasNext = (editor, currentSearchState) => currentSearchState.get().count > 1;
|
|
773
|
+
const hasPrev = (editor, currentSearchState) => currentSearchState.get().count > 1;
|
|
850
774
|
|
|
851
|
-
|
|
852
|
-
|
|
775
|
+
const get = (editor, currentState) => {
|
|
776
|
+
const done$1 = keepEditorSelection => {
|
|
853
777
|
return done(editor, currentState, keepEditorSelection);
|
|
854
778
|
};
|
|
855
|
-
|
|
856
|
-
if (inSelection === void 0) {
|
|
857
|
-
inSelection = false;
|
|
858
|
-
}
|
|
779
|
+
const find$1 = (text, matchCase, wholeWord, inSelection = false) => {
|
|
859
780
|
return find(editor, currentState, text, matchCase, wholeWord, inSelection);
|
|
860
781
|
};
|
|
861
|
-
|
|
782
|
+
const next$1 = () => {
|
|
862
783
|
return next(editor, currentState);
|
|
863
784
|
};
|
|
864
|
-
|
|
785
|
+
const prev$1 = () => {
|
|
865
786
|
return prev(editor, currentState);
|
|
866
787
|
};
|
|
867
|
-
|
|
788
|
+
const replace$1 = (text, forward, all) => {
|
|
868
789
|
return replace(editor, currentState, text, forward, all);
|
|
869
790
|
};
|
|
870
791
|
return {
|
|
@@ -876,87 +797,79 @@
|
|
|
876
797
|
};
|
|
877
798
|
};
|
|
878
799
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
};
|
|
884
|
-
var clear = function () {
|
|
800
|
+
const singleton = doRevoke => {
|
|
801
|
+
const subject = Cell(Optional.none());
|
|
802
|
+
const revoke = () => subject.get().each(doRevoke);
|
|
803
|
+
const clear = () => {
|
|
885
804
|
revoke();
|
|
886
805
|
subject.set(Optional.none());
|
|
887
806
|
};
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
var get = function () {
|
|
892
|
-
return subject.get();
|
|
893
|
-
};
|
|
894
|
-
var set = function (s) {
|
|
807
|
+
const isSet = () => subject.get().isSome();
|
|
808
|
+
const get = () => subject.get();
|
|
809
|
+
const set = s => {
|
|
895
810
|
revoke();
|
|
896
811
|
subject.set(Optional.some(s));
|
|
897
812
|
};
|
|
898
813
|
return {
|
|
899
|
-
clear
|
|
900
|
-
isSet
|
|
901
|
-
get
|
|
902
|
-
set
|
|
814
|
+
clear,
|
|
815
|
+
isSet,
|
|
816
|
+
get,
|
|
817
|
+
set
|
|
903
818
|
};
|
|
904
819
|
};
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
820
|
+
const value = () => {
|
|
821
|
+
const subject = singleton(noop);
|
|
822
|
+
const on = f => subject.get().each(f);
|
|
823
|
+
return {
|
|
824
|
+
...subject,
|
|
825
|
+
on
|
|
909
826
|
};
|
|
910
|
-
return __assign(__assign({}, subject), { on: on });
|
|
911
827
|
};
|
|
912
828
|
|
|
913
|
-
|
|
914
|
-
|
|
829
|
+
const open = (editor, currentSearchState) => {
|
|
830
|
+
const dialogApi = value();
|
|
915
831
|
editor.undoManager.add();
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
var updatePrev = hasPrev(editor, currentSearchState) ? api.enable : api.disable;
|
|
921
|
-
updatePrev('prev');
|
|
832
|
+
const selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));
|
|
833
|
+
const updateButtonStates = api => {
|
|
834
|
+
api.setEnabled('next', hasNext(editor, currentSearchState));
|
|
835
|
+
api.setEnabled('prev', hasPrev(editor, currentSearchState));
|
|
922
836
|
};
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
currentSearchState.set(
|
|
837
|
+
const updateSearchState = api => {
|
|
838
|
+
const data = api.getData();
|
|
839
|
+
const current = currentSearchState.get();
|
|
840
|
+
currentSearchState.set({
|
|
841
|
+
...current,
|
|
927
842
|
matchCase: data.matchcase,
|
|
928
843
|
wholeWord: data.wholewords,
|
|
929
844
|
inSelection: data.inselection
|
|
930
|
-
})
|
|
845
|
+
});
|
|
931
846
|
};
|
|
932
|
-
|
|
933
|
-
|
|
847
|
+
const disableAll = (api, disable) => {
|
|
848
|
+
const buttons = [
|
|
934
849
|
'replace',
|
|
935
850
|
'replaceall',
|
|
936
851
|
'prev',
|
|
937
852
|
'next'
|
|
938
853
|
];
|
|
939
|
-
|
|
854
|
+
const toggle = name => api.setEnabled(name, !disable);
|
|
940
855
|
each(buttons, toggle);
|
|
941
856
|
};
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
api.focus('findtext');
|
|
945
|
-
});
|
|
857
|
+
const toggleNotFoundAlert = (isVisible, api) => {
|
|
858
|
+
api.redial(getDialogSpec(isVisible, api.getData()));
|
|
946
859
|
};
|
|
947
|
-
|
|
860
|
+
const focusButtonIfRequired = (api, name) => {
|
|
948
861
|
if (global$2.browser.isSafari() && global$2.deviceType.isTouch() && (name === 'find' || name === 'replace' || name === 'replaceall')) {
|
|
949
862
|
api.focus(name);
|
|
950
863
|
}
|
|
951
864
|
};
|
|
952
|
-
|
|
865
|
+
const reset = api => {
|
|
953
866
|
done(editor, currentSearchState, false);
|
|
954
867
|
disableAll(api, true);
|
|
955
868
|
updateButtonStates(api);
|
|
956
869
|
};
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
870
|
+
const doFind = api => {
|
|
871
|
+
const data = api.getData();
|
|
872
|
+
const last = currentSearchState.get();
|
|
960
873
|
if (!data.findtext.length) {
|
|
961
874
|
reset(api);
|
|
962
875
|
return;
|
|
@@ -964,63 +877,75 @@
|
|
|
964
877
|
if (last.text === data.findtext && last.matchCase === data.matchcase && last.wholeWord === data.wholewords) {
|
|
965
878
|
next(editor, currentSearchState);
|
|
966
879
|
} else {
|
|
967
|
-
|
|
880
|
+
const count = find(editor, currentSearchState, data.findtext, data.matchcase, data.wholewords, data.inselection);
|
|
968
881
|
if (count <= 0) {
|
|
969
|
-
|
|
882
|
+
toggleNotFoundAlert(true, api);
|
|
970
883
|
}
|
|
971
884
|
disableAll(api, count === 0);
|
|
972
885
|
}
|
|
973
886
|
updateButtonStates(api);
|
|
974
887
|
};
|
|
975
|
-
|
|
976
|
-
|
|
888
|
+
const initialState = currentSearchState.get();
|
|
889
|
+
const initialData = {
|
|
977
890
|
findtext: selectedText,
|
|
978
891
|
replacetext: '',
|
|
979
892
|
wholewords: initialState.wholeWord,
|
|
980
893
|
matchcase: initialState.matchCase,
|
|
981
894
|
inselection: initialState.inSelection
|
|
982
895
|
};
|
|
983
|
-
|
|
896
|
+
const getPanelItems = error => {
|
|
897
|
+
const items = [
|
|
898
|
+
{
|
|
899
|
+
type: 'bar',
|
|
900
|
+
items: [
|
|
901
|
+
{
|
|
902
|
+
type: 'input',
|
|
903
|
+
name: 'findtext',
|
|
904
|
+
placeholder: 'Find',
|
|
905
|
+
maximized: true,
|
|
906
|
+
inputMode: 'search'
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
type: 'button',
|
|
910
|
+
name: 'prev',
|
|
911
|
+
text: 'Previous',
|
|
912
|
+
icon: 'action-prev',
|
|
913
|
+
enabled: false,
|
|
914
|
+
borderless: true
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
type: 'button',
|
|
918
|
+
name: 'next',
|
|
919
|
+
text: 'Next',
|
|
920
|
+
icon: 'action-next',
|
|
921
|
+
enabled: false,
|
|
922
|
+
borderless: true
|
|
923
|
+
}
|
|
924
|
+
]
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
type: 'input',
|
|
928
|
+
name: 'replacetext',
|
|
929
|
+
placeholder: 'Replace with',
|
|
930
|
+
inputMode: 'search'
|
|
931
|
+
}
|
|
932
|
+
];
|
|
933
|
+
if (error) {
|
|
934
|
+
items.push({
|
|
935
|
+
type: 'alertbanner',
|
|
936
|
+
level: 'error',
|
|
937
|
+
text: 'Could not find the specified string.',
|
|
938
|
+
icon: 'warning'
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
return items;
|
|
942
|
+
};
|
|
943
|
+
const getDialogSpec = (showNoMatchesAlertBanner, initialData) => ({
|
|
984
944
|
title: 'Find and Replace',
|
|
985
945
|
size: 'normal',
|
|
986
946
|
body: {
|
|
987
947
|
type: 'panel',
|
|
988
|
-
items:
|
|
989
|
-
{
|
|
990
|
-
type: 'bar',
|
|
991
|
-
items: [
|
|
992
|
-
{
|
|
993
|
-
type: 'input',
|
|
994
|
-
name: 'findtext',
|
|
995
|
-
placeholder: 'Find',
|
|
996
|
-
maximized: true,
|
|
997
|
-
inputMode: 'search'
|
|
998
|
-
},
|
|
999
|
-
{
|
|
1000
|
-
type: 'button',
|
|
1001
|
-
name: 'prev',
|
|
1002
|
-
text: 'Previous',
|
|
1003
|
-
icon: 'action-prev',
|
|
1004
|
-
disabled: true,
|
|
1005
|
-
borderless: true
|
|
1006
|
-
},
|
|
1007
|
-
{
|
|
1008
|
-
type: 'button',
|
|
1009
|
-
name: 'next',
|
|
1010
|
-
text: 'Next',
|
|
1011
|
-
icon: 'action-next',
|
|
1012
|
-
disabled: true,
|
|
1013
|
-
borderless: true
|
|
1014
|
-
}
|
|
1015
|
-
]
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
type: 'input',
|
|
1019
|
-
name: 'replacetext',
|
|
1020
|
-
placeholder: 'Replace with',
|
|
1021
|
-
inputMode: 'search'
|
|
1022
|
-
}
|
|
1023
|
-
]
|
|
948
|
+
items: getPanelItems(showNoMatchesAlertBanner)
|
|
1024
949
|
},
|
|
1025
950
|
buttons: [
|
|
1026
951
|
{
|
|
@@ -1057,23 +982,26 @@
|
|
|
1057
982
|
type: 'custom',
|
|
1058
983
|
name: 'replace',
|
|
1059
984
|
text: 'Replace',
|
|
1060
|
-
|
|
985
|
+
enabled: false
|
|
1061
986
|
},
|
|
1062
987
|
{
|
|
1063
988
|
type: 'custom',
|
|
1064
989
|
name: 'replaceall',
|
|
1065
990
|
text: 'Replace all',
|
|
1066
|
-
|
|
991
|
+
enabled: false
|
|
1067
992
|
}
|
|
1068
993
|
],
|
|
1069
|
-
initialData
|
|
1070
|
-
onChange:
|
|
994
|
+
initialData,
|
|
995
|
+
onChange: (api, details) => {
|
|
996
|
+
if (showNoMatchesAlertBanner) {
|
|
997
|
+
toggleNotFoundAlert(false, api);
|
|
998
|
+
}
|
|
1071
999
|
if (details.name === 'findtext' && currentSearchState.get().count > 0) {
|
|
1072
1000
|
reset(api);
|
|
1073
1001
|
}
|
|
1074
1002
|
},
|
|
1075
|
-
onAction:
|
|
1076
|
-
|
|
1003
|
+
onAction: (api, details) => {
|
|
1004
|
+
const data = api.getData();
|
|
1077
1005
|
switch (details.name) {
|
|
1078
1006
|
case 'find':
|
|
1079
1007
|
doFind(api);
|
|
@@ -1100,37 +1028,36 @@
|
|
|
1100
1028
|
case 'matchcase':
|
|
1101
1029
|
case 'wholewords':
|
|
1102
1030
|
case 'inselection':
|
|
1031
|
+
toggleNotFoundAlert(false, api);
|
|
1103
1032
|
updateSearchState(api);
|
|
1104
1033
|
reset(api);
|
|
1105
1034
|
break;
|
|
1106
1035
|
}
|
|
1107
1036
|
focusButtonIfRequired(api, details.name);
|
|
1108
1037
|
},
|
|
1109
|
-
onSubmit:
|
|
1038
|
+
onSubmit: api => {
|
|
1110
1039
|
doFind(api);
|
|
1111
1040
|
focusButtonIfRequired(api, 'find');
|
|
1112
1041
|
},
|
|
1113
|
-
onClose:
|
|
1042
|
+
onClose: () => {
|
|
1114
1043
|
editor.focus();
|
|
1115
1044
|
done(editor, currentSearchState);
|
|
1116
1045
|
editor.undoManager.add();
|
|
1117
1046
|
}
|
|
1118
|
-
};
|
|
1119
|
-
dialogApi.set(editor.windowManager.open(
|
|
1047
|
+
});
|
|
1048
|
+
dialogApi.set(editor.windowManager.open(getDialogSpec(false, initialData), { inline: 'toolbar' }));
|
|
1120
1049
|
};
|
|
1121
1050
|
|
|
1122
|
-
|
|
1123
|
-
editor.addCommand('SearchReplace',
|
|
1051
|
+
const register$1 = (editor, currentSearchState) => {
|
|
1052
|
+
editor.addCommand('SearchReplace', () => {
|
|
1124
1053
|
open(editor, currentSearchState);
|
|
1125
1054
|
});
|
|
1126
1055
|
};
|
|
1127
1056
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
open(editor, currentSearchState);
|
|
1131
|
-
};
|
|
1057
|
+
const showDialog = (editor, currentSearchState) => () => {
|
|
1058
|
+
open(editor, currentSearchState);
|
|
1132
1059
|
};
|
|
1133
|
-
|
|
1060
|
+
const register = (editor, currentSearchState) => {
|
|
1134
1061
|
editor.ui.registry.addMenuItem('searchreplace', {
|
|
1135
1062
|
text: 'Find and replace...',
|
|
1136
1063
|
shortcut: 'Meta+F',
|
|
@@ -1140,14 +1067,15 @@
|
|
|
1140
1067
|
editor.ui.registry.addButton('searchreplace', {
|
|
1141
1068
|
tooltip: 'Find and replace',
|
|
1142
1069
|
onAction: showDialog(editor, currentSearchState),
|
|
1143
|
-
icon: 'search'
|
|
1070
|
+
icon: 'search',
|
|
1071
|
+
shortcut: 'Meta+F'
|
|
1144
1072
|
});
|
|
1145
1073
|
editor.shortcuts.add('Meta+F', '', showDialog(editor, currentSearchState));
|
|
1146
1074
|
};
|
|
1147
1075
|
|
|
1148
|
-
|
|
1149
|
-
global$3.add('searchreplace',
|
|
1150
|
-
|
|
1076
|
+
var Plugin = () => {
|
|
1077
|
+
global$3.add('searchreplace', editor => {
|
|
1078
|
+
const currentSearchState = Cell({
|
|
1151
1079
|
index: -1,
|
|
1152
1080
|
count: 0,
|
|
1153
1081
|
text: '',
|
|
@@ -1159,8 +1087,8 @@
|
|
|
1159
1087
|
register(editor, currentSearchState);
|
|
1160
1088
|
return get(editor, currentSearchState);
|
|
1161
1089
|
});
|
|
1162
|
-
}
|
|
1090
|
+
};
|
|
1163
1091
|
|
|
1164
1092
|
Plugin();
|
|
1165
1093
|
|
|
1166
|
-
}()
|
|
1094
|
+
})();
|