@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,188 +1,180 @@
|
|
|
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
|
-
var global
|
|
22
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const get$2 = toggleState => {
|
|
25
|
+
const isEnabled = () => {
|
|
30
26
|
return toggleState.get();
|
|
31
27
|
};
|
|
32
|
-
return { isEnabled
|
|
28
|
+
return { isEnabled };
|
|
33
29
|
};
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
return editor.
|
|
31
|
+
const fireVisualChars = (editor, state) => {
|
|
32
|
+
return editor.dispatch('VisualChars', { state });
|
|
37
33
|
};
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
var
|
|
35
|
+
const hasProto = (v, constructor, predicate) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (predicate(v, constructor.prototype)) {
|
|
38
|
+
return true;
|
|
39
|
+
} else {
|
|
40
|
+
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const typeOf = x => {
|
|
44
|
+
const t = typeof x;
|
|
41
45
|
if (x === null) {
|
|
42
46
|
return 'null';
|
|
43
|
-
} else if (t === 'object' &&
|
|
47
|
+
} else if (t === 'object' && Array.isArray(x)) {
|
|
44
48
|
return 'array';
|
|
45
|
-
} else if (t === 'object' && (String
|
|
49
|
+
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
46
50
|
return 'string';
|
|
47
51
|
} else {
|
|
48
52
|
return t;
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var isString = isType$1('string');
|
|
62
|
-
var isBoolean = isSimpleType('boolean');
|
|
63
|
-
var isNumber = isSimpleType('number');
|
|
64
|
-
|
|
65
|
-
var noop = function () {
|
|
66
|
-
};
|
|
67
|
-
var constant = function (value) {
|
|
68
|
-
return function () {
|
|
69
|
-
return value;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
var identity = function (x) {
|
|
73
|
-
return x;
|
|
74
|
-
};
|
|
75
|
-
var never = constant(false);
|
|
76
|
-
var always = constant(true);
|
|
55
|
+
const isType$1 = type => value => typeOf(value) === type;
|
|
56
|
+
const isSimpleType = type => value => typeof value === type;
|
|
57
|
+
const eq = t => a => t === a;
|
|
58
|
+
const isString = isType$1('string');
|
|
59
|
+
const isObject = isType$1('object');
|
|
60
|
+
const isNull = eq(null);
|
|
61
|
+
const isBoolean = isSimpleType('boolean');
|
|
62
|
+
const isNullable = a => a === null || a === undefined;
|
|
63
|
+
const isNonNullable = a => !isNullable(a);
|
|
64
|
+
const isNumber = isSimpleType('number');
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
getOrDie: function (msg) {
|
|
95
|
-
throw new Error(msg || 'error: getOrDie called on none.');
|
|
96
|
-
},
|
|
97
|
-
getOrNull: constant(null),
|
|
98
|
-
getOrUndefined: constant(undefined),
|
|
99
|
-
or: id,
|
|
100
|
-
orThunk: call,
|
|
101
|
-
map: none,
|
|
102
|
-
each: noop,
|
|
103
|
-
bind: none,
|
|
104
|
-
exists: never,
|
|
105
|
-
forall: always,
|
|
106
|
-
filter: function () {
|
|
107
|
-
return none();
|
|
108
|
-
},
|
|
109
|
-
toArray: function () {
|
|
110
|
-
return [];
|
|
111
|
-
},
|
|
112
|
-
toString: constant('none()')
|
|
113
|
-
};
|
|
114
|
-
return me;
|
|
115
|
-
}();
|
|
116
|
-
var some = function (a) {
|
|
117
|
-
var constant_a = constant(a);
|
|
118
|
-
var self = function () {
|
|
119
|
-
return me;
|
|
120
|
-
};
|
|
121
|
-
var bind = function (f) {
|
|
122
|
-
return f(a);
|
|
123
|
-
};
|
|
124
|
-
var me = {
|
|
125
|
-
fold: function (n, s) {
|
|
126
|
-
return s(a);
|
|
127
|
-
},
|
|
128
|
-
isSome: always,
|
|
129
|
-
isNone: never,
|
|
130
|
-
getOr: constant_a,
|
|
131
|
-
getOrThunk: constant_a,
|
|
132
|
-
getOrDie: constant_a,
|
|
133
|
-
getOrNull: constant_a,
|
|
134
|
-
getOrUndefined: constant_a,
|
|
135
|
-
or: self,
|
|
136
|
-
orThunk: self,
|
|
137
|
-
map: function (f) {
|
|
138
|
-
return some(f(a));
|
|
139
|
-
},
|
|
140
|
-
each: function (f) {
|
|
141
|
-
f(a);
|
|
142
|
-
},
|
|
143
|
-
bind: bind,
|
|
144
|
-
exists: bind,
|
|
145
|
-
forall: bind,
|
|
146
|
-
filter: function (f) {
|
|
147
|
-
return f(a) ? me : NONE;
|
|
148
|
-
},
|
|
149
|
-
toArray: function () {
|
|
150
|
-
return [a];
|
|
151
|
-
},
|
|
152
|
-
toString: function () {
|
|
153
|
-
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();
|
|
154
82
|
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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);
|
|
166
158
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
for (
|
|
171
|
-
|
|
159
|
+
const map = (xs, f) => {
|
|
160
|
+
const len = xs.length;
|
|
161
|
+
const r = new Array(len);
|
|
162
|
+
for (let i = 0; i < len; i++) {
|
|
163
|
+
const x = xs[i];
|
|
172
164
|
r[i] = f(x, i);
|
|
173
165
|
}
|
|
174
166
|
return r;
|
|
175
167
|
};
|
|
176
|
-
|
|
177
|
-
for (
|
|
178
|
-
|
|
168
|
+
const each$1 = (xs, f) => {
|
|
169
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
170
|
+
const x = xs[i];
|
|
179
171
|
f(x, i);
|
|
180
172
|
}
|
|
181
173
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
for (
|
|
185
|
-
|
|
174
|
+
const filter = (xs, pred) => {
|
|
175
|
+
const r = [];
|
|
176
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
177
|
+
const x = xs[i];
|
|
186
178
|
if (pred(x, i)) {
|
|
187
179
|
r.push(x);
|
|
188
180
|
}
|
|
@@ -190,34 +182,61 @@
|
|
|
190
182
|
return r;
|
|
191
183
|
};
|
|
192
184
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
for (
|
|
197
|
-
|
|
198
|
-
|
|
185
|
+
const keys = Object.keys;
|
|
186
|
+
const each = (obj, f) => {
|
|
187
|
+
const props = keys(obj);
|
|
188
|
+
for (let k = 0, len = props.length; k < len; k++) {
|
|
189
|
+
const i = props[k];
|
|
190
|
+
const x = obj[i];
|
|
199
191
|
f(x, i);
|
|
200
192
|
}
|
|
201
193
|
};
|
|
202
194
|
|
|
203
|
-
typeof window !== 'undefined' ? window : Function('return this;')();
|
|
195
|
+
const Global = typeof window !== 'undefined' ? window : Function('return this;')();
|
|
204
196
|
|
|
205
|
-
|
|
197
|
+
const path = (parts, scope) => {
|
|
198
|
+
let o = scope !== undefined && scope !== null ? scope : Global;
|
|
199
|
+
for (let i = 0; i < parts.length && o !== undefined && o !== null; ++i) {
|
|
200
|
+
o = o[parts[i]];
|
|
201
|
+
}
|
|
202
|
+
return o;
|
|
203
|
+
};
|
|
204
|
+
const resolve = (p, scope) => {
|
|
205
|
+
const parts = p.split('.');
|
|
206
|
+
return path(parts, scope);
|
|
207
|
+
};
|
|
206
208
|
|
|
207
|
-
|
|
208
|
-
return
|
|
209
|
+
const unsafe = (name, scope) => {
|
|
210
|
+
return resolve(name, scope);
|
|
211
|
+
};
|
|
212
|
+
const getOrDie = (name, scope) => {
|
|
213
|
+
const actual = unsafe(name, scope);
|
|
214
|
+
if (actual === undefined || actual === null) {
|
|
215
|
+
throw new Error(name + ' not available on this browser');
|
|
216
|
+
}
|
|
217
|
+
return actual;
|
|
209
218
|
};
|
|
210
|
-
|
|
211
|
-
|
|
219
|
+
|
|
220
|
+
const getPrototypeOf = Object.getPrototypeOf;
|
|
221
|
+
const sandHTMLElement = scope => {
|
|
222
|
+
return getOrDie('HTMLElement', scope);
|
|
212
223
|
};
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
};
|
|
224
|
+
const isPrototypeOf = x => {
|
|
225
|
+
const scope = resolve('ownerDocument.defaultView', x);
|
|
226
|
+
return isObject(x) && (sandHTMLElement(scope).prototype.isPrototypeOf(x) || /^HTML\w*Element$/.test(getPrototypeOf(x).constructor.name));
|
|
217
227
|
};
|
|
218
|
-
var isText = isType(TEXT);
|
|
219
228
|
|
|
220
|
-
|
|
229
|
+
const ELEMENT = 1;
|
|
230
|
+
const TEXT = 3;
|
|
231
|
+
|
|
232
|
+
const type = element => element.dom.nodeType;
|
|
233
|
+
const value = element => element.dom.nodeValue;
|
|
234
|
+
const isType = t => element => type(element) === t;
|
|
235
|
+
const isHTMLElement = element => isElement(element) && isPrototypeOf(element.dom);
|
|
236
|
+
const isElement = isType(ELEMENT);
|
|
237
|
+
const isText = isType(TEXT);
|
|
238
|
+
|
|
239
|
+
const rawSet = (dom, key, value) => {
|
|
221
240
|
if (isString(value) || isBoolean(value) || isNumber(value)) {
|
|
222
241
|
dom.setAttribute(key, value + '');
|
|
223
242
|
} else {
|
|
@@ -225,31 +244,29 @@
|
|
|
225
244
|
throw new Error('Attribute value was not simple');
|
|
226
245
|
}
|
|
227
246
|
};
|
|
228
|
-
|
|
247
|
+
const set = (element, key, value) => {
|
|
229
248
|
rawSet(element.dom, key, value);
|
|
230
249
|
};
|
|
231
|
-
|
|
232
|
-
|
|
250
|
+
const get$1 = (element, key) => {
|
|
251
|
+
const v = element.dom.getAttribute(key);
|
|
233
252
|
return v === null ? undefined : v;
|
|
234
253
|
};
|
|
235
|
-
|
|
254
|
+
const remove$3 = (element, key) => {
|
|
236
255
|
element.dom.removeAttribute(key);
|
|
237
256
|
};
|
|
238
257
|
|
|
239
|
-
|
|
240
|
-
|
|
258
|
+
const read = (element, attr) => {
|
|
259
|
+
const value = get$1(element, attr);
|
|
241
260
|
return value === undefined || value === '' ? [] : value.split(' ');
|
|
242
261
|
};
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
262
|
+
const add$2 = (element, attr, id) => {
|
|
263
|
+
const old = read(element, attr);
|
|
264
|
+
const nu = old.concat([id]);
|
|
246
265
|
set(element, attr, nu.join(' '));
|
|
247
266
|
return true;
|
|
248
267
|
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
return v !== id;
|
|
252
|
-
});
|
|
268
|
+
const remove$2 = (element, attr, id) => {
|
|
269
|
+
const nu = filter(read(element, attr), v => v !== id);
|
|
253
270
|
if (nu.length > 0) {
|
|
254
271
|
set(element, attr, nu.join(' '));
|
|
255
272
|
} else {
|
|
@@ -258,35 +275,27 @@
|
|
|
258
275
|
return false;
|
|
259
276
|
};
|
|
260
277
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return read(element, 'class');
|
|
266
|
-
};
|
|
267
|
-
var add$1 = function (element, clazz) {
|
|
268
|
-
return add$2(element, 'class', clazz);
|
|
269
|
-
};
|
|
270
|
-
var remove$1 = function (element, clazz) {
|
|
271
|
-
return remove$2(element, 'class', clazz);
|
|
272
|
-
};
|
|
278
|
+
const supports = element => element.dom.classList !== undefined;
|
|
279
|
+
const get = element => read(element, 'class');
|
|
280
|
+
const add$1 = (element, clazz) => add$2(element, 'class', clazz);
|
|
281
|
+
const remove$1 = (element, clazz) => remove$2(element, 'class', clazz);
|
|
273
282
|
|
|
274
|
-
|
|
283
|
+
const add = (element, clazz) => {
|
|
275
284
|
if (supports(element)) {
|
|
276
285
|
element.dom.classList.add(clazz);
|
|
277
286
|
} else {
|
|
278
287
|
add$1(element, clazz);
|
|
279
288
|
}
|
|
280
289
|
};
|
|
281
|
-
|
|
282
|
-
|
|
290
|
+
const cleanClass = element => {
|
|
291
|
+
const classList = supports(element) ? element.dom.classList : get(element);
|
|
283
292
|
if (classList.length === 0) {
|
|
284
293
|
remove$3(element, 'class');
|
|
285
294
|
}
|
|
286
295
|
};
|
|
287
|
-
|
|
296
|
+
const remove = (element, clazz) => {
|
|
288
297
|
if (supports(element)) {
|
|
289
|
-
|
|
298
|
+
const classList = element.dom.classList;
|
|
290
299
|
classList.remove(clazz);
|
|
291
300
|
} else {
|
|
292
301
|
remove$1(element, clazz);
|
|
@@ -294,57 +303,56 @@
|
|
|
294
303
|
cleanClass(element);
|
|
295
304
|
};
|
|
296
305
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
306
|
+
const fromHtml = (html, scope) => {
|
|
307
|
+
const doc = scope || document;
|
|
308
|
+
const div = doc.createElement('div');
|
|
300
309
|
div.innerHTML = html;
|
|
301
310
|
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
const message = 'HTML does not have a single root node';
|
|
312
|
+
console.error(message, html);
|
|
313
|
+
throw new Error(message);
|
|
304
314
|
}
|
|
305
315
|
return fromDom(div.childNodes[0]);
|
|
306
316
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
317
|
+
const fromTag = (tag, scope) => {
|
|
318
|
+
const doc = scope || document;
|
|
319
|
+
const node = doc.createElement(tag);
|
|
310
320
|
return fromDom(node);
|
|
311
321
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
322
|
+
const fromText = (text, scope) => {
|
|
323
|
+
const doc = scope || document;
|
|
324
|
+
const node = doc.createTextNode(text);
|
|
315
325
|
return fromDom(node);
|
|
316
326
|
};
|
|
317
|
-
|
|
327
|
+
const fromDom = node => {
|
|
318
328
|
if (node === null || node === undefined) {
|
|
319
329
|
throw new Error('Node cannot be null or undefined');
|
|
320
330
|
}
|
|
321
331
|
return { dom: node };
|
|
322
332
|
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
fromDom: fromDom,
|
|
331
|
-
fromPoint: fromPoint
|
|
333
|
+
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
334
|
+
const SugarElement = {
|
|
335
|
+
fromHtml,
|
|
336
|
+
fromTag,
|
|
337
|
+
fromText,
|
|
338
|
+
fromDom,
|
|
339
|
+
fromPoint
|
|
332
340
|
};
|
|
333
341
|
|
|
334
|
-
|
|
342
|
+
const charMap = {
|
|
335
343
|
'\xA0': 'nbsp',
|
|
336
344
|
'\xAD': 'shy'
|
|
337
345
|
};
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
each(charMap,
|
|
346
|
+
const charMapToRegExp = (charMap, global) => {
|
|
347
|
+
let regExp = '';
|
|
348
|
+
each(charMap, (_value, key) => {
|
|
341
349
|
regExp += key;
|
|
342
350
|
});
|
|
343
351
|
return new RegExp('[' + regExp + ']', global ? 'g' : '');
|
|
344
352
|
};
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
each(charMap,
|
|
353
|
+
const charMapToSelector = charMap => {
|
|
354
|
+
let selector = '';
|
|
355
|
+
each(charMap, value => {
|
|
348
356
|
if (selector) {
|
|
349
357
|
selector += ',';
|
|
350
358
|
}
|
|
@@ -352,66 +360,78 @@
|
|
|
352
360
|
});
|
|
353
361
|
return selector;
|
|
354
362
|
};
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
363
|
+
const regExp = charMapToRegExp(charMap);
|
|
364
|
+
const regExpGlobal = charMapToRegExp(charMap, true);
|
|
365
|
+
const selector = charMapToSelector(charMap);
|
|
366
|
+
const nbspClass = 'mce-nbsp';
|
|
359
367
|
|
|
360
|
-
|
|
361
|
-
return '<span data-mce-bogus="1" class="mce-' + charMap[value] + '">' + value + '</span>';
|
|
362
|
-
};
|
|
368
|
+
const getRaw = element => element.dom.contentEditable;
|
|
363
369
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
const wrapCharWithSpan = value => '<span data-mce-bogus="1" class="mce-' + charMap[value] + '">' + value + '</span>';
|
|
371
|
+
|
|
372
|
+
const isWrappedNbsp = node => node.nodeName.toLowerCase() === 'span' && node.classList.contains('mce-nbsp-wrap');
|
|
373
|
+
const isMatch = n => {
|
|
374
|
+
const value$1 = value(n);
|
|
375
|
+
return isText(n) && isString(value$1) && regExp.test(value$1);
|
|
376
|
+
};
|
|
377
|
+
const isContentEditableFalse = node => isHTMLElement(node) && getRaw(node) === 'false';
|
|
378
|
+
const isChildEditable = (node, currentState) => {
|
|
379
|
+
if (isHTMLElement(node) && !isWrappedNbsp(node.dom)) {
|
|
380
|
+
const value = getRaw(node);
|
|
381
|
+
if (value === 'true') {
|
|
382
|
+
return true;
|
|
383
|
+
} else if (value === 'false') {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return currentState;
|
|
388
|
+
};
|
|
389
|
+
const filterEditableDescendants = (scope, predicate, editable) => {
|
|
390
|
+
let result = [];
|
|
391
|
+
const dom = scope.dom;
|
|
392
|
+
const children = map(dom.childNodes, SugarElement.fromDom);
|
|
393
|
+
const isEditable = node => isWrappedNbsp(node.dom) || !isContentEditableFalse(node);
|
|
394
|
+
each$1(children, x => {
|
|
395
|
+
if (editable && isEditable(x) && predicate(x)) {
|
|
374
396
|
result = result.concat([x]);
|
|
375
397
|
}
|
|
376
|
-
result = result.concat(
|
|
398
|
+
result = result.concat(filterEditableDescendants(x, predicate, isChildEditable(x, editable)));
|
|
377
399
|
});
|
|
378
400
|
return result;
|
|
379
401
|
};
|
|
380
|
-
|
|
402
|
+
const findParentElm = (elm, rootElm) => {
|
|
381
403
|
while (elm.parentNode) {
|
|
382
404
|
if (elm.parentNode === rootElm) {
|
|
383
|
-
return
|
|
405
|
+
return rootElm;
|
|
384
406
|
}
|
|
385
407
|
elm = elm.parentNode;
|
|
386
408
|
}
|
|
409
|
+
return undefined;
|
|
387
410
|
};
|
|
388
|
-
|
|
389
|
-
return text.replace(regExpGlobal, wrapCharWithSpan);
|
|
390
|
-
};
|
|
411
|
+
const replaceWithSpans = text => text.replace(regExpGlobal, wrapCharWithSpan);
|
|
391
412
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
var parent = n.dom.parentNode;
|
|
413
|
+
const show = (editor, rootElm) => {
|
|
414
|
+
const dom = editor.dom;
|
|
415
|
+
const nodeList = filterEditableDescendants(SugarElement.fromDom(rootElm), isMatch, editor.dom.isEditable(rootElm));
|
|
416
|
+
each$1(nodeList, n => {
|
|
417
|
+
var _a;
|
|
418
|
+
const parent = n.dom.parentNode;
|
|
399
419
|
if (isWrappedNbsp(parent)) {
|
|
400
420
|
add(SugarElement.fromDom(parent), nbspClass);
|
|
401
421
|
} else {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
422
|
+
const withSpans = replaceWithSpans(dom.encode((_a = value(n)) !== null && _a !== void 0 ? _a : ''));
|
|
423
|
+
const div = dom.create('div', {}, withSpans);
|
|
424
|
+
let node;
|
|
405
425
|
while (node = div.lastChild) {
|
|
406
|
-
|
|
426
|
+
dom.insertAfter(node, n.dom);
|
|
407
427
|
}
|
|
408
428
|
editor.dom.remove(n.dom);
|
|
409
429
|
}
|
|
410
430
|
});
|
|
411
431
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
each$1(nodeList,
|
|
432
|
+
const hide = (editor, rootElm) => {
|
|
433
|
+
const nodeList = editor.dom.select(selector, rootElm);
|
|
434
|
+
each$1(nodeList, node => {
|
|
415
435
|
if (isWrappedNbsp(node)) {
|
|
416
436
|
remove(SugarElement.fromDom(node), nbspClass);
|
|
417
437
|
} else {
|
|
@@ -419,108 +439,122 @@
|
|
|
419
439
|
}
|
|
420
440
|
});
|
|
421
441
|
};
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
442
|
+
const toggle = editor => {
|
|
443
|
+
const body = editor.getBody();
|
|
444
|
+
const bookmark = editor.selection.getBookmark();
|
|
445
|
+
let parentNode = findParentElm(editor.selection.getNode(), body);
|
|
426
446
|
parentNode = parentNode !== undefined ? parentNode : body;
|
|
427
447
|
hide(editor, parentNode);
|
|
428
448
|
show(editor, parentNode);
|
|
429
449
|
editor.selection.moveToBookmark(bookmark);
|
|
430
450
|
};
|
|
431
451
|
|
|
432
|
-
|
|
452
|
+
const applyVisualChars = (editor, toggleState) => {
|
|
433
453
|
fireVisualChars(editor, toggleState.get());
|
|
434
|
-
|
|
454
|
+
const body = editor.getBody();
|
|
435
455
|
if (toggleState.get() === true) {
|
|
436
456
|
show(editor, body);
|
|
437
457
|
} else {
|
|
438
458
|
hide(editor, body);
|
|
439
459
|
}
|
|
440
460
|
};
|
|
441
|
-
|
|
461
|
+
const toggleVisualChars = (editor, toggleState) => {
|
|
442
462
|
toggleState.set(!toggleState.get());
|
|
443
|
-
|
|
463
|
+
const bookmark = editor.selection.getBookmark();
|
|
444
464
|
applyVisualChars(editor, toggleState);
|
|
445
465
|
editor.selection.moveToBookmark(bookmark);
|
|
446
466
|
};
|
|
447
467
|
|
|
448
|
-
|
|
449
|
-
editor.addCommand('mceVisualChars',
|
|
468
|
+
const register$2 = (editor, toggleState) => {
|
|
469
|
+
editor.addCommand('mceVisualChars', () => {
|
|
450
470
|
toggleVisualChars(editor, toggleState);
|
|
451
471
|
});
|
|
452
472
|
};
|
|
453
473
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
474
|
+
const option = name => editor => editor.options.get(name);
|
|
475
|
+
const register$1 = editor => {
|
|
476
|
+
const registerOption = editor.options.register;
|
|
477
|
+
registerOption('visualchars_default_state', {
|
|
478
|
+
processor: 'boolean',
|
|
479
|
+
default: false
|
|
480
|
+
});
|
|
459
481
|
};
|
|
482
|
+
const isEnabledByDefault = option('visualchars_default_state');
|
|
460
483
|
|
|
461
|
-
|
|
462
|
-
editor.on('init',
|
|
484
|
+
const setup$1 = (editor, toggleState) => {
|
|
485
|
+
editor.on('init', () => {
|
|
463
486
|
applyVisualChars(editor, toggleState);
|
|
464
487
|
});
|
|
465
488
|
};
|
|
466
489
|
|
|
467
|
-
|
|
490
|
+
const first = (fn, rate) => {
|
|
491
|
+
let timer = null;
|
|
492
|
+
const cancel = () => {
|
|
493
|
+
if (!isNull(timer)) {
|
|
494
|
+
clearTimeout(timer);
|
|
495
|
+
timer = null;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
const throttle = (...args) => {
|
|
499
|
+
if (isNull(timer)) {
|
|
500
|
+
timer = setTimeout(() => {
|
|
501
|
+
timer = null;
|
|
502
|
+
fn.apply(null, args);
|
|
503
|
+
}, rate);
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
return {
|
|
507
|
+
cancel,
|
|
508
|
+
throttle
|
|
509
|
+
};
|
|
510
|
+
};
|
|
468
511
|
|
|
469
|
-
|
|
470
|
-
|
|
512
|
+
const setup = (editor, toggleState) => {
|
|
513
|
+
const debouncedToggle = first(() => {
|
|
471
514
|
toggle(editor);
|
|
472
515
|
}, 300);
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
editor.on('remove', debouncedToggle.stop);
|
|
516
|
+
editor.on('keydown', e => {
|
|
517
|
+
if (toggleState.get() === true) {
|
|
518
|
+
e.keyCode === 13 ? toggle(editor) : debouncedToggle.throttle();
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
editor.on('remove', debouncedToggle.cancel);
|
|
481
522
|
};
|
|
482
523
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return editor.off('VisualChars', editorEventCallback);
|
|
492
|
-
};
|
|
493
|
-
};
|
|
494
|
-
};
|
|
495
|
-
var register = function (editor, toggleState) {
|
|
496
|
-
var onAction = function () {
|
|
497
|
-
return editor.execCommand('mceVisualChars');
|
|
498
|
-
};
|
|
524
|
+
const toggleActiveState = (editor, enabledStated) => api => {
|
|
525
|
+
api.setActive(enabledStated.get());
|
|
526
|
+
const editorEventCallback = e => api.setActive(e.state);
|
|
527
|
+
editor.on('VisualChars', editorEventCallback);
|
|
528
|
+
return () => editor.off('VisualChars', editorEventCallback);
|
|
529
|
+
};
|
|
530
|
+
const register = (editor, toggleState) => {
|
|
531
|
+
const onAction = () => editor.execCommand('mceVisualChars');
|
|
499
532
|
editor.ui.registry.addToggleButton('visualchars', {
|
|
500
533
|
tooltip: 'Show invisible characters',
|
|
501
534
|
icon: 'visualchars',
|
|
502
|
-
onAction
|
|
535
|
+
onAction,
|
|
503
536
|
onSetup: toggleActiveState(editor, toggleState)
|
|
504
537
|
});
|
|
505
538
|
editor.ui.registry.addToggleMenuItem('visualchars', {
|
|
506
539
|
text: 'Show invisible characters',
|
|
507
540
|
icon: 'visualchars',
|
|
508
|
-
onAction
|
|
541
|
+
onAction,
|
|
509
542
|
onSetup: toggleActiveState(editor, toggleState)
|
|
510
543
|
});
|
|
511
544
|
};
|
|
512
545
|
|
|
513
|
-
|
|
514
|
-
global
|
|
515
|
-
|
|
516
|
-
|
|
546
|
+
var Plugin = () => {
|
|
547
|
+
global.add('visualchars', editor => {
|
|
548
|
+
register$1(editor);
|
|
549
|
+
const toggleState = Cell(isEnabledByDefault(editor));
|
|
550
|
+
register$2(editor, toggleState);
|
|
517
551
|
register(editor, toggleState);
|
|
518
552
|
setup(editor, toggleState);
|
|
519
553
|
setup$1(editor, toggleState);
|
|
520
554
|
return get$2(toggleState);
|
|
521
555
|
});
|
|
522
|
-
}
|
|
556
|
+
};
|
|
523
557
|
|
|
524
558
|
Plugin();
|
|
525
559
|
|
|
526
|
-
}()
|
|
560
|
+
})();
|