@dangl/angular-material-shared 2.5.1-beta0012 → 2.5.1-beta0018
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,119 +1,168 @@
|
|
|
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
|
-
var global$
|
|
8
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
const hasProto = (v, constructor, predicate) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (predicate(v, constructor.prototype)) {
|
|
13
|
+
return true;
|
|
14
|
+
} else {
|
|
15
|
+
return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const typeOf = x => {
|
|
19
|
+
const t = typeof x;
|
|
20
|
+
if (x === null) {
|
|
21
|
+
return 'null';
|
|
22
|
+
} else if (t === 'object' && Array.isArray(x)) {
|
|
23
|
+
return 'array';
|
|
24
|
+
} else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
|
|
25
|
+
return 'string';
|
|
26
|
+
} else {
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
21
29
|
};
|
|
30
|
+
const isType = type => value => typeOf(value) === type;
|
|
31
|
+
const isSimpleType = type => value => typeof value === type;
|
|
32
|
+
const isString = isType('string');
|
|
33
|
+
const isBoolean = isSimpleType('boolean');
|
|
34
|
+
const isNullable = a => a === null || a === undefined;
|
|
35
|
+
const isNonNullable = a => !isNullable(a);
|
|
36
|
+
const isFunction = isSimpleType('function');
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
const option = name => editor => editor.options.get(name);
|
|
39
|
+
const register = editor => {
|
|
40
|
+
const registerOption = editor.options.register;
|
|
41
|
+
const toolbarProcessor = defaultValue => value => {
|
|
42
|
+
const valid = isBoolean(value) || isString(value);
|
|
43
|
+
if (valid) {
|
|
44
|
+
if (isBoolean(value)) {
|
|
45
|
+
return {
|
|
46
|
+
value: value ? defaultValue : '',
|
|
47
|
+
valid
|
|
48
|
+
};
|
|
49
|
+
} else {
|
|
50
|
+
return {
|
|
51
|
+
value: value.trim(),
|
|
52
|
+
valid
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
return {
|
|
57
|
+
valid: false,
|
|
58
|
+
message: 'Must be a boolean or string.'
|
|
59
|
+
};
|
|
30
60
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
};
|
|
62
|
+
const defaultSelectionToolbar = 'bold italic | quicklink h2 h3 blockquote';
|
|
63
|
+
registerOption('quickbars_selection_toolbar', {
|
|
64
|
+
processor: toolbarProcessor(defaultSelectionToolbar),
|
|
65
|
+
default: defaultSelectionToolbar
|
|
66
|
+
});
|
|
67
|
+
const defaultInsertToolbar = 'quickimage quicktable';
|
|
68
|
+
registerOption('quickbars_insert_toolbar', {
|
|
69
|
+
processor: toolbarProcessor(defaultInsertToolbar),
|
|
70
|
+
default: defaultInsertToolbar
|
|
71
|
+
});
|
|
72
|
+
const defaultImageToolbar = 'alignleft aligncenter alignright';
|
|
73
|
+
registerOption('quickbars_image_toolbar', {
|
|
74
|
+
processor: toolbarProcessor(defaultImageToolbar),
|
|
75
|
+
default: defaultImageToolbar
|
|
76
|
+
});
|
|
36
77
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
78
|
+
const getTextSelectionToolbarItems = option('quickbars_selection_toolbar');
|
|
79
|
+
const getInsertToolbarItems = option('quickbars_insert_toolbar');
|
|
80
|
+
const getImageToolbarItems = option('quickbars_image_toolbar');
|
|
81
|
+
|
|
82
|
+
let unique = 0;
|
|
83
|
+
const generate = prefix => {
|
|
84
|
+
const date = new Date();
|
|
85
|
+
const time = date.getTime();
|
|
86
|
+
const random = Math.floor(Math.random() * 1000000000);
|
|
87
|
+
unique++;
|
|
88
|
+
return prefix + '_' + random + unique + String(time);
|
|
40
89
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var cellElm = editor.dom.select('td,th', tableElm);
|
|
47
|
-
editor.selection.setCursorLocation(cellElm[0], 0);
|
|
90
|
+
|
|
91
|
+
const insertTable = (editor, columns, rows) => {
|
|
92
|
+
editor.execCommand('mceInsertTable', false, {
|
|
93
|
+
rows,
|
|
94
|
+
columns
|
|
48
95
|
});
|
|
49
96
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var insertBlob = function (editor, base64, blob) {
|
|
54
|
-
var blobCache = editor.editorUpload.blobCache;
|
|
55
|
-
var blobInfo = blobCache.create(generate('mceu'), blob, base64);
|
|
97
|
+
const insertBlob = (editor, base64, blob) => {
|
|
98
|
+
const blobCache = editor.editorUpload.blobCache;
|
|
99
|
+
const blobInfo = blobCache.create(generate('mceu'), blob, base64);
|
|
56
100
|
blobCache.add(blobInfo);
|
|
57
101
|
editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
|
|
58
102
|
};
|
|
59
103
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var reader = new FileReader();
|
|
65
|
-
reader.onloadend = function () {
|
|
104
|
+
const blobToBase64 = blob => {
|
|
105
|
+
return new Promise(resolve => {
|
|
106
|
+
const reader = new FileReader();
|
|
107
|
+
reader.onloadend = () => {
|
|
66
108
|
resolve(reader.result.split(',')[1]);
|
|
67
109
|
};
|
|
68
110
|
reader.readAsDataURL(blob);
|
|
69
111
|
});
|
|
70
112
|
};
|
|
71
113
|
|
|
72
|
-
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
|
|
73
|
-
|
|
74
114
|
var global = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
|
75
115
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
116
|
+
const pickFile = editor => new Promise(resolve => {
|
|
117
|
+
let resolved = false;
|
|
118
|
+
const fileInput = document.createElement('input');
|
|
119
|
+
fileInput.type = 'file';
|
|
120
|
+
fileInput.accept = 'image/*';
|
|
121
|
+
fileInput.style.position = 'fixed';
|
|
122
|
+
fileInput.style.left = '0';
|
|
123
|
+
fileInput.style.top = '0';
|
|
124
|
+
fileInput.style.opacity = '0.001';
|
|
125
|
+
document.body.appendChild(fileInput);
|
|
126
|
+
const resolveFileInput = value => {
|
|
127
|
+
var _a;
|
|
128
|
+
if (!resolved) {
|
|
129
|
+
(_a = fileInput.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(fileInput);
|
|
130
|
+
resolved = true;
|
|
131
|
+
resolve(value);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const changeHandler = e => {
|
|
135
|
+
resolveFileInput(Array.prototype.slice.call(e.target.files));
|
|
136
|
+
};
|
|
137
|
+
fileInput.addEventListener('input', changeHandler);
|
|
138
|
+
fileInput.addEventListener('change', changeHandler);
|
|
139
|
+
const cancelHandler = e => {
|
|
140
|
+
const cleanup = () => {
|
|
141
|
+
resolveFileInput([]);
|
|
88
142
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
resolve([]);
|
|
93
|
-
fileInput.parentNode.removeChild(fileInput);
|
|
94
|
-
};
|
|
95
|
-
if (global$1.os.isAndroid() && e.type !== 'remove') {
|
|
96
|
-
global.setEditorTimeout(editor, cleanup, 0);
|
|
143
|
+
if (!resolved) {
|
|
144
|
+
if (e.type === 'focusin') {
|
|
145
|
+
global.setEditorTimeout(editor, cleanup, 1000);
|
|
97
146
|
} else {
|
|
98
147
|
cleanup();
|
|
99
148
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
149
|
+
}
|
|
150
|
+
editor.off('focusin remove', cancelHandler);
|
|
151
|
+
};
|
|
152
|
+
editor.on('focusin remove', cancelHandler);
|
|
153
|
+
fileInput.click();
|
|
154
|
+
});
|
|
106
155
|
|
|
107
|
-
|
|
156
|
+
const setupButtons = editor => {
|
|
108
157
|
editor.ui.registry.addButton('quickimage', {
|
|
109
158
|
icon: 'image',
|
|
110
159
|
tooltip: 'Insert image',
|
|
111
|
-
onAction:
|
|
112
|
-
pickFile(editor).then(
|
|
160
|
+
onAction: () => {
|
|
161
|
+
pickFile(editor).then(files => {
|
|
113
162
|
if (files.length > 0) {
|
|
114
|
-
|
|
115
|
-
blobToBase64(
|
|
116
|
-
insertBlob(editor, base64,
|
|
163
|
+
const blob = files[0];
|
|
164
|
+
blobToBase64(blob).then(base64 => {
|
|
165
|
+
insertBlob(editor, base64, blob);
|
|
117
166
|
});
|
|
118
167
|
}
|
|
119
168
|
});
|
|
@@ -122,149 +171,127 @@
|
|
|
122
171
|
editor.ui.registry.addButton('quicktable', {
|
|
123
172
|
icon: 'table',
|
|
124
173
|
tooltip: 'Insert table',
|
|
125
|
-
onAction:
|
|
174
|
+
onAction: () => {
|
|
126
175
|
insertTable(editor, 2, 2);
|
|
127
176
|
}
|
|
128
177
|
});
|
|
129
178
|
};
|
|
130
179
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (x === null) {
|
|
134
|
-
return 'null';
|
|
135
|
-
} else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
|
|
136
|
-
return 'array';
|
|
137
|
-
} else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
|
|
138
|
-
return 'string';
|
|
139
|
-
} else {
|
|
140
|
-
return t;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
var isType = function (type) {
|
|
144
|
-
return function (value) {
|
|
145
|
-
return typeOf(value) === type;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
var isSimpleType = function (type) {
|
|
149
|
-
return function (value) {
|
|
150
|
-
return typeof value === type;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
var eq = function (t) {
|
|
154
|
-
return function (a) {
|
|
155
|
-
return t === a;
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
var isString = isType('string');
|
|
159
|
-
var isObject = isType('object');
|
|
160
|
-
var isArray = isType('array');
|
|
161
|
-
var isBoolean = isSimpleType('boolean');
|
|
162
|
-
var isUndefined = eq(undefined);
|
|
163
|
-
var isFunction = isSimpleType('function');
|
|
164
|
-
|
|
165
|
-
var noop = function () {
|
|
166
|
-
};
|
|
167
|
-
var constant = function (value) {
|
|
168
|
-
return function () {
|
|
180
|
+
const constant = value => {
|
|
181
|
+
return () => {
|
|
169
182
|
return value;
|
|
170
183
|
};
|
|
171
184
|
};
|
|
172
|
-
|
|
173
|
-
return x;
|
|
174
|
-
};
|
|
175
|
-
var never = constant(false);
|
|
176
|
-
var always = constant(true);
|
|
185
|
+
const never = constant(false);
|
|
177
186
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
getOrDie: function (msg) {
|
|
195
|
-
throw new Error(msg || 'error: getOrDie called on none.');
|
|
196
|
-
},
|
|
197
|
-
getOrNull: constant(null),
|
|
198
|
-
getOrUndefined: constant(undefined),
|
|
199
|
-
or: id,
|
|
200
|
-
orThunk: call,
|
|
201
|
-
map: none,
|
|
202
|
-
each: noop,
|
|
203
|
-
bind: none,
|
|
204
|
-
exists: never,
|
|
205
|
-
forall: always,
|
|
206
|
-
filter: function () {
|
|
207
|
-
return none();
|
|
208
|
-
},
|
|
209
|
-
toArray: function () {
|
|
210
|
-
return [];
|
|
211
|
-
},
|
|
212
|
-
toString: constant('none()')
|
|
213
|
-
};
|
|
214
|
-
return me;
|
|
215
|
-
}();
|
|
216
|
-
var some = function (a) {
|
|
217
|
-
var constant_a = constant(a);
|
|
218
|
-
var self = function () {
|
|
219
|
-
return me;
|
|
220
|
-
};
|
|
221
|
-
var bind = function (f) {
|
|
222
|
-
return f(a);
|
|
223
|
-
};
|
|
224
|
-
var me = {
|
|
225
|
-
fold: function (n, s) {
|
|
226
|
-
return s(a);
|
|
227
|
-
},
|
|
228
|
-
isSome: always,
|
|
229
|
-
isNone: never,
|
|
230
|
-
getOr: constant_a,
|
|
231
|
-
getOrThunk: constant_a,
|
|
232
|
-
getOrDie: constant_a,
|
|
233
|
-
getOrNull: constant_a,
|
|
234
|
-
getOrUndefined: constant_a,
|
|
235
|
-
or: self,
|
|
236
|
-
orThunk: self,
|
|
237
|
-
map: function (f) {
|
|
238
|
-
return some(f(a));
|
|
239
|
-
},
|
|
240
|
-
each: function (f) {
|
|
241
|
-
f(a);
|
|
242
|
-
},
|
|
243
|
-
bind: bind,
|
|
244
|
-
exists: bind,
|
|
245
|
-
forall: bind,
|
|
246
|
-
filter: function (f) {
|
|
247
|
-
return f(a) ? me : NONE;
|
|
248
|
-
},
|
|
249
|
-
toArray: function () {
|
|
250
|
-
return [a];
|
|
251
|
-
},
|
|
252
|
-
toString: function () {
|
|
253
|
-
return 'some(' + a + ')';
|
|
187
|
+
class Optional {
|
|
188
|
+
constructor(tag, value) {
|
|
189
|
+
this.tag = tag;
|
|
190
|
+
this.value = value;
|
|
191
|
+
}
|
|
192
|
+
static some(value) {
|
|
193
|
+
return new Optional(true, value);
|
|
194
|
+
}
|
|
195
|
+
static none() {
|
|
196
|
+
return Optional.singletonNone;
|
|
197
|
+
}
|
|
198
|
+
fold(onNone, onSome) {
|
|
199
|
+
if (this.tag) {
|
|
200
|
+
return onSome(this.value);
|
|
201
|
+
} else {
|
|
202
|
+
return onNone();
|
|
254
203
|
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
204
|
+
}
|
|
205
|
+
isSome() {
|
|
206
|
+
return this.tag;
|
|
207
|
+
}
|
|
208
|
+
isNone() {
|
|
209
|
+
return !this.tag;
|
|
210
|
+
}
|
|
211
|
+
map(mapper) {
|
|
212
|
+
if (this.tag) {
|
|
213
|
+
return Optional.some(mapper(this.value));
|
|
214
|
+
} else {
|
|
215
|
+
return Optional.none();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
bind(binder) {
|
|
219
|
+
if (this.tag) {
|
|
220
|
+
return binder(this.value);
|
|
221
|
+
} else {
|
|
222
|
+
return Optional.none();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exists(predicate) {
|
|
226
|
+
return this.tag && predicate(this.value);
|
|
227
|
+
}
|
|
228
|
+
forall(predicate) {
|
|
229
|
+
return !this.tag || predicate(this.value);
|
|
230
|
+
}
|
|
231
|
+
filter(predicate) {
|
|
232
|
+
if (!this.tag || predicate(this.value)) {
|
|
233
|
+
return this;
|
|
234
|
+
} else {
|
|
235
|
+
return Optional.none();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
getOr(replacement) {
|
|
239
|
+
return this.tag ? this.value : replacement;
|
|
240
|
+
}
|
|
241
|
+
or(replacement) {
|
|
242
|
+
return this.tag ? this : replacement;
|
|
243
|
+
}
|
|
244
|
+
getOrThunk(thunk) {
|
|
245
|
+
return this.tag ? this.value : thunk();
|
|
246
|
+
}
|
|
247
|
+
orThunk(thunk) {
|
|
248
|
+
return this.tag ? this : thunk();
|
|
249
|
+
}
|
|
250
|
+
getOrDie(message) {
|
|
251
|
+
if (!this.tag) {
|
|
252
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
253
|
+
} else {
|
|
254
|
+
return this.value;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
static from(value) {
|
|
258
|
+
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
259
|
+
}
|
|
260
|
+
getOrNull() {
|
|
261
|
+
return this.tag ? this.value : null;
|
|
262
|
+
}
|
|
263
|
+
getOrUndefined() {
|
|
264
|
+
return this.value;
|
|
265
|
+
}
|
|
266
|
+
each(worker) {
|
|
267
|
+
if (this.tag) {
|
|
268
|
+
worker(this.value);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
toArray() {
|
|
272
|
+
return this.tag ? [this.value] : [];
|
|
273
|
+
}
|
|
274
|
+
toString() {
|
|
275
|
+
return this.tag ? `some(${ this.value })` : 'none()';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
Optional.singletonNone = new Optional(false);
|
|
279
|
+
|
|
280
|
+
typeof window !== 'undefined' ? window : Function('return this;')();
|
|
281
|
+
|
|
282
|
+
const ELEMENT = 1;
|
|
283
|
+
|
|
284
|
+
const name = element => {
|
|
285
|
+
const r = element.dom.nodeName;
|
|
286
|
+
return r.toLowerCase();
|
|
260
287
|
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
288
|
+
|
|
289
|
+
const has$1 = (element, key) => {
|
|
290
|
+
const dom = element.dom;
|
|
291
|
+
return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
|
|
265
292
|
};
|
|
266
293
|
|
|
267
|
-
|
|
294
|
+
var ClosestOrAncestor = (is, ancestor, scope, a, isRoot) => {
|
|
268
295
|
if (is(scope, a)) {
|
|
269
296
|
return Optional.some(scope);
|
|
270
297
|
} else if (isFunction(isRoot) && isRoot(scope)) {
|
|
@@ -272,53 +299,50 @@
|
|
|
272
299
|
} else {
|
|
273
300
|
return ancestor(scope, a, isRoot);
|
|
274
301
|
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
var ELEMENT = 1;
|
|
302
|
+
};
|
|
278
303
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
304
|
+
const fromHtml = (html, scope) => {
|
|
305
|
+
const doc = scope || document;
|
|
306
|
+
const div = doc.createElement('div');
|
|
282
307
|
div.innerHTML = html;
|
|
283
308
|
if (!div.hasChildNodes() || div.childNodes.length > 1) {
|
|
284
|
-
|
|
285
|
-
|
|
309
|
+
const message = 'HTML does not have a single root node';
|
|
310
|
+
console.error(message, html);
|
|
311
|
+
throw new Error(message);
|
|
286
312
|
}
|
|
287
313
|
return fromDom(div.childNodes[0]);
|
|
288
314
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
315
|
+
const fromTag = (tag, scope) => {
|
|
316
|
+
const doc = scope || document;
|
|
317
|
+
const node = doc.createElement(tag);
|
|
292
318
|
return fromDom(node);
|
|
293
319
|
};
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
320
|
+
const fromText = (text, scope) => {
|
|
321
|
+
const doc = scope || document;
|
|
322
|
+
const node = doc.createTextNode(text);
|
|
297
323
|
return fromDom(node);
|
|
298
324
|
};
|
|
299
|
-
|
|
325
|
+
const fromDom = node => {
|
|
300
326
|
if (node === null || node === undefined) {
|
|
301
327
|
throw new Error('Node cannot be null or undefined');
|
|
302
328
|
}
|
|
303
329
|
return { dom: node };
|
|
304
330
|
};
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
fromDom: fromDom,
|
|
313
|
-
fromPoint: fromPoint
|
|
331
|
+
const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
|
|
332
|
+
const SugarElement = {
|
|
333
|
+
fromHtml,
|
|
334
|
+
fromTag,
|
|
335
|
+
fromText,
|
|
336
|
+
fromDom,
|
|
337
|
+
fromPoint
|
|
314
338
|
};
|
|
315
339
|
|
|
316
|
-
|
|
317
|
-
|
|
340
|
+
const is = (element, selector) => {
|
|
341
|
+
const dom = element.dom;
|
|
318
342
|
if (dom.nodeType !== ELEMENT) {
|
|
319
343
|
return false;
|
|
320
344
|
} else {
|
|
321
|
-
|
|
345
|
+
const elem = dom;
|
|
322
346
|
if (elem.matches !== undefined) {
|
|
323
347
|
return elem.matches(selector);
|
|
324
348
|
} else if (elem.msMatchesSelector !== undefined) {
|
|
@@ -333,19 +357,12 @@
|
|
|
333
357
|
}
|
|
334
358
|
};
|
|
335
359
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
var r = element.dom.nodeName;
|
|
340
|
-
return r.toLowerCase();
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
var ancestor$1 = function (scope, predicate, isRoot) {
|
|
344
|
-
var element = scope.dom;
|
|
345
|
-
var stop = isFunction(isRoot) ? isRoot : never;
|
|
360
|
+
const ancestor$1 = (scope, predicate, isRoot) => {
|
|
361
|
+
let element = scope.dom;
|
|
362
|
+
const stop = isFunction(isRoot) ? isRoot : never;
|
|
346
363
|
while (element.parentNode) {
|
|
347
364
|
element = element.parentNode;
|
|
348
|
-
|
|
365
|
+
const el = SugarElement.fromDom(element);
|
|
349
366
|
if (predicate(el)) {
|
|
350
367
|
return Optional.some(el);
|
|
351
368
|
} else if (stop(el)) {
|
|
@@ -354,77 +371,28 @@
|
|
|
354
371
|
}
|
|
355
372
|
return Optional.none();
|
|
356
373
|
};
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return test(s);
|
|
360
|
-
};
|
|
374
|
+
const closest$2 = (scope, predicate, isRoot) => {
|
|
375
|
+
const is = (s, test) => test(s);
|
|
361
376
|
return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot);
|
|
362
377
|
};
|
|
363
378
|
|
|
364
|
-
|
|
365
|
-
return ancestor$1(scope, function (e) {
|
|
366
|
-
return is(e, selector);
|
|
367
|
-
}, isRoot);
|
|
368
|
-
};
|
|
369
|
-
var closest = function (scope, selector, isRoot) {
|
|
370
|
-
var is$1 = function (element, selector) {
|
|
371
|
-
return is(element, selector);
|
|
372
|
-
};
|
|
373
|
-
return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot);
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
var validDefaultOrDie = function (value, predicate) {
|
|
377
|
-
if (predicate(value)) {
|
|
378
|
-
return true;
|
|
379
|
-
}
|
|
380
|
-
throw new Error('Default value doesn\'t match requested type.');
|
|
381
|
-
};
|
|
382
|
-
var items = function (value, defaultValue) {
|
|
383
|
-
if (isArray(value) || isObject(value)) {
|
|
384
|
-
throw new Error('expected a string but found: ' + value);
|
|
385
|
-
}
|
|
386
|
-
if (isUndefined(value)) {
|
|
387
|
-
return defaultValue;
|
|
388
|
-
}
|
|
389
|
-
if (isBoolean(value)) {
|
|
390
|
-
return value === false ? '' : defaultValue;
|
|
391
|
-
}
|
|
392
|
-
return value;
|
|
393
|
-
};
|
|
394
|
-
var getToolbarItemsOr_ = function (predicate) {
|
|
395
|
-
return function (editor, name, defaultValue) {
|
|
396
|
-
validDefaultOrDie(defaultValue, predicate);
|
|
397
|
-
var value = editor.getParam(name, defaultValue);
|
|
398
|
-
return items(value, defaultValue);
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
var getToolbarItemsOr = getToolbarItemsOr_(isString);
|
|
379
|
+
const closest$1 = (scope, predicate, isRoot) => closest$2(scope, predicate, isRoot).isSome();
|
|
402
380
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return getToolbarItemsOr(editor, 'quickbars_insert_toolbar', 'quickimage quicktable');
|
|
408
|
-
};
|
|
409
|
-
var getImageToolbarItems = function (editor) {
|
|
410
|
-
return getToolbarItemsOr(editor, 'quickbars_image_toolbar', 'alignleft aligncenter alignright');
|
|
381
|
+
const ancestor = (scope, selector, isRoot) => ancestor$1(scope, e => is(e, selector), isRoot);
|
|
382
|
+
const closest = (scope, selector, isRoot) => {
|
|
383
|
+
const is$1 = (element, selector) => is(element, selector);
|
|
384
|
+
return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot);
|
|
411
385
|
};
|
|
412
386
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (insertToolbarItems.
|
|
387
|
+
const addToEditor$1 = editor => {
|
|
388
|
+
const insertToolbarItems = getInsertToolbarItems(editor);
|
|
389
|
+
if (insertToolbarItems.length > 0) {
|
|
416
390
|
editor.ui.registry.addContextToolbar('quickblock', {
|
|
417
|
-
predicate:
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
};
|
|
423
|
-
return closest(sugarNode, 'table', isRoot).fold(function () {
|
|
424
|
-
return closest$1(sugarNode, function (elem) {
|
|
425
|
-
return name(elem) in textBlockElementsMap && editor.dom.isEmpty(elem.dom);
|
|
426
|
-
}, isRoot).isSome();
|
|
427
|
-
}, never);
|
|
391
|
+
predicate: node => {
|
|
392
|
+
const sugarNode = SugarElement.fromDom(node);
|
|
393
|
+
const textBlockElementsMap = editor.schema.getTextBlockElements();
|
|
394
|
+
const isRoot = elem => elem.dom === editor.getBody();
|
|
395
|
+
return !has$1(sugarNode, 'data-mce-bogus') && closest(sugarNode, 'table,[data-mce-bogus="all"]', isRoot).fold(() => closest$1(sugarNode, elem => name(elem) in textBlockElementsMap && editor.dom.isEmpty(elem.dom), isRoot), never);
|
|
428
396
|
},
|
|
429
397
|
items: insertToolbarItems,
|
|
430
398
|
position: 'line',
|
|
@@ -433,27 +401,31 @@
|
|
|
433
401
|
}
|
|
434
402
|
};
|
|
435
403
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
404
|
+
const supports = element => element.dom.classList !== undefined;
|
|
405
|
+
|
|
406
|
+
const has = (element, clazz) => supports(element) && element.dom.classList.contains(clazz);
|
|
407
|
+
|
|
408
|
+
const addToEditor = editor => {
|
|
409
|
+
const isEditable = node => editor.dom.isEditable(node);
|
|
410
|
+
const isInEditableContext = el => isEditable(el.parentElement);
|
|
411
|
+
const isImage = node => {
|
|
412
|
+
const isImageFigure = node.nodeName === 'FIGURE' && /image/i.test(node.className);
|
|
413
|
+
const isImage = node.nodeName === 'IMG' || isImageFigure;
|
|
414
|
+
const isPagebreak = has(SugarElement.fromDom(node), 'mce-pagebreak');
|
|
415
|
+
return isImage && isInEditableContext(node) && !isPagebreak;
|
|
442
416
|
};
|
|
443
|
-
|
|
444
|
-
if (imageToolbarItems.
|
|
417
|
+
const imageToolbarItems = getImageToolbarItems(editor);
|
|
418
|
+
if (imageToolbarItems.length > 0) {
|
|
445
419
|
editor.ui.registry.addContextToolbar('imageselection', {
|
|
446
420
|
predicate: isImage,
|
|
447
421
|
items: imageToolbarItems,
|
|
448
422
|
position: 'node'
|
|
449
423
|
});
|
|
450
424
|
}
|
|
451
|
-
|
|
452
|
-
if (textToolbarItems.
|
|
425
|
+
const textToolbarItems = getTextSelectionToolbarItems(editor);
|
|
426
|
+
if (textToolbarItems.length > 0) {
|
|
453
427
|
editor.ui.registry.addContextToolbar('textselection', {
|
|
454
|
-
predicate:
|
|
455
|
-
return !isImage(node) && !editor.selection.isCollapsed() && isEditable(node);
|
|
456
|
-
},
|
|
428
|
+
predicate: node => !isImage(node) && !editor.selection.isCollapsed() && isEditable(node),
|
|
457
429
|
items: textToolbarItems,
|
|
458
430
|
position: 'selection',
|
|
459
431
|
scope: 'editor'
|
|
@@ -461,14 +433,15 @@
|
|
|
461
433
|
}
|
|
462
434
|
};
|
|
463
435
|
|
|
464
|
-
|
|
465
|
-
global$
|
|
436
|
+
var Plugin = () => {
|
|
437
|
+
global$1.add('quickbars', editor => {
|
|
438
|
+
register(editor);
|
|
466
439
|
setupButtons(editor);
|
|
467
440
|
addToEditor$1(editor);
|
|
468
441
|
addToEditor(editor);
|
|
469
442
|
});
|
|
470
|
-
}
|
|
443
|
+
};
|
|
471
444
|
|
|
472
445
|
Plugin();
|
|
473
446
|
|
|
474
|
-
}()
|
|
447
|
+
})();
|