@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,252 +1,222 @@
|
|
|
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
|
-
var isNull = eq(null);
|
|
10
|
+
const eq = t => a => t === a;
|
|
11
|
+
const isNull = eq(null);
|
|
12
|
+
const isUndefined = eq(undefined);
|
|
13
|
+
const isNullable = a => a === null || a === undefined;
|
|
14
|
+
const isNonNullable = a => !isNullable(a);
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
const noop = () => {
|
|
22
17
|
};
|
|
23
|
-
|
|
24
|
-
return
|
|
18
|
+
const constant = value => {
|
|
19
|
+
return () => {
|
|
25
20
|
return value;
|
|
26
21
|
};
|
|
27
22
|
};
|
|
28
|
-
|
|
29
|
-
return x;
|
|
30
|
-
};
|
|
31
|
-
var never = constant(false);
|
|
32
|
-
var always = constant(true);
|
|
23
|
+
const never = constant(false);
|
|
33
24
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
getOrDie: function (msg) {
|
|
51
|
-
throw new Error(msg || 'error: getOrDie called on none.');
|
|
52
|
-
},
|
|
53
|
-
getOrNull: constant(null),
|
|
54
|
-
getOrUndefined: constant(undefined),
|
|
55
|
-
or: id,
|
|
56
|
-
orThunk: call,
|
|
57
|
-
map: none,
|
|
58
|
-
each: noop,
|
|
59
|
-
bind: none,
|
|
60
|
-
exists: never,
|
|
61
|
-
forall: always,
|
|
62
|
-
filter: function () {
|
|
63
|
-
return none();
|
|
64
|
-
},
|
|
65
|
-
toArray: function () {
|
|
66
|
-
return [];
|
|
67
|
-
},
|
|
68
|
-
toString: constant('none()')
|
|
69
|
-
};
|
|
70
|
-
return me;
|
|
71
|
-
}();
|
|
72
|
-
var some = function (a) {
|
|
73
|
-
var constant_a = constant(a);
|
|
74
|
-
var self = function () {
|
|
75
|
-
return me;
|
|
76
|
-
};
|
|
77
|
-
var bind = function (f) {
|
|
78
|
-
return f(a);
|
|
79
|
-
};
|
|
80
|
-
var me = {
|
|
81
|
-
fold: function (n, s) {
|
|
82
|
-
return s(a);
|
|
83
|
-
},
|
|
84
|
-
isSome: always,
|
|
85
|
-
isNone: never,
|
|
86
|
-
getOr: constant_a,
|
|
87
|
-
getOrThunk: constant_a,
|
|
88
|
-
getOrDie: constant_a,
|
|
89
|
-
getOrNull: constant_a,
|
|
90
|
-
getOrUndefined: constant_a,
|
|
91
|
-
or: self,
|
|
92
|
-
orThunk: self,
|
|
93
|
-
map: function (f) {
|
|
94
|
-
return some(f(a));
|
|
95
|
-
},
|
|
96
|
-
each: function (f) {
|
|
97
|
-
f(a);
|
|
98
|
-
},
|
|
99
|
-
bind: bind,
|
|
100
|
-
exists: bind,
|
|
101
|
-
forall: bind,
|
|
102
|
-
filter: function (f) {
|
|
103
|
-
return f(a) ? me : NONE;
|
|
104
|
-
},
|
|
105
|
-
toArray: function () {
|
|
106
|
-
return [a];
|
|
107
|
-
},
|
|
108
|
-
toString: function () {
|
|
109
|
-
return 'some(' + a + ')';
|
|
25
|
+
class Optional {
|
|
26
|
+
constructor(tag, value) {
|
|
27
|
+
this.tag = tag;
|
|
28
|
+
this.value = value;
|
|
29
|
+
}
|
|
30
|
+
static some(value) {
|
|
31
|
+
return new Optional(true, value);
|
|
32
|
+
}
|
|
33
|
+
static none() {
|
|
34
|
+
return Optional.singletonNone;
|
|
35
|
+
}
|
|
36
|
+
fold(onNone, onSome) {
|
|
37
|
+
if (this.tag) {
|
|
38
|
+
return onSome(this.value);
|
|
39
|
+
} else {
|
|
40
|
+
return onNone();
|
|
110
41
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
42
|
+
}
|
|
43
|
+
isSome() {
|
|
44
|
+
return this.tag;
|
|
45
|
+
}
|
|
46
|
+
isNone() {
|
|
47
|
+
return !this.tag;
|
|
48
|
+
}
|
|
49
|
+
map(mapper) {
|
|
50
|
+
if (this.tag) {
|
|
51
|
+
return Optional.some(mapper(this.value));
|
|
52
|
+
} else {
|
|
53
|
+
return Optional.none();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
bind(binder) {
|
|
57
|
+
if (this.tag) {
|
|
58
|
+
return binder(this.value);
|
|
59
|
+
} else {
|
|
60
|
+
return Optional.none();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exists(predicate) {
|
|
64
|
+
return this.tag && predicate(this.value);
|
|
65
|
+
}
|
|
66
|
+
forall(predicate) {
|
|
67
|
+
return !this.tag || predicate(this.value);
|
|
68
|
+
}
|
|
69
|
+
filter(predicate) {
|
|
70
|
+
if (!this.tag || predicate(this.value)) {
|
|
71
|
+
return this;
|
|
72
|
+
} else {
|
|
73
|
+
return Optional.none();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
getOr(replacement) {
|
|
77
|
+
return this.tag ? this.value : replacement;
|
|
78
|
+
}
|
|
79
|
+
or(replacement) {
|
|
80
|
+
return this.tag ? this : replacement;
|
|
81
|
+
}
|
|
82
|
+
getOrThunk(thunk) {
|
|
83
|
+
return this.tag ? this.value : thunk();
|
|
84
|
+
}
|
|
85
|
+
orThunk(thunk) {
|
|
86
|
+
return this.tag ? this : thunk();
|
|
87
|
+
}
|
|
88
|
+
getOrDie(message) {
|
|
89
|
+
if (!this.tag) {
|
|
90
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
|
|
91
|
+
} else {
|
|
92
|
+
return this.value;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
static from(value) {
|
|
96
|
+
return isNonNullable(value) ? Optional.some(value) : Optional.none();
|
|
97
|
+
}
|
|
98
|
+
getOrNull() {
|
|
99
|
+
return this.tag ? this.value : null;
|
|
100
|
+
}
|
|
101
|
+
getOrUndefined() {
|
|
102
|
+
return this.value;
|
|
103
|
+
}
|
|
104
|
+
each(worker) {
|
|
105
|
+
if (this.tag) {
|
|
106
|
+
worker(this.value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
toArray() {
|
|
110
|
+
return this.tag ? [this.value] : [];
|
|
111
|
+
}
|
|
112
|
+
toString() {
|
|
113
|
+
return this.tag ? `some(${ this.value })` : 'none()';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
Optional.singletonNone = new Optional(false);
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
for (
|
|
125
|
-
|
|
118
|
+
const exists = (xs, pred) => {
|
|
119
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
120
|
+
const x = xs[i];
|
|
126
121
|
if (pred(x, i)) {
|
|
127
122
|
return true;
|
|
128
123
|
}
|
|
129
124
|
}
|
|
130
125
|
return false;
|
|
131
126
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
for (
|
|
136
|
-
|
|
127
|
+
const map$1 = (xs, f) => {
|
|
128
|
+
const len = xs.length;
|
|
129
|
+
const r = new Array(len);
|
|
130
|
+
for (let i = 0; i < len; i++) {
|
|
131
|
+
const x = xs[i];
|
|
137
132
|
r[i] = f(x, i);
|
|
138
133
|
}
|
|
139
134
|
return r;
|
|
140
135
|
};
|
|
141
|
-
|
|
142
|
-
for (
|
|
143
|
-
|
|
136
|
+
const each$1 = (xs, f) => {
|
|
137
|
+
for (let i = 0, len = xs.length; i < len; i++) {
|
|
138
|
+
const x = xs[i];
|
|
144
139
|
f(x, i);
|
|
145
140
|
}
|
|
146
141
|
};
|
|
147
142
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
const Cell = initial => {
|
|
144
|
+
let value = initial;
|
|
145
|
+
const get = () => {
|
|
151
146
|
return value;
|
|
152
147
|
};
|
|
153
|
-
|
|
148
|
+
const set = v => {
|
|
154
149
|
value = v;
|
|
155
150
|
};
|
|
156
151
|
return {
|
|
157
|
-
get
|
|
158
|
-
set
|
|
152
|
+
get,
|
|
153
|
+
set
|
|
159
154
|
};
|
|
160
155
|
};
|
|
161
156
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
157
|
+
const last = (fn, rate) => {
|
|
158
|
+
let timer = null;
|
|
159
|
+
const cancel = () => {
|
|
165
160
|
if (!isNull(timer)) {
|
|
166
161
|
clearTimeout(timer);
|
|
167
162
|
timer = null;
|
|
168
163
|
}
|
|
169
164
|
};
|
|
170
|
-
|
|
171
|
-
var args = [];
|
|
172
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
173
|
-
args[_i] = arguments[_i];
|
|
174
|
-
}
|
|
165
|
+
const throttle = (...args) => {
|
|
175
166
|
cancel();
|
|
176
|
-
timer = setTimeout(
|
|
167
|
+
timer = setTimeout(() => {
|
|
177
168
|
timer = null;
|
|
178
169
|
fn.apply(null, args);
|
|
179
170
|
}, rate);
|
|
180
171
|
};
|
|
181
172
|
return {
|
|
182
|
-
cancel
|
|
183
|
-
throttle
|
|
173
|
+
cancel,
|
|
174
|
+
throttle
|
|
184
175
|
};
|
|
185
176
|
};
|
|
186
177
|
|
|
187
|
-
|
|
178
|
+
const insertEmoticon = (editor, ch) => {
|
|
188
179
|
editor.insertContent(ch);
|
|
189
180
|
};
|
|
190
181
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
return t;
|
|
200
|
-
};
|
|
201
|
-
return __assign.apply(this, arguments);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
var keys = Object.keys;
|
|
205
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
|
206
|
-
var each = function (obj, f) {
|
|
207
|
-
var props = keys(obj);
|
|
208
|
-
for (var k = 0, len = props.length; k < len; k++) {
|
|
209
|
-
var i = props[k];
|
|
210
|
-
var x = obj[i];
|
|
182
|
+
const keys = Object.keys;
|
|
183
|
+
const hasOwnProperty = Object.hasOwnProperty;
|
|
184
|
+
const each = (obj, f) => {
|
|
185
|
+
const props = keys(obj);
|
|
186
|
+
for (let k = 0, len = props.length; k < len; k++) {
|
|
187
|
+
const i = props[k];
|
|
188
|
+
const x = obj[i];
|
|
211
189
|
f(x, i);
|
|
212
190
|
}
|
|
213
191
|
};
|
|
214
|
-
|
|
215
|
-
return tupleMap(obj,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
220
|
-
});
|
|
192
|
+
const map = (obj, f) => {
|
|
193
|
+
return tupleMap(obj, (x, i) => ({
|
|
194
|
+
k: i,
|
|
195
|
+
v: f(x, i)
|
|
196
|
+
}));
|
|
221
197
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
each(obj,
|
|
225
|
-
|
|
198
|
+
const tupleMap = (obj, f) => {
|
|
199
|
+
const r = {};
|
|
200
|
+
each(obj, (x, i) => {
|
|
201
|
+
const tuple = f(x, i);
|
|
226
202
|
r[tuple.k] = tuple.v;
|
|
227
203
|
});
|
|
228
204
|
return r;
|
|
229
205
|
};
|
|
230
|
-
|
|
231
|
-
return hasOwnProperty.call(obj, key);
|
|
232
|
-
};
|
|
206
|
+
const has = (obj, key) => hasOwnProperty.call(obj, key);
|
|
233
207
|
|
|
234
|
-
|
|
208
|
+
const shallow = (old, nu) => {
|
|
235
209
|
return nu;
|
|
236
210
|
};
|
|
237
|
-
|
|
238
|
-
return
|
|
239
|
-
var objects = [];
|
|
240
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
241
|
-
objects[_i] = arguments[_i];
|
|
242
|
-
}
|
|
211
|
+
const baseMerge = merger => {
|
|
212
|
+
return (...objects) => {
|
|
243
213
|
if (objects.length === 0) {
|
|
244
|
-
throw new Error(
|
|
214
|
+
throw new Error(`Can't merge zero objects`);
|
|
245
215
|
}
|
|
246
|
-
|
|
247
|
-
for (
|
|
248
|
-
|
|
249
|
-
for (
|
|
216
|
+
const ret = {};
|
|
217
|
+
for (let j = 0; j < objects.length; j++) {
|
|
218
|
+
const curObject = objects[j];
|
|
219
|
+
for (const key in curObject) {
|
|
250
220
|
if (has(curObject, key)) {
|
|
251
221
|
ret[key] = merger(ret[key], curObject[key]);
|
|
252
222
|
}
|
|
@@ -255,78 +225,85 @@
|
|
|
255
225
|
return ret;
|
|
256
226
|
};
|
|
257
227
|
};
|
|
258
|
-
|
|
228
|
+
const merge = baseMerge(shallow);
|
|
259
229
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
};
|
|
265
|
-
var clear = function () {
|
|
230
|
+
const singleton = doRevoke => {
|
|
231
|
+
const subject = Cell(Optional.none());
|
|
232
|
+
const revoke = () => subject.get().each(doRevoke);
|
|
233
|
+
const clear = () => {
|
|
266
234
|
revoke();
|
|
267
235
|
subject.set(Optional.none());
|
|
268
236
|
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
var get = function () {
|
|
273
|
-
return subject.get();
|
|
274
|
-
};
|
|
275
|
-
var set = function (s) {
|
|
237
|
+
const isSet = () => subject.get().isSome();
|
|
238
|
+
const get = () => subject.get();
|
|
239
|
+
const set = s => {
|
|
276
240
|
revoke();
|
|
277
241
|
subject.set(Optional.some(s));
|
|
278
242
|
};
|
|
279
243
|
return {
|
|
280
|
-
clear
|
|
281
|
-
isSet
|
|
282
|
-
get
|
|
283
|
-
set
|
|
244
|
+
clear,
|
|
245
|
+
isSet,
|
|
246
|
+
get,
|
|
247
|
+
set
|
|
284
248
|
};
|
|
285
249
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
250
|
+
const value = () => {
|
|
251
|
+
const subject = singleton(noop);
|
|
252
|
+
const on = f => subject.get().each(f);
|
|
253
|
+
return {
|
|
254
|
+
...subject,
|
|
255
|
+
on
|
|
290
256
|
};
|
|
291
|
-
return __assign(__assign({}, subject), { on: on });
|
|
292
257
|
};
|
|
293
258
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
259
|
+
const checkRange = (str, substr, start) => substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
|
|
260
|
+
const contains = (str, substr, start = 0, end) => {
|
|
261
|
+
const idx = str.indexOf(substr, start);
|
|
262
|
+
if (idx !== -1) {
|
|
263
|
+
return isUndefined(end) ? true : idx + substr.length <= end;
|
|
264
|
+
} else {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
299
267
|
};
|
|
300
|
-
|
|
268
|
+
const startsWith = (str, prefix) => {
|
|
301
269
|
return checkRange(str, prefix, 0);
|
|
302
270
|
};
|
|
303
271
|
|
|
304
|
-
var global
|
|
305
|
-
|
|
306
|
-
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Delay');
|
|
272
|
+
var global = tinymce.util.Tools.resolve('tinymce.Resource');
|
|
307
273
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
274
|
+
const DEFAULT_ID = 'tinymce.plugins.emoticons';
|
|
275
|
+
const option = name => editor => editor.options.get(name);
|
|
276
|
+
const register$2 = (editor, pluginUrl) => {
|
|
277
|
+
const registerOption = editor.options.register;
|
|
278
|
+
registerOption('emoticons_database', {
|
|
279
|
+
processor: 'string',
|
|
280
|
+
default: 'emojis'
|
|
281
|
+
});
|
|
282
|
+
registerOption('emoticons_database_url', {
|
|
283
|
+
processor: 'string',
|
|
284
|
+
default: `${ pluginUrl }/js/${ getEmojiDatabase(editor) }${ editor.suffix }.js`
|
|
285
|
+
});
|
|
286
|
+
registerOption('emoticons_database_id', {
|
|
287
|
+
processor: 'string',
|
|
288
|
+
default: DEFAULT_ID
|
|
289
|
+
});
|
|
290
|
+
registerOption('emoticons_append', {
|
|
291
|
+
processor: 'object',
|
|
292
|
+
default: {}
|
|
293
|
+
});
|
|
294
|
+
registerOption('emoticons_images_url', {
|
|
295
|
+
processor: 'string',
|
|
296
|
+
default: 'https://twemoji.maxcdn.com/v/13.0.1/72x72/'
|
|
297
|
+
});
|
|
326
298
|
};
|
|
299
|
+
const getEmojiDatabase = option('emoticons_database');
|
|
300
|
+
const getEmojiDatabaseUrl = option('emoticons_database_url');
|
|
301
|
+
const getEmojiDatabaseId = option('emoticons_database_id');
|
|
302
|
+
const getAppendedEmoji = option('emoticons_append');
|
|
303
|
+
const getEmojiImageUrl = option('emoticons_images_url');
|
|
327
304
|
|
|
328
|
-
|
|
329
|
-
|
|
305
|
+
const ALL_CATEGORY = 'All';
|
|
306
|
+
const categoryNameMap = {
|
|
330
307
|
symbols: 'Symbols',
|
|
331
308
|
people: 'People',
|
|
332
309
|
animals_and_nature: 'Animals and Nature',
|
|
@@ -337,87 +314,76 @@
|
|
|
337
314
|
flags: 'Flags',
|
|
338
315
|
user: 'User Defined'
|
|
339
316
|
};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
var all = value();
|
|
355
|
-
var emojiImagesUrl = getEmotionsImageUrl(editor);
|
|
356
|
-
var getEmoji = function (lib) {
|
|
317
|
+
const translateCategory = (categories, name) => has(categories, name) ? categories[name] : name;
|
|
318
|
+
const getUserDefinedEmoji = editor => {
|
|
319
|
+
const userDefinedEmoticons = getAppendedEmoji(editor);
|
|
320
|
+
return map(userDefinedEmoticons, value => ({
|
|
321
|
+
keywords: [],
|
|
322
|
+
category: 'user',
|
|
323
|
+
...value
|
|
324
|
+
}));
|
|
325
|
+
};
|
|
326
|
+
const initDatabase = (editor, databaseUrl, databaseId) => {
|
|
327
|
+
const categories = value();
|
|
328
|
+
const all = value();
|
|
329
|
+
const emojiImagesUrl = getEmojiImageUrl(editor);
|
|
330
|
+
const getEmoji = lib => {
|
|
357
331
|
if (startsWith(lib.char, '<img')) {
|
|
358
|
-
return lib.char.replace(/src="([^"]+)"/,
|
|
359
|
-
return 'src="' + emojiImagesUrl + url + '"';
|
|
360
|
-
});
|
|
332
|
+
return lib.char.replace(/src="([^"]+)"/, (match, url) => `src="${ emojiImagesUrl }${ url }"`);
|
|
361
333
|
} else {
|
|
362
334
|
return lib.char;
|
|
363
335
|
}
|
|
364
336
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
each(emojis,
|
|
369
|
-
|
|
370
|
-
title
|
|
337
|
+
const processEmojis = emojis => {
|
|
338
|
+
const cats = {};
|
|
339
|
+
const everything = [];
|
|
340
|
+
each(emojis, (lib, title) => {
|
|
341
|
+
const entry = {
|
|
342
|
+
title,
|
|
371
343
|
keywords: lib.keywords,
|
|
372
344
|
char: getEmoji(lib),
|
|
373
345
|
category: translateCategory(categoryNameMap, lib.category)
|
|
374
346
|
};
|
|
375
|
-
|
|
347
|
+
const current = cats[entry.category] !== undefined ? cats[entry.category] : [];
|
|
376
348
|
cats[entry.category] = current.concat([entry]);
|
|
377
349
|
everything.push(entry);
|
|
378
350
|
});
|
|
379
351
|
categories.set(cats);
|
|
380
352
|
all.set(everything);
|
|
381
353
|
};
|
|
382
|
-
editor.on('init',
|
|
383
|
-
global
|
|
384
|
-
|
|
354
|
+
editor.on('init', () => {
|
|
355
|
+
global.load(databaseId, databaseUrl).then(emojis => {
|
|
356
|
+
const userEmojis = getUserDefinedEmoji(editor);
|
|
385
357
|
processEmojis(merge(emojis, userEmojis));
|
|
386
|
-
},
|
|
387
|
-
console.log(
|
|
358
|
+
}, err => {
|
|
359
|
+
console.log(`Failed to load emojis: ${ err }`);
|
|
388
360
|
categories.set({});
|
|
389
361
|
all.set([]);
|
|
390
362
|
});
|
|
391
363
|
});
|
|
392
|
-
|
|
364
|
+
const listCategory = category => {
|
|
393
365
|
if (category === ALL_CATEGORY) {
|
|
394
366
|
return listAll();
|
|
395
367
|
}
|
|
396
|
-
return categories.get().bind(
|
|
397
|
-
return Optional.from(cats[category]);
|
|
398
|
-
}).getOr([]);
|
|
399
|
-
};
|
|
400
|
-
var listAll = function () {
|
|
401
|
-
return all.get().getOr([]);
|
|
402
|
-
};
|
|
403
|
-
var listCategories = function () {
|
|
404
|
-
return [ALL_CATEGORY].concat(keys(categories.get().getOr({})));
|
|
368
|
+
return categories.get().bind(cats => Optional.from(cats[category])).getOr([]);
|
|
405
369
|
};
|
|
406
|
-
|
|
370
|
+
const listAll = () => all.get().getOr([]);
|
|
371
|
+
const listCategories = () => [ALL_CATEGORY].concat(keys(categories.get().getOr({})));
|
|
372
|
+
const waitForLoad = () => {
|
|
407
373
|
if (hasLoaded()) {
|
|
408
|
-
return
|
|
374
|
+
return Promise.resolve(true);
|
|
409
375
|
} else {
|
|
410
|
-
return new
|
|
411
|
-
|
|
412
|
-
|
|
376
|
+
return new Promise((resolve, reject) => {
|
|
377
|
+
let numRetries = 15;
|
|
378
|
+
const interval = setInterval(() => {
|
|
413
379
|
if (hasLoaded()) {
|
|
414
|
-
|
|
380
|
+
clearInterval(interval);
|
|
415
381
|
resolve(true);
|
|
416
382
|
} else {
|
|
417
383
|
numRetries--;
|
|
418
384
|
if (numRetries < 0) {
|
|
419
385
|
console.log('Could not load emojis from url: ' + databaseUrl);
|
|
420
|
-
|
|
386
|
+
clearInterval(interval);
|
|
421
387
|
reject(false);
|
|
422
388
|
}
|
|
423
389
|
}
|
|
@@ -425,34 +391,22 @@
|
|
|
425
391
|
});
|
|
426
392
|
}
|
|
427
393
|
};
|
|
428
|
-
|
|
429
|
-
return categories.isSet() && all.isSet();
|
|
430
|
-
};
|
|
394
|
+
const hasLoaded = () => categories.isSet() && all.isSet();
|
|
431
395
|
return {
|
|
432
|
-
listCategories
|
|
433
|
-
hasLoaded
|
|
434
|
-
waitForLoad
|
|
435
|
-
listAll
|
|
436
|
-
listCategory
|
|
396
|
+
listCategories,
|
|
397
|
+
hasLoaded,
|
|
398
|
+
waitForLoad,
|
|
399
|
+
listAll,
|
|
400
|
+
listCategory
|
|
437
401
|
};
|
|
438
402
|
};
|
|
439
403
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
var matches = [];
|
|
447
|
-
var lowerCasePattern = pattern.toLowerCase();
|
|
448
|
-
var reachedLimit = maxResults.fold(function () {
|
|
449
|
-
return never;
|
|
450
|
-
}, function (max) {
|
|
451
|
-
return function (size) {
|
|
452
|
-
return size >= max;
|
|
453
|
-
};
|
|
454
|
-
});
|
|
455
|
-
for (var i = 0; i < list.length; i++) {
|
|
404
|
+
const emojiMatches = (emoji, lowerCasePattern) => contains(emoji.title.toLowerCase(), lowerCasePattern) || exists(emoji.keywords, k => contains(k.toLowerCase(), lowerCasePattern));
|
|
405
|
+
const emojisFrom = (list, pattern, maxResults) => {
|
|
406
|
+
const matches = [];
|
|
407
|
+
const lowerCasePattern = pattern.toLowerCase();
|
|
408
|
+
const reachedLimit = maxResults.fold(() => never, max => size => size >= max);
|
|
409
|
+
for (let i = 0; i < list.length; i++) {
|
|
456
410
|
if (pattern.length === 0 || emojiMatches(list[i], lowerCasePattern)) {
|
|
457
411
|
matches.push({
|
|
458
412
|
value: list[i].char,
|
|
@@ -467,57 +421,55 @@
|
|
|
467
421
|
return matches;
|
|
468
422
|
};
|
|
469
423
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
424
|
+
const patternName = 'pattern';
|
|
425
|
+
const open = (editor, database) => {
|
|
426
|
+
const initialState = {
|
|
473
427
|
pattern: '',
|
|
474
428
|
results: emojisFrom(database.listAll(), '', Optional.some(300))
|
|
475
429
|
};
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
dialogApi.setData({ results
|
|
430
|
+
const currentTab = Cell(ALL_CATEGORY);
|
|
431
|
+
const scan = dialogApi => {
|
|
432
|
+
const dialogData = dialogApi.getData();
|
|
433
|
+
const category = currentTab.get();
|
|
434
|
+
const candidates = database.listCategory(category);
|
|
435
|
+
const results = emojisFrom(candidates, dialogData[patternName], category === ALL_CATEGORY ? Optional.some(300) : Optional.none());
|
|
436
|
+
dialogApi.setData({ results });
|
|
483
437
|
};
|
|
484
|
-
|
|
438
|
+
const updateFilter = last(dialogApi => {
|
|
485
439
|
scan(dialogApi);
|
|
486
440
|
}, 200);
|
|
487
|
-
|
|
441
|
+
const searchField = {
|
|
488
442
|
label: 'Search',
|
|
489
443
|
type: 'input',
|
|
490
444
|
name: patternName
|
|
491
445
|
};
|
|
492
|
-
|
|
446
|
+
const resultsField = {
|
|
493
447
|
type: 'collection',
|
|
494
448
|
name: 'results'
|
|
495
449
|
};
|
|
496
|
-
|
|
497
|
-
|
|
450
|
+
const getInitialState = () => {
|
|
451
|
+
const body = {
|
|
498
452
|
type: 'tabpanel',
|
|
499
|
-
tabs: map$1(database.listCategories(),
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
};
|
|
508
|
-
})
|
|
453
|
+
tabs: map$1(database.listCategories(), cat => ({
|
|
454
|
+
title: cat,
|
|
455
|
+
name: cat,
|
|
456
|
+
items: [
|
|
457
|
+
searchField,
|
|
458
|
+
resultsField
|
|
459
|
+
]
|
|
460
|
+
}))
|
|
509
461
|
};
|
|
510
462
|
return {
|
|
511
|
-
title: '
|
|
463
|
+
title: 'Emojis',
|
|
512
464
|
size: 'normal',
|
|
513
|
-
body
|
|
465
|
+
body,
|
|
514
466
|
initialData: initialState,
|
|
515
|
-
onTabChange:
|
|
467
|
+
onTabChange: (dialogApi, details) => {
|
|
516
468
|
currentTab.set(details.newTabName);
|
|
517
469
|
updateFilter.throttle(dialogApi);
|
|
518
470
|
},
|
|
519
471
|
onChange: updateFilter.throttle,
|
|
520
|
-
onAction:
|
|
472
|
+
onAction: (dialogApi, actionData) => {
|
|
521
473
|
if (actionData.name === 'results') {
|
|
522
474
|
insertEmoticon(editor, actionData.value);
|
|
523
475
|
dialogApi.close();
|
|
@@ -530,25 +482,25 @@
|
|
|
530
482
|
}]
|
|
531
483
|
};
|
|
532
484
|
};
|
|
533
|
-
|
|
485
|
+
const dialogApi = editor.windowManager.open(getInitialState());
|
|
534
486
|
dialogApi.focus(patternName);
|
|
535
487
|
if (!database.hasLoaded()) {
|
|
536
|
-
dialogApi.block('Loading
|
|
537
|
-
database.waitForLoad().then(
|
|
488
|
+
dialogApi.block('Loading emojis...');
|
|
489
|
+
database.waitForLoad().then(() => {
|
|
538
490
|
dialogApi.redial(getInitialState());
|
|
539
491
|
updateFilter.throttle(dialogApi);
|
|
540
492
|
dialogApi.focus(patternName);
|
|
541
493
|
dialogApi.unblock();
|
|
542
|
-
}).catch(
|
|
494
|
+
}).catch(_err => {
|
|
543
495
|
dialogApi.redial({
|
|
544
|
-
title: '
|
|
496
|
+
title: 'Emojis',
|
|
545
497
|
body: {
|
|
546
498
|
type: 'panel',
|
|
547
499
|
items: [{
|
|
548
500
|
type: 'alertbanner',
|
|
549
501
|
level: 'error',
|
|
550
502
|
icon: 'warning',
|
|
551
|
-
text: '
|
|
503
|
+
text: 'Could not load emojis'
|
|
552
504
|
}]
|
|
553
505
|
},
|
|
554
506
|
buttons: [{
|
|
@@ -567,16 +519,14 @@
|
|
|
567
519
|
}
|
|
568
520
|
};
|
|
569
521
|
|
|
570
|
-
|
|
571
|
-
editor.addCommand('mceEmoticons',
|
|
572
|
-
return open(editor, database);
|
|
573
|
-
});
|
|
522
|
+
const register$1 = (editor, database) => {
|
|
523
|
+
editor.addCommand('mceEmoticons', () => open(editor, database));
|
|
574
524
|
};
|
|
575
525
|
|
|
576
|
-
|
|
577
|
-
editor.on('PreInit',
|
|
578
|
-
editor.parser.addAttributeFilter('data-emoticon',
|
|
579
|
-
each$1(nodes,
|
|
526
|
+
const setup = editor => {
|
|
527
|
+
editor.on('PreInit', () => {
|
|
528
|
+
editor.parser.addAttributeFilter('data-emoticon', nodes => {
|
|
529
|
+
each$1(nodes, node => {
|
|
580
530
|
node.attr('data-mce-resize', 'false');
|
|
581
531
|
node.attr('data-mce-placeholder', '1');
|
|
582
532
|
});
|
|
@@ -584,18 +534,16 @@
|
|
|
584
534
|
});
|
|
585
535
|
};
|
|
586
536
|
|
|
587
|
-
|
|
537
|
+
const init = (editor, database) => {
|
|
588
538
|
editor.ui.registry.addAutocompleter('emoticons', {
|
|
589
|
-
|
|
539
|
+
trigger: ':',
|
|
590
540
|
columns: 'auto',
|
|
591
541
|
minChars: 2,
|
|
592
|
-
fetch:
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
},
|
|
598
|
-
onAction: function (autocompleteApi, rng, value) {
|
|
542
|
+
fetch: (pattern, maxResults) => database.waitForLoad().then(() => {
|
|
543
|
+
const candidates = database.listAll();
|
|
544
|
+
return emojisFrom(candidates, pattern, Optional.some(maxResults));
|
|
545
|
+
}),
|
|
546
|
+
onAction: (autocompleteApi, rng, value) => {
|
|
599
547
|
editor.selection.setRng(rng);
|
|
600
548
|
editor.insertContent(value);
|
|
601
549
|
autocompleteApi.hide();
|
|
@@ -603,34 +551,46 @@
|
|
|
603
551
|
});
|
|
604
552
|
};
|
|
605
553
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
554
|
+
const onSetupEditable = editor => api => {
|
|
555
|
+
const nodeChanged = () => {
|
|
556
|
+
api.setEnabled(editor.selection.isEditable());
|
|
557
|
+
};
|
|
558
|
+
editor.on('NodeChange', nodeChanged);
|
|
559
|
+
nodeChanged();
|
|
560
|
+
return () => {
|
|
561
|
+
editor.off('NodeChange', nodeChanged);
|
|
609
562
|
};
|
|
563
|
+
};
|
|
564
|
+
const register = editor => {
|
|
565
|
+
const onAction = () => editor.execCommand('mceEmoticons');
|
|
610
566
|
editor.ui.registry.addButton('emoticons', {
|
|
611
|
-
tooltip: '
|
|
567
|
+
tooltip: 'Emojis',
|
|
612
568
|
icon: 'emoji',
|
|
613
|
-
onAction
|
|
569
|
+
onAction,
|
|
570
|
+
onSetup: onSetupEditable(editor)
|
|
614
571
|
});
|
|
615
572
|
editor.ui.registry.addMenuItem('emoticons', {
|
|
616
|
-
text: '
|
|
573
|
+
text: 'Emojis...',
|
|
617
574
|
icon: 'emoji',
|
|
618
|
-
onAction
|
|
575
|
+
onAction,
|
|
576
|
+
onSetup: onSetupEditable(editor)
|
|
619
577
|
});
|
|
620
578
|
};
|
|
621
579
|
|
|
622
|
-
|
|
623
|
-
global$
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
580
|
+
var Plugin = () => {
|
|
581
|
+
global$1.add('emoticons', (editor, pluginUrl) => {
|
|
582
|
+
register$2(editor, pluginUrl);
|
|
583
|
+
const databaseUrl = getEmojiDatabaseUrl(editor);
|
|
584
|
+
const databaseId = getEmojiDatabaseId(editor);
|
|
585
|
+
const database = initDatabase(editor, databaseUrl, databaseId);
|
|
627
586
|
register$1(editor, database);
|
|
628
587
|
register(editor);
|
|
629
588
|
init(editor, database);
|
|
630
589
|
setup(editor);
|
|
590
|
+
return { getAllEmojis: () => database.waitForLoad().then(() => database.listAll()) };
|
|
631
591
|
});
|
|
632
|
-
}
|
|
592
|
+
};
|
|
633
593
|
|
|
634
594
|
Plugin();
|
|
635
595
|
|
|
636
|
-
}()
|
|
596
|
+
})();
|