@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.
Files changed (241) hide show
  1. package/README.md +1 -7
  2. package/esm2022/lib/angular-material-shared.module.mjs +2 -2
  3. package/esm2022/lib/components/tiny-mce/tiny-mce.component.mjs +16 -19
  4. package/fesm2022/dangl-angular-material-shared.mjs +16 -19
  5. package/fesm2022/dangl-angular-material-shared.mjs.map +1 -1
  6. package/lib/components/tiny-mce/tiny-mce.component.d.ts +7 -8
  7. package/package.json +1 -1
  8. package/tinymce-assets/icons/default/icons.js +187 -171
  9. package/tinymce-assets/icons/default/icons.min.js +1 -1
  10. package/tinymce-assets/langs/it.js +1 -1
  11. package/tinymce-assets/plugins/accordion/index.js +7 -0
  12. package/tinymce-assets/plugins/accordion/plugin.js +1054 -0
  13. package/tinymce-assets/plugins/accordion/plugin.min.js +4 -0
  14. package/tinymce-assets/plugins/advlist/plugin.js +185 -187
  15. package/tinymce-assets/plugins/advlist/plugin.min.js +2 -7
  16. package/tinymce-assets/plugins/anchor/plugin.js +79 -81
  17. package/tinymce-assets/plugins/anchor/plugin.min.js +2 -7
  18. package/tinymce-assets/plugins/autolink/plugin.js +209 -194
  19. package/tinymce-assets/plugins/autolink/plugin.min.js +2 -7
  20. package/tinymce-assets/plugins/autoresize/plugin.js +110 -102
  21. package/tinymce-assets/plugins/autoresize/plugin.min.js +2 -7
  22. package/tinymce-assets/plugins/autosave/plugin.js +125 -104
  23. package/tinymce-assets/plugins/autosave/plugin.min.js +2 -7
  24. package/tinymce-assets/plugins/charmap/plugin.js +275 -313
  25. package/tinymce-assets/plugins/charmap/plugin.min.js +2 -7
  26. package/tinymce-assets/plugins/code/plugin.js +18 -24
  27. package/tinymce-assets/plugins/code/plugin.min.js +2 -7
  28. package/tinymce-assets/plugins/codesample/plugin.js +2075 -2074
  29. package/tinymce-assets/plugins/codesample/plugin.min.js +2 -7
  30. package/tinymce-assets/plugins/directionality/plugin.js +247 -305
  31. package/tinymce-assets/plugins/directionality/plugin.min.js +2 -7
  32. package/tinymce-assets/plugins/emoticons/js/emojiimages.js +1 -9424
  33. package/tinymce-assets/plugins/emoticons/js/emojiimages.min.js +1 -1
  34. package/tinymce-assets/plugins/emoticons/js/emojis.js +1 -9423
  35. package/tinymce-assets/plugins/emoticons/js/emojis.min.js +1 -1
  36. package/tinymce-assets/plugins/emoticons/plugin.js +334 -374
  37. package/tinymce-assets/plugins/emoticons/plugin.min.js +2 -7
  38. package/tinymce-assets/plugins/fullscreen/plugin.js +740 -837
  39. package/tinymce-assets/plugins/fullscreen/plugin.min.js +2 -7
  40. package/tinymce-assets/plugins/help/js/i18n/keynav/ar.js +90 -0
  41. package/tinymce-assets/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
  42. package/tinymce-assets/plugins/help/js/i18n/keynav/ca.js +90 -0
  43. package/tinymce-assets/plugins/help/js/i18n/keynav/cs.js +90 -0
  44. package/tinymce-assets/plugins/help/js/i18n/keynav/da.js +90 -0
  45. package/tinymce-assets/plugins/help/js/i18n/keynav/de.js +90 -0
  46. package/tinymce-assets/plugins/help/js/i18n/keynav/el.js +90 -0
  47. package/tinymce-assets/plugins/help/js/i18n/keynav/en.js +90 -0
  48. package/tinymce-assets/plugins/help/js/i18n/keynav/es.js +90 -0
  49. package/tinymce-assets/plugins/help/js/i18n/keynav/eu.js +90 -0
  50. package/tinymce-assets/plugins/help/js/i18n/keynav/fa.js +90 -0
  51. package/tinymce-assets/plugins/help/js/i18n/keynav/fi.js +90 -0
  52. package/tinymce-assets/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
  53. package/tinymce-assets/plugins/help/js/i18n/keynav/he_IL.js +90 -0
  54. package/tinymce-assets/plugins/help/js/i18n/keynav/hi.js +90 -0
  55. package/tinymce-assets/plugins/help/js/i18n/keynav/hr.js +90 -0
  56. package/tinymce-assets/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
  57. package/tinymce-assets/plugins/help/js/i18n/keynav/id.js +90 -0
  58. package/tinymce-assets/plugins/help/js/i18n/keynav/it.js +90 -0
  59. package/tinymce-assets/plugins/help/js/i18n/keynav/ja.js +90 -0
  60. package/tinymce-assets/plugins/help/js/i18n/keynav/kk.js +90 -0
  61. package/tinymce-assets/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
  62. package/tinymce-assets/plugins/help/js/i18n/keynav/ms.js +90 -0
  63. package/tinymce-assets/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
  64. package/tinymce-assets/plugins/help/js/i18n/keynav/nl.js +90 -0
  65. package/tinymce-assets/plugins/help/js/i18n/keynav/pl.js +90 -0
  66. package/tinymce-assets/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
  67. package/tinymce-assets/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
  68. package/tinymce-assets/plugins/help/js/i18n/keynav/ro.js +90 -0
  69. package/tinymce-assets/plugins/help/js/i18n/keynav/ru.js +90 -0
  70. package/tinymce-assets/plugins/help/js/i18n/keynav/sk.js +90 -0
  71. package/tinymce-assets/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
  72. package/tinymce-assets/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
  73. package/tinymce-assets/plugins/help/js/i18n/keynav/th_TH.js +90 -0
  74. package/tinymce-assets/plugins/help/js/i18n/keynav/tr.js +90 -0
  75. package/tinymce-assets/plugins/help/js/i18n/keynav/uk.js +90 -0
  76. package/tinymce-assets/plugins/help/js/i18n/keynav/vi.js +90 -0
  77. package/tinymce-assets/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
  78. package/tinymce-assets/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
  79. package/tinymce-assets/plugins/help/plugin.js +411 -355
  80. package/tinymce-assets/plugins/help/plugin.min.js +2 -7
  81. package/tinymce-assets/plugins/image/plugin.js +876 -1037
  82. package/tinymce-assets/plugins/image/plugin.min.js +2 -7
  83. package/tinymce-assets/plugins/importcss/plugin.js +146 -144
  84. package/tinymce-assets/plugins/importcss/plugin.min.js +2 -7
  85. package/tinymce-assets/plugins/insertdatetime/plugin.js +93 -88
  86. package/tinymce-assets/plugins/insertdatetime/plugin.min.js +2 -7
  87. package/tinymce-assets/plugins/link/plugin.js +718 -768
  88. package/tinymce-assets/plugins/link/plugin.min.js +2 -7
  89. package/tinymce-assets/plugins/lists/plugin.js +1235 -1375
  90. package/tinymce-assets/plugins/lists/plugin.min.js +2 -7
  91. package/tinymce-assets/plugins/media/plugin.js +614 -756
  92. package/tinymce-assets/plugins/media/plugin.min.js +2 -7
  93. package/tinymce-assets/plugins/nonbreaking/plugin.js +71 -48
  94. package/tinymce-assets/plugins/nonbreaking/plugin.min.js +2 -7
  95. package/tinymce-assets/plugins/pagebreak/plugin.js +53 -40
  96. package/tinymce-assets/plugins/pagebreak/plugin.min.js +2 -7
  97. package/tinymce-assets/plugins/preview/plugin.js +36 -65
  98. package/tinymce-assets/plugins/preview/plugin.min.js +2 -7
  99. package/tinymce-assets/plugins/quickbars/plugin.js +304 -331
  100. package/tinymce-assets/plugins/quickbars/plugin.min.js +2 -7
  101. package/tinymce-assets/plugins/save/plugin.js +49 -50
  102. package/tinymce-assets/plugins/save/plugin.min.js +2 -7
  103. package/tinymce-assets/plugins/searchreplace/plugin.js +499 -571
  104. package/tinymce-assets/plugins/searchreplace/plugin.min.js +2 -7
  105. package/tinymce-assets/plugins/table/plugin.js +2572 -10617
  106. package/tinymce-assets/plugins/table/plugin.min.js +2 -7
  107. package/tinymce-assets/plugins/visualblocks/plugin.js +41 -46
  108. package/tinymce-assets/plugins/visualblocks/plugin.min.js +2 -7
  109. package/tinymce-assets/plugins/visualchars/plugin.js +346 -312
  110. package/tinymce-assets/plugins/visualchars/plugin.min.js +2 -7
  111. package/tinymce-assets/plugins/wordcount/plugin.js +159 -179
  112. package/tinymce-assets/plugins/wordcount/plugin.min.js +2 -7
  113. package/tinymce-assets/skins/content/dark/content.css +2 -8
  114. package/tinymce-assets/skins/content/dark/content.js +2 -0
  115. package/tinymce-assets/skins/content/dark/content.min.css +1 -7
  116. package/tinymce-assets/skins/content/default/content.css +0 -6
  117. package/tinymce-assets/skins/content/default/content.js +2 -0
  118. package/tinymce-assets/skins/content/default/content.min.css +0 -6
  119. package/tinymce-assets/skins/content/document/content.css +0 -6
  120. package/tinymce-assets/skins/content/document/content.js +2 -0
  121. package/tinymce-assets/skins/content/document/content.min.css +0 -6
  122. package/tinymce-assets/skins/content/tinymce-5/content.css +61 -0
  123. package/tinymce-assets/skins/content/tinymce-5/content.js +2 -0
  124. package/tinymce-assets/skins/content/tinymce-5/content.min.css +1 -0
  125. package/tinymce-assets/skins/content/tinymce-5-dark/content.css +66 -0
  126. package/tinymce-assets/skins/content/tinymce-5-dark/content.js +2 -0
  127. package/tinymce-assets/skins/content/tinymce-5-dark/content.min.css +1 -0
  128. package/tinymce-assets/skins/content/writer/content.css +0 -6
  129. package/tinymce-assets/skins/content/writer/content.js +2 -0
  130. package/tinymce-assets/skins/content/writer/content.min.css +0 -6
  131. package/tinymce-assets/skins/ui/oxide/content.css +73 -20
  132. package/tinymce-assets/skins/ui/oxide/content.inline.css +73 -20
  133. package/tinymce-assets/skins/ui/oxide/content.inline.js +2 -0
  134. package/tinymce-assets/skins/ui/oxide/content.inline.min.css +1 -7
  135. package/tinymce-assets/skins/ui/oxide/content.js +2 -0
  136. package/tinymce-assets/skins/ui/oxide/content.min.css +1 -7
  137. package/tinymce-assets/skins/ui/oxide/skin.css +1480 -435
  138. package/tinymce-assets/skins/ui/oxide/skin.js +2 -0
  139. package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -7
  140. package/tinymce-assets/skins/ui/oxide/skin.shadowdom.css +1 -8
  141. package/tinymce-assets/skins/ui/oxide/skin.shadowdom.js +2 -0
  142. package/tinymce-assets/skins/ui/oxide/skin.shadowdom.min.css +1 -7
  143. package/tinymce-assets/skins/ui/oxide-dark/content.css +71 -19
  144. package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +73 -20
  145. package/tinymce-assets/skins/ui/oxide-dark/content.inline.js +2 -0
  146. package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +1 -7
  147. package/tinymce-assets/skins/ui/oxide-dark/content.js +2 -0
  148. package/tinymce-assets/skins/ui/oxide-dark/content.min.css +1 -7
  149. package/tinymce-assets/skins/ui/oxide-dark/skin.css +1498 -450
  150. package/tinymce-assets/skins/ui/oxide-dark/skin.js +2 -0
  151. package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -7
  152. package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.css +1 -8
  153. package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  154. package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -7
  155. package/tinymce-assets/skins/ui/tinymce-5/content.css +785 -0
  156. package/tinymce-assets/skins/ui/tinymce-5/content.inline.css +779 -0
  157. package/tinymce-assets/skins/ui/tinymce-5/content.inline.js +2 -0
  158. package/tinymce-assets/skins/ui/tinymce-5/content.inline.min.css +1 -0
  159. package/tinymce-assets/skins/ui/tinymce-5/content.js +2 -0
  160. package/tinymce-assets/skins/ui/tinymce-5/content.min.css +1 -0
  161. package/tinymce-assets/skins/ui/tinymce-5/skin.css +4185 -0
  162. package/tinymce-assets/skins/ui/tinymce-5/skin.js +2 -0
  163. package/tinymce-assets/skins/ui/tinymce-5/skin.min.css +1 -0
  164. package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
  165. package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
  166. package/tinymce-assets/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  167. package/tinymce-assets/skins/ui/tinymce-5-dark/content.css +766 -0
  168. package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.css +779 -0
  169. package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.js +2 -0
  170. package/tinymce-assets/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  171. package/tinymce-assets/skins/ui/tinymce-5-dark/content.js +2 -0
  172. package/tinymce-assets/skins/ui/tinymce-5-dark/content.min.css +1 -0
  173. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.css +4185 -0
  174. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.js +2 -0
  175. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  176. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
  177. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
  178. package/tinymce-assets/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  179. package/tinymce-assets/themes/silver/theme.js +25226 -28188
  180. package/tinymce-assets/themes/silver/theme.min.js +2 -7
  181. package/tinymce-assets/plugins/bbcode/index.js +0 -7
  182. package/tinymce-assets/plugins/bbcode/plugin.js +0 -99
  183. package/tinymce-assets/plugins/bbcode/plugin.min.js +0 -9
  184. package/tinymce-assets/plugins/colorpicker/index.js +0 -7
  185. package/tinymce-assets/plugins/colorpicker/plugin.js +0 -21
  186. package/tinymce-assets/plugins/colorpicker/plugin.min.js +0 -9
  187. package/tinymce-assets/plugins/contextmenu/index.js +0 -7
  188. package/tinymce-assets/plugins/contextmenu/plugin.js +0 -21
  189. package/tinymce-assets/plugins/contextmenu/plugin.min.js +0 -9
  190. package/tinymce-assets/plugins/fullpage/index.js +0 -7
  191. package/tinymce-assets/plugins/fullpage/plugin.js +0 -544
  192. package/tinymce-assets/plugins/fullpage/plugin.min.js +0 -9
  193. package/tinymce-assets/plugins/hr/index.js +0 -7
  194. package/tinymce-assets/plugins/hr/plugin.js +0 -45
  195. package/tinymce-assets/plugins/hr/plugin.min.js +0 -9
  196. package/tinymce-assets/plugins/imagetools/index.js +0 -7
  197. package/tinymce-assets/plugins/imagetools/plugin.js +0 -1531
  198. package/tinymce-assets/plugins/imagetools/plugin.min.js +0 -9
  199. package/tinymce-assets/plugins/legacyoutput/index.js +0 -7
  200. package/tinymce-assets/plugins/legacyoutput/plugin.js +0 -199
  201. package/tinymce-assets/plugins/legacyoutput/plugin.min.js +0 -9
  202. package/tinymce-assets/plugins/noneditable/index.js +0 -7
  203. package/tinymce-assets/plugins/noneditable/plugin.js +0 -117
  204. package/tinymce-assets/plugins/noneditable/plugin.min.js +0 -9
  205. package/tinymce-assets/plugins/paste/index.js +0 -7
  206. package/tinymce-assets/plugins/paste/plugin.js +0 -1803
  207. package/tinymce-assets/plugins/paste/plugin.min.js +0 -9
  208. package/tinymce-assets/plugins/print/index.js +0 -7
  209. package/tinymce-assets/plugins/print/plugin.js +0 -52
  210. package/tinymce-assets/plugins/print/plugin.min.js +0 -9
  211. package/tinymce-assets/plugins/spellchecker/index.js +0 -7
  212. package/tinymce-assets/plugins/spellchecker/plugin.js +0 -730
  213. package/tinymce-assets/plugins/spellchecker/plugin.min.js +0 -9
  214. package/tinymce-assets/plugins/tabfocus/index.js +0 -7
  215. package/tinymce-assets/plugins/tabfocus/plugin.js +0 -130
  216. package/tinymce-assets/plugins/tabfocus/plugin.min.js +0 -9
  217. package/tinymce-assets/plugins/template/index.js +0 -7
  218. package/tinymce-assets/plugins/template/plugin.js +0 -591
  219. package/tinymce-assets/plugins/template/plugin.min.js +0 -9
  220. package/tinymce-assets/plugins/textcolor/index.js +0 -7
  221. package/tinymce-assets/plugins/textcolor/plugin.js +0 -21
  222. package/tinymce-assets/plugins/textcolor/plugin.min.js +0 -9
  223. package/tinymce-assets/plugins/textpattern/index.js +0 -7
  224. package/tinymce-assets/plugins/textpattern/plugin.js +0 -1374
  225. package/tinymce-assets/plugins/textpattern/plugin.min.js +0 -9
  226. package/tinymce-assets/plugins/toc/index.js +0 -7
  227. package/tinymce-assets/plugins/toc/plugin.js +0 -238
  228. package/tinymce-assets/plugins/toc/plugin.min.js +0 -9
  229. package/tinymce-assets/skins/ui/oxide/content.mobile.css +0 -29
  230. package/tinymce-assets/skins/ui/oxide/content.mobile.min.css +0 -7
  231. package/tinymce-assets/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
  232. package/tinymce-assets/skins/ui/oxide/skin.mobile.css +0 -673
  233. package/tinymce-assets/skins/ui/oxide/skin.mobile.min.css +0 -7
  234. package/tinymce-assets/skins/ui/oxide-dark/content.mobile.css +0 -29
  235. package/tinymce-assets/skins/ui/oxide-dark/content.mobile.min.css +0 -7
  236. package/tinymce-assets/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
  237. package/tinymce-assets/skins/ui/oxide-dark/skin.mobile.css +0 -673
  238. package/tinymce-assets/skins/ui/oxide-dark/skin.mobile.min.css +0 -7
  239. package/tinymce-assets/themes/mobile/index.js +0 -7
  240. package/tinymce-assets/themes/mobile/theme.js +0 -13130
  241. package/tinymce-assets/themes/mobile/theme.min.js +0 -9
@@ -1,252 +1,222 @@
1
1
  /**
2
- * Copyright (c) Tiny Technologies, Inc. All rights reserved.
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$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
8
+ var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');
13
9
 
14
- var eq = function (t) {
15
- return function (a) {
16
- return t === a;
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
- var noop = function () {
16
+ const noop = () => {
22
17
  };
23
- var constant = function (value) {
24
- return function () {
18
+ const constant = value => {
19
+ return () => {
25
20
  return value;
26
21
  };
27
22
  };
28
- var identity = function (x) {
29
- return x;
30
- };
31
- var never = constant(false);
32
- var always = constant(true);
23
+ const never = constant(false);
33
24
 
34
- var none = function () {
35
- return NONE;
36
- };
37
- var NONE = function () {
38
- var call = function (thunk) {
39
- return thunk();
40
- };
41
- var id = identity;
42
- var me = {
43
- fold: function (n, _s) {
44
- return n();
45
- },
46
- isSome: never,
47
- isNone: always,
48
- getOr: id,
49
- getOrThunk: call,
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
- return me;
113
- };
114
- var from = function (value) {
115
- return value === null || value === undefined ? NONE : some(value);
116
- };
117
- var Optional = {
118
- some: some,
119
- none: none,
120
- from: from
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
- var exists = function (xs, pred) {
124
- for (var i = 0, len = xs.length; i < len; i++) {
125
- var x = xs[i];
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
- var map$1 = function (xs, f) {
133
- var len = xs.length;
134
- var r = new Array(len);
135
- for (var i = 0; i < len; i++) {
136
- var x = xs[i];
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
- var each$1 = function (xs, f) {
142
- for (var i = 0, len = xs.length; i < len; i++) {
143
- var x = xs[i];
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
- var Cell = function (initial) {
149
- var value = initial;
150
- var get = function () {
143
+ const Cell = initial => {
144
+ let value = initial;
145
+ const get = () => {
151
146
  return value;
152
147
  };
153
- var set = function (v) {
148
+ const set = v => {
154
149
  value = v;
155
150
  };
156
151
  return {
157
- get: get,
158
- set: set
152
+ get,
153
+ set
159
154
  };
160
155
  };
161
156
 
162
- var last = function (fn, rate) {
163
- var timer = null;
164
- var cancel = function () {
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
- var throttle = function () {
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(function () {
167
+ timer = setTimeout(() => {
177
168
  timer = null;
178
169
  fn.apply(null, args);
179
170
  }, rate);
180
171
  };
181
172
  return {
182
- cancel: cancel,
183
- throttle: throttle
173
+ cancel,
174
+ throttle
184
175
  };
185
176
  };
186
177
 
187
- var insertEmoticon = function (editor, ch) {
178
+ const insertEmoticon = (editor, ch) => {
188
179
  editor.insertContent(ch);
189
180
  };
190
181
 
191
- var __assign = function () {
192
- __assign = Object.assign || function __assign(t) {
193
- for (var s, i = 1, n = arguments.length; i < n; i++) {
194
- s = arguments[i];
195
- for (var p in s)
196
- if (Object.prototype.hasOwnProperty.call(s, p))
197
- t[p] = s[p];
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
- var map = function (obj, f) {
215
- return tupleMap(obj, function (x, i) {
216
- return {
217
- k: i,
218
- v: f(x, i)
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
- var tupleMap = function (obj, f) {
223
- var r = {};
224
- each(obj, function (x, i) {
225
- var tuple = f(x, i);
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
- var has = function (obj, key) {
231
- return hasOwnProperty.call(obj, key);
232
- };
206
+ const has = (obj, key) => hasOwnProperty.call(obj, key);
233
207
 
234
- var shallow = function (old, nu) {
208
+ const shallow = (old, nu) => {
235
209
  return nu;
236
210
  };
237
- var baseMerge = function (merger) {
238
- return function () {
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('Can\'t merge zero objects');
214
+ throw new Error(`Can't merge zero objects`);
245
215
  }
246
- var ret = {};
247
- for (var j = 0; j < objects.length; j++) {
248
- var curObject = objects[j];
249
- for (var key in curObject) {
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
- var merge = baseMerge(shallow);
228
+ const merge = baseMerge(shallow);
259
229
 
260
- var singleton = function (doRevoke) {
261
- var subject = Cell(Optional.none());
262
- var revoke = function () {
263
- return subject.get().each(doRevoke);
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
- var isSet = function () {
270
- return subject.get().isSome();
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: clear,
281
- isSet: isSet,
282
- get: get,
283
- set: set
244
+ clear,
245
+ isSet,
246
+ get,
247
+ set
284
248
  };
285
249
  };
286
- var value = function () {
287
- var subject = singleton(noop);
288
- var on = function (f) {
289
- return subject.get().each(f);
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
- var checkRange = function (str, substr, start) {
295
- return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;
296
- };
297
- var contains = function (str, substr) {
298
- return str.indexOf(substr) !== -1;
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
- var startsWith = function (str, prefix) {
268
+ const startsWith = (str, prefix) => {
301
269
  return checkRange(str, prefix, 0);
302
270
  };
303
271
 
304
- var global$2 = tinymce.util.Tools.resolve('tinymce.Resource');
305
-
306
- var global$1 = tinymce.util.Tools.resolve('tinymce.util.Delay');
272
+ var global = tinymce.util.Tools.resolve('tinymce.Resource');
307
273
 
308
- var global = tinymce.util.Tools.resolve('tinymce.util.Promise');
309
-
310
- var DEFAULT_ID = 'tinymce.plugins.emoticons';
311
- var getEmoticonDatabase = function (editor) {
312
- return editor.getParam('emoticons_database', 'emojis', 'string');
313
- };
314
- var getEmoticonDatabaseUrl = function (editor, pluginUrl) {
315
- var database = getEmoticonDatabase(editor);
316
- return editor.getParam('emoticons_database_url', pluginUrl + '/js/' + database + editor.suffix + '.js', 'string');
317
- };
318
- var getEmoticonDatabaseId = function (editor) {
319
- return editor.getParam('emoticons_database_id', DEFAULT_ID, 'string');
320
- };
321
- var getAppendedEmoticons = function (editor) {
322
- return editor.getParam('emoticons_append', {}, 'object');
323
- };
324
- var getEmotionsImageUrl = function (editor) {
325
- return editor.getParam('emoticons_images_url', 'https://twemoji.maxcdn.com/v/13.0.1/72x72/', 'string');
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
- var ALL_CATEGORY = 'All';
329
- var categoryNameMap = {
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
- var translateCategory = function (categories, name) {
341
- return has(categories, name) ? categories[name] : name;
342
- };
343
- var getUserDefinedEmoticons = function (editor) {
344
- var userDefinedEmoticons = getAppendedEmoticons(editor);
345
- return map(userDefinedEmoticons, function (value) {
346
- return __assign({
347
- keywords: [],
348
- category: 'user'
349
- }, value);
350
- });
351
- };
352
- var initDatabase = function (editor, databaseUrl, databaseId) {
353
- var categories = value();
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="([^"]+)"/, function (match, url) {
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
- var processEmojis = function (emojis) {
366
- var cats = {};
367
- var everything = [];
368
- each(emojis, function (lib, title) {
369
- var entry = {
370
- title: 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
- var current = cats[entry.category] !== undefined ? cats[entry.category] : [];
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', function () {
383
- global$2.load(databaseId, databaseUrl).then(function (emojis) {
384
- var userEmojis = getUserDefinedEmoticons(editor);
354
+ editor.on('init', () => {
355
+ global.load(databaseId, databaseUrl).then(emojis => {
356
+ const userEmojis = getUserDefinedEmoji(editor);
385
357
  processEmojis(merge(emojis, userEmojis));
386
- }, function (err) {
387
- console.log('Failed to load emoticons: ' + err);
358
+ }, err => {
359
+ console.log(`Failed to load emojis: ${ err }`);
388
360
  categories.set({});
389
361
  all.set([]);
390
362
  });
391
363
  });
392
- var listCategory = function (category) {
364
+ const listCategory = category => {
393
365
  if (category === ALL_CATEGORY) {
394
366
  return listAll();
395
367
  }
396
- return categories.get().bind(function (cats) {
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
- var waitForLoad = function () {
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 global.resolve(true);
374
+ return Promise.resolve(true);
409
375
  } else {
410
- return new global(function (resolve, reject) {
411
- var numRetries = 15;
412
- var interval = global$1.setInterval(function () {
376
+ return new Promise((resolve, reject) => {
377
+ let numRetries = 15;
378
+ const interval = setInterval(() => {
413
379
  if (hasLoaded()) {
414
- global$1.clearInterval(interval);
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
- global$1.clearInterval(interval);
386
+ clearInterval(interval);
421
387
  reject(false);
422
388
  }
423
389
  }
@@ -425,34 +391,22 @@
425
391
  });
426
392
  }
427
393
  };
428
- var hasLoaded = function () {
429
- return categories.isSet() && all.isSet();
430
- };
394
+ const hasLoaded = () => categories.isSet() && all.isSet();
431
395
  return {
432
- listCategories: listCategories,
433
- hasLoaded: hasLoaded,
434
- waitForLoad: waitForLoad,
435
- listAll: listAll,
436
- listCategory: listCategory
396
+ listCategories,
397
+ hasLoaded,
398
+ waitForLoad,
399
+ listAll,
400
+ listCategory
437
401
  };
438
402
  };
439
403
 
440
- var emojiMatches = function (emoji, lowerCasePattern) {
441
- return contains(emoji.title.toLowerCase(), lowerCasePattern) || exists(emoji.keywords, function (k) {
442
- return contains(k.toLowerCase(), lowerCasePattern);
443
- });
444
- };
445
- var emojisFrom = function (list, pattern, maxResults) {
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
- var patternName = 'pattern';
471
- var open = function (editor, database) {
472
- var initialState = {
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
- var currentTab = Cell(ALL_CATEGORY);
477
- var scan = function (dialogApi) {
478
- var dialogData = dialogApi.getData();
479
- var category = currentTab.get();
480
- var candidates = database.listCategory(category);
481
- var results = emojisFrom(candidates, dialogData[patternName], category === ALL_CATEGORY ? Optional.some(300) : Optional.none());
482
- dialogApi.setData({ results: 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
- var updateFilter = last(function (dialogApi) {
438
+ const updateFilter = last(dialogApi => {
485
439
  scan(dialogApi);
486
440
  }, 200);
487
- var searchField = {
441
+ const searchField = {
488
442
  label: 'Search',
489
443
  type: 'input',
490
444
  name: patternName
491
445
  };
492
- var resultsField = {
446
+ const resultsField = {
493
447
  type: 'collection',
494
448
  name: 'results'
495
449
  };
496
- var getInitialState = function () {
497
- var body = {
450
+ const getInitialState = () => {
451
+ const body = {
498
452
  type: 'tabpanel',
499
- tabs: map$1(database.listCategories(), function (cat) {
500
- return {
501
- title: cat,
502
- name: cat,
503
- items: [
504
- searchField,
505
- resultsField
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: 'Emoticons',
463
+ title: 'Emojis',
512
464
  size: 'normal',
513
- body: body,
465
+ body,
514
466
  initialData: initialState,
515
- onTabChange: function (dialogApi, details) {
467
+ onTabChange: (dialogApi, details) => {
516
468
  currentTab.set(details.newTabName);
517
469
  updateFilter.throttle(dialogApi);
518
470
  },
519
471
  onChange: updateFilter.throttle,
520
- onAction: function (dialogApi, actionData) {
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
- var dialogApi = editor.windowManager.open(getInitialState());
485
+ const dialogApi = editor.windowManager.open(getInitialState());
534
486
  dialogApi.focus(patternName);
535
487
  if (!database.hasLoaded()) {
536
- dialogApi.block('Loading emoticons...');
537
- database.waitForLoad().then(function () {
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(function (_err) {
494
+ }).catch(_err => {
543
495
  dialogApi.redial({
544
- title: 'Emoticons',
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: '<p>Could not load emoticons</p>'
503
+ text: 'Could not load emojis'
552
504
  }]
553
505
  },
554
506
  buttons: [{
@@ -567,16 +519,14 @@
567
519
  }
568
520
  };
569
521
 
570
- var register$1 = function (editor, database) {
571
- editor.addCommand('mceEmoticons', function () {
572
- return open(editor, database);
573
- });
522
+ const register$1 = (editor, database) => {
523
+ editor.addCommand('mceEmoticons', () => open(editor, database));
574
524
  };
575
525
 
576
- var setup = function (editor) {
577
- editor.on('PreInit', function () {
578
- editor.parser.addAttributeFilter('data-emoticon', function (nodes) {
579
- each$1(nodes, function (node) {
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
- var init = function (editor, database) {
537
+ const init = (editor, database) => {
588
538
  editor.ui.registry.addAutocompleter('emoticons', {
589
- ch: ':',
539
+ trigger: ':',
590
540
  columns: 'auto',
591
541
  minChars: 2,
592
- fetch: function (pattern, maxResults) {
593
- return database.waitForLoad().then(function () {
594
- var candidates = database.listAll();
595
- return emojisFrom(candidates, pattern, Optional.some(maxResults));
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
- var register = function (editor) {
607
- var onAction = function () {
608
- return editor.execCommand('mceEmoticons');
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: 'Emoticons',
567
+ tooltip: 'Emojis',
612
568
  icon: 'emoji',
613
- onAction: onAction
569
+ onAction,
570
+ onSetup: onSetupEditable(editor)
614
571
  });
615
572
  editor.ui.registry.addMenuItem('emoticons', {
616
- text: 'Emoticons...',
573
+ text: 'Emojis...',
617
574
  icon: 'emoji',
618
- onAction: onAction
575
+ onAction,
576
+ onSetup: onSetupEditable(editor)
619
577
  });
620
578
  };
621
579
 
622
- function Plugin () {
623
- global$3.add('emoticons', function (editor, pluginUrl) {
624
- var databaseUrl = getEmoticonDatabaseUrl(editor, pluginUrl);
625
- var databaseId = getEmoticonDatabaseId(editor);
626
- var database = initDatabase(editor, databaseUrl, databaseId);
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
+ })();