@dangl/angular-material-shared 2.5.1-beta0012 → 2.6.0-beta0019

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,188 +1,187 @@
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$7 = tinymce.util.Tools.resolve('tinymce.PluginManager');
13
-
14
- var global$6 = tinymce.util.Tools.resolve('tinymce.util.VK');
8
+ var global$5 = tinymce.util.Tools.resolve('tinymce.PluginManager');
15
9
 
16
- var typeOf = function (x) {
17
- var t = typeof x;
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;
18
20
  if (x === null) {
19
21
  return 'null';
20
- } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
22
+ } else if (t === 'object' && Array.isArray(x)) {
21
23
  return 'array';
22
- } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
24
+ } else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
23
25
  return 'string';
24
26
  } else {
25
27
  return t;
26
28
  }
27
29
  };
28
- var isType = function (type) {
29
- return function (value) {
30
- return typeOf(value) === type;
31
- };
32
- };
33
- var isSimpleType = function (type) {
34
- return function (value) {
35
- return typeof value === type;
36
- };
37
- };
38
- var eq = function (t) {
39
- return function (a) {
40
- return t === a;
41
- };
30
+ const isType = type => value => typeOf(value) === type;
31
+ const isSimpleType = type => value => typeof value === type;
32
+ const eq = t => a => t === a;
33
+ const isString = isType('string');
34
+ const isObject = isType('object');
35
+ const isArray = isType('array');
36
+ const isNull = eq(null);
37
+ const isBoolean = isSimpleType('boolean');
38
+ const isNullable = a => a === null || a === undefined;
39
+ const isNonNullable = a => !isNullable(a);
40
+ const isFunction = isSimpleType('function');
41
+ const isArrayOf = (value, pred) => {
42
+ if (isArray(value)) {
43
+ for (let i = 0, len = value.length; i < len; ++i) {
44
+ if (!pred(value[i])) {
45
+ return false;
46
+ }
47
+ }
48
+ return true;
49
+ }
50
+ return false;
42
51
  };
43
- var isString = isType('string');
44
- var isArray = isType('array');
45
- var isNull = eq(null);
46
- var isBoolean = isSimpleType('boolean');
47
- var isFunction = isSimpleType('function');
48
52
 
49
- var noop = function () {
53
+ const noop = () => {
50
54
  };
51
- var constant = function (value) {
52
- return function () {
55
+ const constant = value => {
56
+ return () => {
53
57
  return value;
54
58
  };
55
59
  };
56
- var identity = function (x) {
57
- return x;
58
- };
59
- var tripleEquals = function (a, b) {
60
+ const tripleEquals = (a, b) => {
60
61
  return a === b;
61
62
  };
62
- var never = constant(false);
63
- var always = constant(true);
64
63
 
65
- var none = function () {
66
- return NONE;
67
- };
68
- var NONE = function () {
69
- var call = function (thunk) {
70
- return thunk();
71
- };
72
- var id = identity;
73
- var me = {
74
- fold: function (n, _s) {
75
- return n();
76
- },
77
- isSome: never,
78
- isNone: always,
79
- getOr: id,
80
- getOrThunk: call,
81
- getOrDie: function (msg) {
82
- throw new Error(msg || 'error: getOrDie called on none.');
83
- },
84
- getOrNull: constant(null),
85
- getOrUndefined: constant(undefined),
86
- or: id,
87
- orThunk: call,
88
- map: none,
89
- each: noop,
90
- bind: none,
91
- exists: never,
92
- forall: always,
93
- filter: function () {
94
- return none();
95
- },
96
- toArray: function () {
97
- return [];
98
- },
99
- toString: constant('none()')
100
- };
101
- return me;
102
- }();
103
- var some = function (a) {
104
- var constant_a = constant(a);
105
- var self = function () {
106
- return me;
107
- };
108
- var bind = function (f) {
109
- return f(a);
110
- };
111
- var me = {
112
- fold: function (n, s) {
113
- return s(a);
114
- },
115
- isSome: always,
116
- isNone: never,
117
- getOr: constant_a,
118
- getOrThunk: constant_a,
119
- getOrDie: constant_a,
120
- getOrNull: constant_a,
121
- getOrUndefined: constant_a,
122
- or: self,
123
- orThunk: self,
124
- map: function (f) {
125
- return some(f(a));
126
- },
127
- each: function (f) {
128
- f(a);
129
- },
130
- bind: bind,
131
- exists: bind,
132
- forall: bind,
133
- filter: function (f) {
134
- return f(a) ? me : NONE;
135
- },
136
- toArray: function () {
137
- return [a];
138
- },
139
- toString: function () {
140
- return 'some(' + a + ')';
64
+ class Optional {
65
+ constructor(tag, value) {
66
+ this.tag = tag;
67
+ this.value = value;
68
+ }
69
+ static some(value) {
70
+ return new Optional(true, value);
71
+ }
72
+ static none() {
73
+ return Optional.singletonNone;
74
+ }
75
+ fold(onNone, onSome) {
76
+ if (this.tag) {
77
+ return onSome(this.value);
78
+ } else {
79
+ return onNone();
141
80
  }
142
- };
143
- return me;
144
- };
145
- var from = function (value) {
146
- return value === null || value === undefined ? NONE : some(value);
147
- };
148
- var Optional = {
149
- some: some,
150
- none: none,
151
- from: from
152
- };
81
+ }
82
+ isSome() {
83
+ return this.tag;
84
+ }
85
+ isNone() {
86
+ return !this.tag;
87
+ }
88
+ map(mapper) {
89
+ if (this.tag) {
90
+ return Optional.some(mapper(this.value));
91
+ } else {
92
+ return Optional.none();
93
+ }
94
+ }
95
+ bind(binder) {
96
+ if (this.tag) {
97
+ return binder(this.value);
98
+ } else {
99
+ return Optional.none();
100
+ }
101
+ }
102
+ exists(predicate) {
103
+ return this.tag && predicate(this.value);
104
+ }
105
+ forall(predicate) {
106
+ return !this.tag || predicate(this.value);
107
+ }
108
+ filter(predicate) {
109
+ if (!this.tag || predicate(this.value)) {
110
+ return this;
111
+ } else {
112
+ return Optional.none();
113
+ }
114
+ }
115
+ getOr(replacement) {
116
+ return this.tag ? this.value : replacement;
117
+ }
118
+ or(replacement) {
119
+ return this.tag ? this : replacement;
120
+ }
121
+ getOrThunk(thunk) {
122
+ return this.tag ? this.value : thunk();
123
+ }
124
+ orThunk(thunk) {
125
+ return this.tag ? this : thunk();
126
+ }
127
+ getOrDie(message) {
128
+ if (!this.tag) {
129
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
130
+ } else {
131
+ return this.value;
132
+ }
133
+ }
134
+ static from(value) {
135
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
136
+ }
137
+ getOrNull() {
138
+ return this.tag ? this.value : null;
139
+ }
140
+ getOrUndefined() {
141
+ return this.value;
142
+ }
143
+ each(worker) {
144
+ if (this.tag) {
145
+ worker(this.value);
146
+ }
147
+ }
148
+ toArray() {
149
+ return this.tag ? [this.value] : [];
150
+ }
151
+ toString() {
152
+ return this.tag ? `some(${ this.value })` : 'none()';
153
+ }
154
+ }
155
+ Optional.singletonNone = new Optional(false);
153
156
 
154
- var nativeIndexOf = Array.prototype.indexOf;
155
- var nativePush = Array.prototype.push;
156
- var rawIndexOf = function (ts, t) {
157
- return nativeIndexOf.call(ts, t);
158
- };
159
- var contains = function (xs, x) {
160
- return rawIndexOf(xs, x) > -1;
161
- };
162
- var map = function (xs, f) {
163
- var len = xs.length;
164
- var r = new Array(len);
165
- for (var i = 0; i < len; i++) {
166
- var x = xs[i];
157
+ const nativeIndexOf = Array.prototype.indexOf;
158
+ const nativePush = Array.prototype.push;
159
+ const rawIndexOf = (ts, t) => nativeIndexOf.call(ts, t);
160
+ const contains = (xs, x) => rawIndexOf(xs, x) > -1;
161
+ const map = (xs, f) => {
162
+ const len = xs.length;
163
+ const r = new Array(len);
164
+ for (let i = 0; i < len; i++) {
165
+ const x = xs[i];
167
166
  r[i] = f(x, i);
168
167
  }
169
168
  return r;
170
169
  };
171
- var each$1 = function (xs, f) {
172
- for (var i = 0, len = xs.length; i < len; i++) {
173
- var x = xs[i];
170
+ const each$1 = (xs, f) => {
171
+ for (let i = 0, len = xs.length; i < len; i++) {
172
+ const x = xs[i];
174
173
  f(x, i);
175
174
  }
176
175
  };
177
- var foldl = function (xs, f, acc) {
178
- each$1(xs, function (x, i) {
176
+ const foldl = (xs, f, acc) => {
177
+ each$1(xs, (x, i) => {
179
178
  acc = f(acc, x, i);
180
179
  });
181
180
  return acc;
182
181
  };
183
- var flatten = function (xs) {
184
- var r = [];
185
- for (var i = 0, len = xs.length; i < len; ++i) {
182
+ const flatten = xs => {
183
+ const r = [];
184
+ for (let i = 0, len = xs.length; i < len; ++i) {
186
185
  if (!isArray(xs[i])) {
187
186
  throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
188
187
  }
@@ -190,12 +189,10 @@
190
189
  }
191
190
  return r;
192
191
  };
193
- var bind = function (xs, f) {
194
- return flatten(map(xs, f));
195
- };
196
- var findMap = function (arr, f) {
197
- for (var i = 0; i < arr.length; i++) {
198
- var r = f(arr[i], i);
192
+ const bind = (xs, f) => flatten(map(xs, f));
193
+ const findMap = (arr, f) => {
194
+ for (let i = 0; i < arr.length; i++) {
195
+ const r = f(arr[i], i);
199
196
  if (r.isSome()) {
200
197
  return r;
201
198
  }
@@ -203,74 +200,102 @@
203
200
  return Optional.none();
204
201
  };
205
202
 
206
- var is = function (lhs, rhs, comparator) {
207
- if (comparator === void 0) {
208
- comparator = tripleEquals;
209
- }
210
- return lhs.exists(function (left) {
211
- return comparator(left, rhs);
212
- });
213
- };
214
- var cat = function (arr) {
215
- var r = [];
216
- var push = function (x) {
203
+ const is = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
204
+ const cat = arr => {
205
+ const r = [];
206
+ const push = x => {
217
207
  r.push(x);
218
208
  };
219
- for (var i = 0; i < arr.length; i++) {
209
+ for (let i = 0; i < arr.length; i++) {
220
210
  arr[i].each(push);
221
211
  }
222
212
  return r;
223
213
  };
224
- var someIf = function (b, a) {
225
- return b ? Optional.some(a) : Optional.none();
226
- };
214
+ const someIf = (b, a) => b ? Optional.some(a) : Optional.none();
227
215
 
228
- var assumeExternalTargets = function (editor) {
229
- var externalTargets = editor.getParam('link_assume_external_targets', false);
230
- if (isBoolean(externalTargets) && externalTargets) {
231
- return 1;
232
- } else if (isString(externalTargets) && (externalTargets === 'http' || externalTargets === 'https')) {
233
- return externalTargets;
234
- }
235
- return 0;
236
- };
237
- var hasContextToolbar = function (editor) {
238
- return editor.getParam('link_context_toolbar', false, 'boolean');
239
- };
240
- var getLinkList = function (editor) {
241
- return editor.getParam('link_list');
242
- };
243
- var getDefaultLinkTarget = function (editor) {
244
- return editor.getParam('default_link_target');
245
- };
246
- var getTargetList = function (editor) {
247
- return editor.getParam('target_list', true);
248
- };
249
- var getRelList = function (editor) {
250
- return editor.getParam('rel_list', [], 'array');
251
- };
252
- var getLinkClassList = function (editor) {
253
- return editor.getParam('link_class_list', [], 'array');
254
- };
255
- var shouldShowLinkTitle = function (editor) {
256
- return editor.getParam('link_title', true, 'boolean');
257
- };
258
- var allowUnsafeLinkTarget = function (editor) {
259
- return editor.getParam('allow_unsafe_link_target', false, 'boolean');
260
- };
261
- var useQuickLink = function (editor) {
262
- return editor.getParam('link_quicklink', false, 'boolean');
263
- };
264
- var getDefaultLinkProtocol = function (editor) {
265
- return editor.getParam('link_default_protocol', 'http', 'string');
216
+ const option = name => editor => editor.options.get(name);
217
+ const register$1 = editor => {
218
+ const registerOption = editor.options.register;
219
+ registerOption('link_assume_external_targets', {
220
+ processor: value => {
221
+ const valid = isString(value) || isBoolean(value);
222
+ if (valid) {
223
+ if (value === true) {
224
+ return {
225
+ value: 1,
226
+ valid
227
+ };
228
+ } else if (value === 'http' || value === 'https') {
229
+ return {
230
+ value,
231
+ valid
232
+ };
233
+ } else {
234
+ return {
235
+ value: 0,
236
+ valid
237
+ };
238
+ }
239
+ } else {
240
+ return {
241
+ valid: false,
242
+ message: 'Must be a string or a boolean.'
243
+ };
244
+ }
245
+ },
246
+ default: false
247
+ });
248
+ registerOption('link_context_toolbar', {
249
+ processor: 'boolean',
250
+ default: false
251
+ });
252
+ registerOption('link_list', { processor: value => isString(value) || isFunction(value) || isArrayOf(value, isObject) });
253
+ registerOption('link_default_target', { processor: 'string' });
254
+ registerOption('link_default_protocol', {
255
+ processor: 'string',
256
+ default: 'https'
257
+ });
258
+ registerOption('link_target_list', {
259
+ processor: value => isBoolean(value) || isArrayOf(value, isObject),
260
+ default: true
261
+ });
262
+ registerOption('link_rel_list', {
263
+ processor: 'object[]',
264
+ default: []
265
+ });
266
+ registerOption('link_class_list', {
267
+ processor: 'object[]',
268
+ default: []
269
+ });
270
+ registerOption('link_title', {
271
+ processor: 'boolean',
272
+ default: true
273
+ });
274
+ registerOption('allow_unsafe_link_target', {
275
+ processor: 'boolean',
276
+ default: false
277
+ });
278
+ registerOption('link_quicklink', {
279
+ processor: 'boolean',
280
+ default: false
281
+ });
266
282
  };
283
+ const assumeExternalTargets = option('link_assume_external_targets');
284
+ const hasContextToolbar = option('link_context_toolbar');
285
+ const getLinkList = option('link_list');
286
+ const getDefaultLinkTarget = option('link_default_target');
287
+ const getDefaultLinkProtocol = option('link_default_protocol');
288
+ const getTargetList = option('link_target_list');
289
+ const getRelList = option('link_rel_list');
290
+ const getLinkClassList = option('link_class_list');
291
+ const shouldShowLinkTitle = option('link_title');
292
+ const allowUnsafeLinkTarget = option('allow_unsafe_link_target');
293
+ const useQuickLink = option('link_quicklink');
267
294
 
268
- var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
295
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
269
296
 
270
- var getValue = function (item) {
271
- return isString(item.value) ? item.value : '';
272
- };
273
- var getText = function (item) {
297
+ const getValue = item => isString(item.value) ? item.value : '';
298
+ const getText = item => {
274
299
  if (isString(item.text)) {
275
300
  return item.text;
276
301
  } else if (isString(item.title)) {
@@ -279,121 +304,82 @@
279
304
  return '';
280
305
  }
281
306
  };
282
- var sanitizeList = function (list, extractValue) {
283
- var out = [];
284
- global$5.each(list, function (item) {
285
- var text = getText(item);
307
+ const sanitizeList = (list, extractValue) => {
308
+ const out = [];
309
+ global$4.each(list, item => {
310
+ const text = getText(item);
286
311
  if (item.menu !== undefined) {
287
- var items = sanitizeList(item.menu, extractValue);
312
+ const items = sanitizeList(item.menu, extractValue);
288
313
  out.push({
289
- text: text,
290
- items: items
314
+ text,
315
+ items
291
316
  });
292
317
  } else {
293
- var value = extractValue(item);
318
+ const value = extractValue(item);
294
319
  out.push({
295
- text: text,
296
- value: value
320
+ text,
321
+ value
297
322
  });
298
323
  }
299
324
  });
300
325
  return out;
301
326
  };
302
- var sanitizeWith = function (extracter) {
303
- if (extracter === void 0) {
304
- extracter = getValue;
305
- }
306
- return function (list) {
307
- return Optional.from(list).map(function (list) {
308
- return sanitizeList(list, extracter);
309
- });
310
- };
311
- };
312
- var sanitize = function (list) {
313
- return sanitizeWith(getValue)(list);
314
- };
315
- var createUi = function (name, label) {
316
- return function (items) {
317
- return {
318
- name: name,
319
- type: 'listbox',
320
- label: label,
321
- items: items
322
- };
323
- };
324
- };
325
- var ListOptions = {
326
- sanitize: sanitize,
327
- sanitizeWith: sanitizeWith,
328
- createUi: createUi,
329
- getValue: getValue
327
+ const sanitizeWith = (extracter = getValue) => list => Optional.from(list).map(list => sanitizeList(list, extracter));
328
+ const sanitize = list => sanitizeWith(getValue)(list);
329
+ const createUi = (name, label) => items => ({
330
+ name,
331
+ type: 'listbox',
332
+ label,
333
+ items
334
+ });
335
+ const ListOptions = {
336
+ sanitize,
337
+ sanitizeWith,
338
+ createUi,
339
+ getValue
330
340
  };
331
341
 
332
- var __assign = function () {
333
- __assign = Object.assign || function __assign(t) {
334
- for (var s, i = 1, n = arguments.length; i < n; i++) {
335
- s = arguments[i];
336
- for (var p in s)
337
- if (Object.prototype.hasOwnProperty.call(s, p))
338
- t[p] = s[p];
339
- }
340
- return t;
341
- };
342
- return __assign.apply(this, arguments);
343
- };
344
-
345
- var keys = Object.keys;
346
- var hasOwnProperty = Object.hasOwnProperty;
347
- var each = function (obj, f) {
348
- var props = keys(obj);
349
- for (var k = 0, len = props.length; k < len; k++) {
350
- var i = props[k];
351
- var x = obj[i];
342
+ const keys = Object.keys;
343
+ const hasOwnProperty = Object.hasOwnProperty;
344
+ const each = (obj, f) => {
345
+ const props = keys(obj);
346
+ for (let k = 0, len = props.length; k < len; k++) {
347
+ const i = props[k];
348
+ const x = obj[i];
352
349
  f(x, i);
353
350
  }
354
351
  };
355
- var objAcc = function (r) {
356
- return function (x, i) {
357
- r[i] = x;
358
- };
352
+ const objAcc = r => (x, i) => {
353
+ r[i] = x;
359
354
  };
360
- var internalFilter = function (obj, pred, onTrue, onFalse) {
361
- var r = {};
362
- each(obj, function (x, i) {
355
+ const internalFilter = (obj, pred, onTrue, onFalse) => {
356
+ each(obj, (x, i) => {
363
357
  (pred(x, i) ? onTrue : onFalse)(x, i);
364
358
  });
365
- return r;
366
359
  };
367
- var filter = function (obj, pred) {
368
- var t = {};
360
+ const filter = (obj, pred) => {
361
+ const t = {};
369
362
  internalFilter(obj, pred, objAcc(t), noop);
370
363
  return t;
371
364
  };
372
- var has = function (obj, key) {
373
- return hasOwnProperty.call(obj, key);
374
- };
375
- var hasNonNullableKey = function (obj, key) {
376
- return has(obj, key) && obj[key] !== undefined && obj[key] !== null;
377
- };
365
+ const has = (obj, key) => hasOwnProperty.call(obj, key);
366
+ const hasNonNullableKey = (obj, key) => has(obj, key) && obj[key] !== undefined && obj[key] !== null;
378
367
 
379
- var global$4 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
368
+ var global$3 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
380
369
 
381
- var global$3 = tinymce.util.Tools.resolve('tinymce.util.URI');
370
+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.URI');
382
371
 
383
- var isAnchor = function (elm) {
384
- return elm && elm.nodeName.toLowerCase() === 'a';
385
- };
386
- var isLink = function (elm) {
387
- return isAnchor(elm) && !!getHref(elm);
388
- };
389
- var collectNodesInRange = function (rng, predicate) {
372
+ const isAnchor = elm => isNonNullable(elm) && elm.nodeName.toLowerCase() === 'a';
373
+ const isLink = elm => isAnchor(elm) && !!getHref(elm);
374
+ const collectNodesInRange = (rng, predicate) => {
390
375
  if (rng.collapsed) {
391
376
  return [];
392
377
  } else {
393
- var contents = rng.cloneContents();
394
- var walker = new global$4(contents.firstChild, contents);
395
- var elements = [];
396
- var current = contents.firstChild;
378
+ const contents = rng.cloneContents();
379
+ const firstChild = contents.firstChild;
380
+ const walker = new global$3(firstChild, contents);
381
+ const elements = [];
382
+ let current = firstChild;
397
383
  do {
398
384
  if (predicate(current)) {
399
385
  elements.push(current);
@@ -402,87 +388,81 @@
402
388
  return elements;
403
389
  }
404
390
  };
405
- var hasProtocol = function (url) {
406
- return /^\w+:/i.test(url);
407
- };
408
- var getHref = function (elm) {
409
- var href = elm.getAttribute('data-mce-href');
410
- return href ? href : elm.getAttribute('href');
391
+ const hasProtocol = url => /^\w+:/i.test(url);
392
+ const getHref = elm => {
393
+ var _a, _b;
394
+ return (_b = (_a = elm.getAttribute('data-mce-href')) !== null && _a !== void 0 ? _a : elm.getAttribute('href')) !== null && _b !== void 0 ? _b : '';
411
395
  };
412
- var applyRelTargetRules = function (rel, isUnsafe) {
413
- var rules = ['noopener'];
414
- var rels = rel ? rel.split(/\s+/) : [];
415
- var toString = function (rels) {
416
- return global$5.trim(rels.sort().join(' '));
417
- };
418
- var addTargetRules = function (rels) {
396
+ const applyRelTargetRules = (rel, isUnsafe) => {
397
+ const rules = ['noopener'];
398
+ const rels = rel ? rel.split(/\s+/) : [];
399
+ const toString = rels => global$4.trim(rels.sort().join(' '));
400
+ const addTargetRules = rels => {
419
401
  rels = removeTargetRules(rels);
420
402
  return rels.length > 0 ? rels.concat(rules) : rules;
421
403
  };
422
- var removeTargetRules = function (rels) {
423
- return rels.filter(function (val) {
424
- return global$5.inArray(rules, val) === -1;
425
- });
426
- };
427
- var newRels = isUnsafe ? addTargetRules(rels) : removeTargetRules(rels);
404
+ const removeTargetRules = rels => rels.filter(val => global$4.inArray(rules, val) === -1);
405
+ const newRels = isUnsafe ? addTargetRules(rels) : removeTargetRules(rels);
428
406
  return newRels.length > 0 ? toString(newRels) : '';
429
407
  };
430
- var trimCaretContainers = function (text) {
431
- return text.replace(/\uFEFF/g, '');
432
- };
433
- var getAnchorElement = function (editor, selectedElm) {
434
- selectedElm = selectedElm || editor.selection.getNode();
408
+ const trimCaretContainers = text => text.replace(/\uFEFF/g, '');
409
+ const getAnchorElement = (editor, selectedElm) => {
410
+ selectedElm = selectedElm || getLinksInSelection(editor.selection.getRng())[0] || editor.selection.getNode();
435
411
  if (isImageFigure(selectedElm)) {
436
- return editor.dom.select('a[href]', selectedElm)[0];
412
+ return Optional.from(editor.dom.select('a[href]', selectedElm)[0]);
437
413
  } else {
438
- return editor.dom.getParent(selectedElm, 'a[href]');
414
+ return Optional.from(editor.dom.getParent(selectedElm, 'a[href]'));
439
415
  }
440
416
  };
441
- var getAnchorText = function (selection, anchorElm) {
442
- var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });
417
+ const isInAnchor = (editor, selectedElm) => getAnchorElement(editor, selectedElm).isSome();
418
+ const getAnchorText = (selection, anchorElm) => {
419
+ const text = anchorElm.fold(() => selection.getContent({ format: 'text' }), anchorElm => anchorElm.innerText || anchorElm.textContent || '');
443
420
  return trimCaretContainers(text);
444
421
  };
445
- var hasLinks = function (elements) {
446
- return global$5.grep(elements, isLink).length > 0;
447
- };
448
- var hasLinksInSelection = function (rng) {
449
- return collectNodesInRange(rng, isLink).length > 0;
450
- };
451
- var isOnlyTextSelected = function (editor) {
452
- var inlineTextElements = editor.schema.getTextInlineElements();
453
- var isElement = function (elm) {
454
- return elm.nodeType === 1 && !isAnchor(elm) && !has(inlineTextElements, elm.nodeName.toLowerCase());
455
- };
456
- var elements = collectNodesInRange(editor.selection.getRng(), isElement);
457
- return elements.length === 0;
458
- };
459
- var isImageFigure = function (elm) {
460
- return elm && elm.nodeName === 'FIGURE' && /\bimage\b/i.test(elm.className);
422
+ const getLinksInSelection = rng => collectNodesInRange(rng, isLink);
423
+ const getLinks$1 = elements => global$4.grep(elements, isLink);
424
+ const hasLinks = elements => getLinks$1(elements).length > 0;
425
+ const hasLinksInSelection = rng => getLinksInSelection(rng).length > 0;
426
+ const isOnlyTextSelected = editor => {
427
+ const inlineTextElements = editor.schema.getTextInlineElements();
428
+ const isElement = elm => elm.nodeType === 1 && !isAnchor(elm) && !has(inlineTextElements, elm.nodeName.toLowerCase());
429
+ const isInBlockAnchor = getAnchorElement(editor).exists(anchor => anchor.hasAttribute('data-mce-block'));
430
+ if (isInBlockAnchor) {
431
+ return false;
432
+ }
433
+ const rng = editor.selection.getRng();
434
+ if (!rng.collapsed) {
435
+ const elements = collectNodesInRange(rng, isElement);
436
+ return elements.length === 0;
437
+ } else {
438
+ return true;
439
+ }
461
440
  };
462
- var getLinkAttrs = function (data) {
463
- var attrs = [
441
+ const isImageFigure = elm => isNonNullable(elm) && elm.nodeName === 'FIGURE' && /\bimage\b/i.test(elm.className);
442
+ const getLinkAttrs = data => {
443
+ const attrs = [
464
444
  'title',
465
445
  'rel',
466
446
  'class',
467
447
  'target'
468
448
  ];
469
- return foldl(attrs, function (acc, key) {
470
- data[key].each(function (value) {
449
+ return foldl(attrs, (acc, key) => {
450
+ data[key].each(value => {
471
451
  acc[key] = value.length > 0 ? value : null;
472
452
  });
473
453
  return acc;
474
454
  }, { href: data.href });
475
455
  };
476
- var handleExternalTargets = function (href, assumeExternalTargets) {
456
+ const handleExternalTargets = (href, assumeExternalTargets) => {
477
457
  if ((assumeExternalTargets === 'http' || assumeExternalTargets === 'https') && !hasProtocol(href)) {
478
458
  return assumeExternalTargets + '://' + href;
479
459
  }
480
460
  return href;
481
461
  };
482
- var applyLinkOverrides = function (editor, linkAttrs) {
483
- var newLinkAttrs = __assign({}, linkAttrs);
484
- if (!(getRelList(editor).length > 0) && allowUnsafeLinkTarget(editor) === false) {
485
- var newRel = applyRelTargetRules(newLinkAttrs.rel, newLinkAttrs.target === '_blank');
462
+ const applyLinkOverrides = (editor, linkAttrs) => {
463
+ const newLinkAttrs = { ...linkAttrs };
464
+ if (getRelList(editor).length === 0 && !allowUnsafeLinkTarget(editor)) {
465
+ const newRel = applyRelTargetRules(newLinkAttrs.rel, newLinkAttrs.target === '_blank');
486
466
  newLinkAttrs.rel = newRel ? newRel : null;
487
467
  }
488
468
  if (Optional.from(newLinkAttrs.target).isNone() && getTargetList(editor) === false) {
@@ -491,8 +471,8 @@
491
471
  newLinkAttrs.href = handleExternalTargets(newLinkAttrs.href, assumeExternalTargets(editor));
492
472
  return newLinkAttrs;
493
473
  };
494
- var updateLink = function (editor, anchorElm, text, linkAttrs) {
495
- text.each(function (text) {
474
+ const updateLink = (editor, anchorElm, text, linkAttrs) => {
475
+ text.each(text => {
496
476
  if (has(anchorElm, 'innerText')) {
497
477
  anchorElm.innerText = text;
498
478
  } else {
@@ -502,39 +482,40 @@
502
482
  editor.dom.setAttribs(anchorElm, linkAttrs);
503
483
  editor.selection.select(anchorElm);
504
484
  };
505
- var createLink = function (editor, selectedElm, text, linkAttrs) {
485
+ const createLink = (editor, selectedElm, text, linkAttrs) => {
486
+ const dom = editor.dom;
506
487
  if (isImageFigure(selectedElm)) {
507
- linkImageFigure(editor, selectedElm, linkAttrs);
488
+ linkImageFigure(dom, selectedElm, linkAttrs);
508
489
  } else {
509
- text.fold(function () {
490
+ text.fold(() => {
510
491
  editor.execCommand('mceInsertLink', false, linkAttrs);
511
- }, function (text) {
512
- editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(text)));
492
+ }, text => {
493
+ editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(text)));
513
494
  });
514
495
  }
515
496
  };
516
- var linkDomMutation = function (editor, attachState, data) {
517
- var selectedElm = editor.selection.getNode();
518
- var anchorElm = getAnchorElement(editor, selectedElm);
519
- var linkAttrs = applyLinkOverrides(editor, getLinkAttrs(data));
520
- editor.undoManager.transact(function () {
497
+ const linkDomMutation = (editor, attachState, data) => {
498
+ const selectedElm = editor.selection.getNode();
499
+ const anchorElm = getAnchorElement(editor, selectedElm);
500
+ const linkAttrs = applyLinkOverrides(editor, getLinkAttrs(data));
501
+ editor.undoManager.transact(() => {
521
502
  if (data.href === attachState.href) {
522
503
  attachState.attach();
523
504
  }
524
- if (anchorElm) {
525
- editor.focus();
526
- updateLink(editor, anchorElm, data.text, linkAttrs);
527
- } else {
505
+ anchorElm.fold(() => {
528
506
  createLink(editor, selectedElm, data.text, linkAttrs);
529
- }
507
+ }, elm => {
508
+ editor.focus();
509
+ updateLink(editor, elm, data.text, linkAttrs);
510
+ });
530
511
  });
531
512
  };
532
- var unlinkSelection = function (editor) {
533
- var dom = editor.dom, selection = editor.selection;
534
- var bookmark = selection.getBookmark();
535
- var rng = selection.getRng().cloneRange();
536
- var startAnchorElm = dom.getParent(rng.startContainer, 'a[href]', editor.getBody());
537
- var endAnchorElm = dom.getParent(rng.endContainer, 'a[href]', editor.getBody());
513
+ const unlinkSelection = editor => {
514
+ const dom = editor.dom, selection = editor.selection;
515
+ const bookmark = selection.getBookmark();
516
+ const rng = selection.getRng().cloneRange();
517
+ const startAnchorElm = dom.getParent(rng.startContainer, 'a[href]', editor.getBody());
518
+ const endAnchorElm = dom.getParent(rng.endContainer, 'a[href]', editor.getBody());
538
519
  if (startAnchorElm) {
539
520
  rng.setStartBefore(startAnchorElm);
540
521
  }
@@ -545,9 +526,9 @@
545
526
  editor.execCommand('unlink');
546
527
  selection.moveToBookmark(bookmark);
547
528
  };
548
- var unlinkDomMutation = function (editor) {
549
- editor.undoManager.transact(function () {
550
- var node = editor.selection.getNode();
529
+ const unlinkDomMutation = editor => {
530
+ editor.undoManager.transact(() => {
531
+ const node = editor.selection.getNode();
551
532
  if (isImageFigure(node)) {
552
533
  unlinkImageFigure(editor, node);
553
534
  } else {
@@ -556,78 +537,88 @@
556
537
  editor.focus();
557
538
  });
558
539
  };
559
- var unwrapOptions = function (data) {
560
- var cls = data.class, href = data.href, rel = data.rel, target = data.target, text = data.text, title = data.title;
540
+ const unwrapOptions = data => {
541
+ const {
542
+ class: cls,
543
+ href,
544
+ rel,
545
+ target,
546
+ text,
547
+ title
548
+ } = data;
561
549
  return filter({
562
550
  class: cls.getOrNull(),
563
- href: href,
551
+ href,
564
552
  rel: rel.getOrNull(),
565
553
  target: target.getOrNull(),
566
554
  text: text.getOrNull(),
567
555
  title: title.getOrNull()
568
- }, function (v, _k) {
569
- return isNull(v) === false;
570
- });
571
- };
572
- var sanitizeData = function (editor, data) {
573
- var href = data.href;
574
- return __assign(__assign({}, data), { href: global$3.isDomSafe(href, 'a', editor.settings) ? href : '' });
556
+ }, (v, _k) => isNull(v) === false);
557
+ };
558
+ const sanitizeData = (editor, data) => {
559
+ const getOption = editor.options.get;
560
+ const uriOptions = {
561
+ allow_html_data_urls: getOption('allow_html_data_urls'),
562
+ allow_script_urls: getOption('allow_script_urls'),
563
+ allow_svg_data_urls: getOption('allow_svg_data_urls')
564
+ };
565
+ const href = data.href;
566
+ return {
567
+ ...data,
568
+ href: global$2.isDomSafe(href, 'a', uriOptions) ? href : ''
569
+ };
575
570
  };
576
- var link = function (editor, attachState, data) {
577
- var sanitizedData = sanitizeData(editor, data);
571
+ const link = (editor, attachState, data) => {
572
+ const sanitizedData = sanitizeData(editor, data);
578
573
  editor.hasPlugin('rtc', true) ? editor.execCommand('createlink', false, unwrapOptions(sanitizedData)) : linkDomMutation(editor, attachState, sanitizedData);
579
574
  };
580
- var unlink = function (editor) {
575
+ const unlink = editor => {
581
576
  editor.hasPlugin('rtc', true) ? editor.execCommand('unlink') : unlinkDomMutation(editor);
582
577
  };
583
- var unlinkImageFigure = function (editor, fig) {
584
- var img = editor.dom.select('img', fig)[0];
578
+ const unlinkImageFigure = (editor, fig) => {
579
+ var _a;
580
+ const img = editor.dom.select('img', fig)[0];
585
581
  if (img) {
586
- var a = editor.dom.getParents(img, 'a[href]', fig)[0];
582
+ const a = editor.dom.getParents(img, 'a[href]', fig)[0];
587
583
  if (a) {
588
- a.parentNode.insertBefore(img, a);
584
+ (_a = a.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(img, a);
589
585
  editor.dom.remove(a);
590
586
  }
591
587
  }
592
588
  };
593
- var linkImageFigure = function (editor, fig, attrs) {
594
- var img = editor.dom.select('img', fig)[0];
589
+ const linkImageFigure = (dom, fig, attrs) => {
590
+ var _a;
591
+ const img = dom.select('img', fig)[0];
595
592
  if (img) {
596
- var a = editor.dom.create('a', attrs);
597
- img.parentNode.insertBefore(a, img);
593
+ const a = dom.create('a', attrs);
594
+ (_a = img.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(a, img);
598
595
  a.appendChild(img);
599
596
  }
600
597
  };
601
598
 
602
- var isListGroup = function (item) {
603
- return hasNonNullableKey(item, 'items');
604
- };
605
- var findTextByValue = function (value, catalog) {
606
- return findMap(catalog, function (item) {
607
- if (isListGroup(item)) {
608
- return findTextByValue(value, item.items);
609
- } else {
610
- return someIf(item.value === value, item);
611
- }
612
- });
613
- };
614
- var getDelta = function (persistentText, fieldName, catalog, data) {
615
- var value = data[fieldName];
616
- var hasPersistentText = persistentText.length > 0;
617
- return value !== undefined ? findTextByValue(value, catalog).map(function (i) {
618
- return {
619
- url: {
620
- value: i.value,
621
- meta: {
622
- text: hasPersistentText ? persistentText : i.text,
623
- attach: noop
624
- }
625
- },
626
- text: hasPersistentText ? persistentText : i.text
627
- };
628
- }) : Optional.none();
599
+ const isListGroup = item => hasNonNullableKey(item, 'items');
600
+ const findTextByValue = (value, catalog) => findMap(catalog, item => {
601
+ if (isListGroup(item)) {
602
+ return findTextByValue(value, item.items);
603
+ } else {
604
+ return someIf(item.value === value, item);
605
+ }
606
+ });
607
+ const getDelta = (persistentText, fieldName, catalog, data) => {
608
+ const value = data[fieldName];
609
+ const hasPersistentText = persistentText.length > 0;
610
+ return value !== undefined ? findTextByValue(value, catalog).map(i => ({
611
+ url: {
612
+ value: i.value,
613
+ meta: {
614
+ text: hasPersistentText ? persistentText : i.text,
615
+ attach: noop
616
+ }
617
+ },
618
+ text: hasPersistentText ? persistentText : i.text
619
+ })) : Optional.none();
629
620
  };
630
- var findCatalog = function (catalogs, fieldName) {
621
+ const findCatalog = (catalogs, fieldName) => {
631
622
  if (fieldName === 'link') {
632
623
  return catalogs.link;
633
624
  } else if (fieldName === 'anchor') {
@@ -636,43 +627,44 @@
636
627
  return Optional.none();
637
628
  }
638
629
  };
639
- var init = function (initialData, linkCatalog) {
640
- var persistentData = {
630
+ const init = (initialData, linkCatalog) => {
631
+ const persistentData = {
641
632
  text: initialData.text,
642
633
  title: initialData.title
643
634
  };
644
- var getTitleFromUrlChange = function (url) {
645
- return someIf(persistentData.title.length <= 0, Optional.from(url.meta.title).getOr(''));
635
+ const getTitleFromUrlChange = url => {
636
+ var _a;
637
+ return someIf(persistentData.title.length <= 0, Optional.from((_a = url.meta) === null || _a === void 0 ? void 0 : _a.title).getOr(''));
646
638
  };
647
- var getTextFromUrlChange = function (url) {
648
- return someIf(persistentData.text.length <= 0, Optional.from(url.meta.text).getOr(url.value));
639
+ const getTextFromUrlChange = url => {
640
+ var _a;
641
+ return someIf(persistentData.text.length <= 0, Optional.from((_a = url.meta) === null || _a === void 0 ? void 0 : _a.text).getOr(url.value));
649
642
  };
650
- var onUrlChange = function (data) {
651
- var text = getTextFromUrlChange(data.url);
652
- var title = getTitleFromUrlChange(data.url);
643
+ const onUrlChange = data => {
644
+ const text = getTextFromUrlChange(data.url);
645
+ const title = getTitleFromUrlChange(data.url);
653
646
  if (text.isSome() || title.isSome()) {
654
- return Optional.some(__assign(__assign({}, text.map(function (text) {
655
- return { text: text };
656
- }).getOr({})), title.map(function (title) {
657
- return { title: title };
658
- }).getOr({})));
647
+ return Optional.some({
648
+ ...text.map(text => ({ text })).getOr({}),
649
+ ...title.map(title => ({ title })).getOr({})
650
+ });
659
651
  } else {
660
652
  return Optional.none();
661
653
  }
662
654
  };
663
- var onCatalogChange = function (data, change) {
664
- var catalog = findCatalog(linkCatalog, change.name).getOr([]);
665
- return getDelta(persistentData.text, change.name, catalog, data);
655
+ const onCatalogChange = (data, change) => {
656
+ const catalog = findCatalog(linkCatalog, change).getOr([]);
657
+ return getDelta(persistentData.text, change, catalog, data);
666
658
  };
667
- var onChange = function (getData, change) {
668
- var name = change.name;
659
+ const onChange = (getData, change) => {
660
+ const name = change.name;
669
661
  if (name === 'url') {
670
662
  return onUrlChange(getData());
671
663
  } else if (contains([
672
664
  'anchor',
673
665
  'link'
674
666
  ], name)) {
675
- return onCatalogChange(getData(), change);
667
+ return onCatalogChange(getData(), name);
676
668
  } else if (name === 'text' || name === 'title') {
677
669
  persistentData[name] = getData()[name];
678
670
  return Optional.none();
@@ -680,70 +672,60 @@
680
672
  return Optional.none();
681
673
  }
682
674
  };
683
- return { onChange: onChange };
675
+ return { onChange };
684
676
  };
685
- var DialogChanges = {
686
- init: init,
687
- getDelta: getDelta
677
+ const DialogChanges = {
678
+ init,
679
+ getDelta
688
680
  };
689
681
 
690
- var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
691
-
692
- var global$1 = tinymce.util.Tools.resolve('tinymce.util.Promise');
682
+ var global$1 = tinymce.util.Tools.resolve('tinymce.util.Delay');
693
683
 
694
- var delayedConfirm = function (editor, message, callback) {
695
- var rng = editor.selection.getRng();
696
- global$2.setEditorTimeout(editor, function () {
697
- editor.windowManager.confirm(message, function (state) {
684
+ const delayedConfirm = (editor, message, callback) => {
685
+ const rng = editor.selection.getRng();
686
+ global$1.setEditorTimeout(editor, () => {
687
+ editor.windowManager.confirm(message, state => {
698
688
  editor.selection.setRng(rng);
699
689
  callback(state);
700
690
  });
701
691
  });
702
692
  };
703
- var tryEmailTransform = function (data) {
704
- var url = data.href;
705
- var suggestMailTo = url.indexOf('@') > 0 && url.indexOf('/') === -1 && url.indexOf('mailto:') === -1;
693
+ const tryEmailTransform = data => {
694
+ const url = data.href;
695
+ const suggestMailTo = url.indexOf('@') > 0 && url.indexOf('/') === -1 && url.indexOf('mailto:') === -1;
706
696
  return suggestMailTo ? Optional.some({
707
697
  message: 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
708
- preprocess: function (oldData) {
709
- return __assign(__assign({}, oldData), { href: 'mailto:' + url });
710
- }
698
+ preprocess: oldData => ({
699
+ ...oldData,
700
+ href: 'mailto:' + url
701
+ })
711
702
  }) : Optional.none();
712
703
  };
713
- var tryProtocolTransform = function (assumeExternalTargets, defaultLinkProtocol) {
714
- return function (data) {
715
- var url = data.href;
716
- var suggestProtocol = assumeExternalTargets === 1 && !hasProtocol(url) || assumeExternalTargets === 0 && /^\s*www(\.|\d\.)/i.test(url);
717
- return suggestProtocol ? Optional.some({
718
- message: 'The URL you entered seems to be an external link. Do you want to add the required ' + defaultLinkProtocol + ':// prefix?',
719
- preprocess: function (oldData) {
720
- return __assign(__assign({}, oldData), { href: defaultLinkProtocol + '://' + url });
721
- }
722
- }) : Optional.none();
723
- };
704
+ const tryProtocolTransform = (assumeExternalTargets, defaultLinkProtocol) => data => {
705
+ const url = data.href;
706
+ const suggestProtocol = assumeExternalTargets === 1 && !hasProtocol(url) || assumeExternalTargets === 0 && /^\s*www(\.|\d\.)/i.test(url);
707
+ return suggestProtocol ? Optional.some({
708
+ message: `The URL you entered seems to be an external link. Do you want to add the required ${ defaultLinkProtocol }:// prefix?`,
709
+ preprocess: oldData => ({
710
+ ...oldData,
711
+ href: defaultLinkProtocol + '://' + url
712
+ })
713
+ }) : Optional.none();
724
714
  };
725
- var preprocess = function (editor, data) {
726
- return findMap([
727
- tryEmailTransform,
728
- tryProtocolTransform(assumeExternalTargets(editor), getDefaultLinkProtocol(editor))
729
- ], function (f) {
730
- return f(data);
731
- }).fold(function () {
732
- return global$1.resolve(data);
733
- }, function (transform) {
734
- return new global$1(function (callback) {
735
- delayedConfirm(editor, transform.message, function (state) {
736
- callback(state ? transform.preprocess(data) : data);
737
- });
738
- });
715
+ const preprocess = (editor, data) => findMap([
716
+ tryEmailTransform,
717
+ tryProtocolTransform(assumeExternalTargets(editor), getDefaultLinkProtocol(editor))
718
+ ], f => f(data)).fold(() => Promise.resolve(data), transform => new Promise(callback => {
719
+ delayedConfirm(editor, transform.message, state => {
720
+ callback(state ? transform.preprocess(data) : data);
739
721
  });
740
- };
741
- var DialogConfirms = { preprocess: preprocess };
722
+ }));
723
+ const DialogConfirms = { preprocess };
742
724
 
743
- var getAnchors = function (editor) {
744
- var anchorNodes = editor.dom.select('a:not([href])');
745
- var anchors = bind(anchorNodes, function (anchor) {
746
- var id = anchor.name || anchor.id;
725
+ const getAnchors = editor => {
726
+ const anchorNodes = editor.dom.select('a:not([href])');
727
+ const anchors = bind(anchorNodes, anchor => {
728
+ const id = anchor.name || anchor.id;
747
729
  return id ? [{
748
730
  text: id,
749
731
  value: '#' + id
@@ -754,81 +736,63 @@
754
736
  value: ''
755
737
  }].concat(anchors)) : Optional.none();
756
738
  };
757
- var AnchorListOptions = { getAnchors: getAnchors };
739
+ const AnchorListOptions = { getAnchors };
758
740
 
759
- var getClasses = function (editor) {
760
- var list = getLinkClassList(editor);
741
+ const getClasses = editor => {
742
+ const list = getLinkClassList(editor);
761
743
  if (list.length > 0) {
762
744
  return ListOptions.sanitize(list);
763
745
  }
764
746
  return Optional.none();
765
747
  };
766
- var ClassListOptions = { getClasses: getClasses };
748
+ const ClassListOptions = { getClasses };
767
749
 
768
- var global = tinymce.util.Tools.resolve('tinymce.util.XHR');
769
-
770
- var parseJson = function (text) {
750
+ const parseJson = text => {
771
751
  try {
772
752
  return Optional.some(JSON.parse(text));
773
753
  } catch (err) {
774
754
  return Optional.none();
775
755
  }
776
756
  };
777
- var getLinks = function (editor) {
778
- var extractor = function (item) {
779
- return editor.convertURL(item.value || item.url, 'href');
780
- };
781
- var linkList = getLinkList(editor);
782
- return new global$1(function (callback) {
757
+ const getLinks = editor => {
758
+ const extractor = item => editor.convertURL(item.value || item.url || '', 'href');
759
+ const linkList = getLinkList(editor);
760
+ return new Promise(resolve => {
783
761
  if (isString(linkList)) {
784
- global.send({
785
- url: linkList,
786
- success: function (text) {
787
- return callback(parseJson(text));
788
- },
789
- error: function (_) {
790
- return callback(Optional.none());
791
- }
792
- });
762
+ fetch(linkList).then(res => res.ok ? res.text().then(parseJson) : Promise.reject()).then(resolve, () => resolve(Optional.none()));
793
763
  } else if (isFunction(linkList)) {
794
- linkList(function (output) {
795
- return callback(Optional.some(output));
796
- });
764
+ linkList(output => resolve(Optional.some(output)));
797
765
  } else {
798
- callback(Optional.from(linkList));
766
+ resolve(Optional.from(linkList));
799
767
  }
800
- }).then(function (optItems) {
801
- return optItems.bind(ListOptions.sanitizeWith(extractor)).map(function (items) {
802
- if (items.length > 0) {
803
- var noneItem = [{
804
- text: 'None',
805
- value: ''
806
- }];
807
- return noneItem.concat(items);
808
- } else {
809
- return items;
810
- }
811
- });
812
- });
768
+ }).then(optItems => optItems.bind(ListOptions.sanitizeWith(extractor)).map(items => {
769
+ if (items.length > 0) {
770
+ const noneItem = [{
771
+ text: 'None',
772
+ value: ''
773
+ }];
774
+ return noneItem.concat(items);
775
+ } else {
776
+ return items;
777
+ }
778
+ }));
813
779
  };
814
- var LinkListOptions = { getLinks: getLinks };
780
+ const LinkListOptions = { getLinks };
815
781
 
816
- var getRels = function (editor, initialTarget) {
817
- var list = getRelList(editor);
782
+ const getRels = (editor, initialTarget) => {
783
+ const list = getRelList(editor);
818
784
  if (list.length > 0) {
819
- var isTargetBlank_1 = is(initialTarget, '_blank');
820
- var enforceSafe = allowUnsafeLinkTarget(editor) === false;
821
- var safeRelExtractor = function (item) {
822
- return applyRelTargetRules(ListOptions.getValue(item), isTargetBlank_1);
823
- };
824
- var sanitizer = enforceSafe ? ListOptions.sanitizeWith(safeRelExtractor) : ListOptions.sanitize;
785
+ const isTargetBlank = is(initialTarget, '_blank');
786
+ const enforceSafe = allowUnsafeLinkTarget(editor) === false;
787
+ const safeRelExtractor = item => applyRelTargetRules(ListOptions.getValue(item), isTargetBlank);
788
+ const sanitizer = enforceSafe ? ListOptions.sanitizeWith(safeRelExtractor) : ListOptions.sanitize;
825
789
  return sanitizer(list);
826
790
  }
827
791
  return Optional.none();
828
792
  };
829
- var RelOptions = { getRels: getRels };
793
+ const RelOptions = { getRels };
830
794
 
831
- var fallbacks = [
795
+ const fallbacks = [
832
796
  {
833
797
  text: 'Current window',
834
798
  value: ''
@@ -838,98 +802,88 @@
838
802
  value: '_blank'
839
803
  }
840
804
  ];
841
- var getTargets = function (editor) {
842
- var list = getTargetList(editor);
805
+ const getTargets = editor => {
806
+ const list = getTargetList(editor);
843
807
  if (isArray(list)) {
844
- return ListOptions.sanitize(list).orThunk(function () {
845
- return Optional.some(fallbacks);
846
- });
808
+ return ListOptions.sanitize(list).orThunk(() => Optional.some(fallbacks));
847
809
  } else if (list === false) {
848
810
  return Optional.none();
849
811
  }
850
812
  return Optional.some(fallbacks);
851
813
  };
852
- var TargetOptions = { getTargets: getTargets };
814
+ const TargetOptions = { getTargets };
853
815
 
854
- var nonEmptyAttr = function (dom, elem, name) {
855
- var val = dom.getAttrib(elem, name);
816
+ const nonEmptyAttr = (dom, elem, name) => {
817
+ const val = dom.getAttrib(elem, name);
856
818
  return val !== null && val.length > 0 ? Optional.some(val) : Optional.none();
857
819
  };
858
- var extractFromAnchor = function (editor, anchor) {
859
- var dom = editor.dom;
860
- var onlyText = isOnlyTextSelected(editor);
861
- var text = onlyText ? Optional.some(getAnchorText(editor.selection, anchor)) : Optional.none();
862
- var url = anchor ? Optional.some(dom.getAttrib(anchor, 'href')) : Optional.none();
863
- var target = anchor ? Optional.from(dom.getAttrib(anchor, 'target')) : Optional.none();
864
- var rel = nonEmptyAttr(dom, anchor, 'rel');
865
- var linkClass = nonEmptyAttr(dom, anchor, 'class');
866
- var title = nonEmptyAttr(dom, anchor, 'title');
820
+ const extractFromAnchor = (editor, anchor) => {
821
+ const dom = editor.dom;
822
+ const onlyText = isOnlyTextSelected(editor);
823
+ const text = onlyText ? Optional.some(getAnchorText(editor.selection, anchor)) : Optional.none();
824
+ const url = anchor.bind(anchorElm => Optional.from(dom.getAttrib(anchorElm, 'href')));
825
+ const target = anchor.bind(anchorElm => Optional.from(dom.getAttrib(anchorElm, 'target')));
826
+ const rel = anchor.bind(anchorElm => nonEmptyAttr(dom, anchorElm, 'rel'));
827
+ const linkClass = anchor.bind(anchorElm => nonEmptyAttr(dom, anchorElm, 'class'));
828
+ const title = anchor.bind(anchorElm => nonEmptyAttr(dom, anchorElm, 'title'));
867
829
  return {
868
- url: url,
869
- text: text,
870
- title: title,
871
- target: target,
872
- rel: rel,
873
- linkClass: linkClass
830
+ url,
831
+ text,
832
+ title,
833
+ target,
834
+ rel,
835
+ linkClass
874
836
  };
875
837
  };
876
- var collect = function (editor, linkNode) {
877
- return LinkListOptions.getLinks(editor).then(function (links) {
878
- var anchor = extractFromAnchor(editor, linkNode);
879
- return {
880
- anchor: anchor,
881
- catalogs: {
882
- targets: TargetOptions.getTargets(editor),
883
- rels: RelOptions.getRels(editor, anchor.target),
884
- classes: ClassListOptions.getClasses(editor),
885
- anchor: AnchorListOptions.getAnchors(editor),
886
- link: links
887
- },
888
- optNode: Optional.from(linkNode),
889
- flags: { titleEnabled: shouldShowLinkTitle(editor) }
890
- };
891
- });
892
- };
893
- var DialogInfo = { collect: collect };
838
+ const collect = (editor, linkNode) => LinkListOptions.getLinks(editor).then(links => {
839
+ const anchor = extractFromAnchor(editor, linkNode);
840
+ return {
841
+ anchor,
842
+ catalogs: {
843
+ targets: TargetOptions.getTargets(editor),
844
+ rels: RelOptions.getRels(editor, anchor.target),
845
+ classes: ClassListOptions.getClasses(editor),
846
+ anchor: AnchorListOptions.getAnchors(editor),
847
+ link: links
848
+ },
849
+ optNode: linkNode,
850
+ flags: { titleEnabled: shouldShowLinkTitle(editor) }
851
+ };
852
+ });
853
+ const DialogInfo = { collect };
894
854
 
895
- var handleSubmit = function (editor, info) {
896
- return function (api) {
897
- var data = api.getData();
898
- if (!data.url.value) {
899
- unlink(editor);
900
- api.close();
901
- return;
902
- }
903
- var getChangedValue = function (key) {
904
- return Optional.from(data[key]).filter(function (value) {
905
- return !is(info.anchor[key], value);
906
- });
907
- };
908
- var changedData = {
909
- href: data.url.value,
910
- text: getChangedValue('text'),
911
- target: getChangedValue('target'),
912
- rel: getChangedValue('rel'),
913
- class: getChangedValue('linkClass'),
914
- title: getChangedValue('title')
915
- };
916
- var attachState = {
917
- href: data.url.value,
918
- attach: data.url.meta !== undefined && data.url.meta.attach ? data.url.meta.attach : noop
919
- };
920
- DialogConfirms.preprocess(editor, changedData).then(function (pData) {
921
- link(editor, attachState, pData);
922
- });
855
+ const handleSubmit = (editor, info) => api => {
856
+ const data = api.getData();
857
+ if (!data.url.value) {
858
+ unlink(editor);
923
859
  api.close();
860
+ return;
861
+ }
862
+ const getChangedValue = key => Optional.from(data[key]).filter(value => !is(info.anchor[key], value));
863
+ const changedData = {
864
+ href: data.url.value,
865
+ text: getChangedValue('text'),
866
+ target: getChangedValue('target'),
867
+ rel: getChangedValue('rel'),
868
+ class: getChangedValue('linkClass'),
869
+ title: getChangedValue('title')
870
+ };
871
+ const attachState = {
872
+ href: data.url.value,
873
+ attach: data.url.meta !== undefined && data.url.meta.attach ? data.url.meta.attach : noop
924
874
  };
875
+ DialogConfirms.preprocess(editor, changedData).then(pData => {
876
+ link(editor, attachState, pData);
877
+ });
878
+ api.close();
925
879
  };
926
- var collectData = function (editor) {
927
- var anchorNode = getAnchorElement(editor);
880
+ const collectData = editor => {
881
+ const anchorNode = getAnchorElement(editor);
928
882
  return DialogInfo.collect(editor, anchorNode);
929
883
  };
930
- var getInitialData = function (info, defaultTarget) {
931
- var anchor = info.anchor;
932
- var url = anchor.url.getOr('');
884
+ const getInitialData = (info, defaultTarget) => {
885
+ const anchor = info.anchor;
886
+ const url = anchor.url.getOr('');
933
887
  return {
934
888
  url: {
935
889
  value: url,
@@ -944,30 +898,29 @@
944
898
  linkClass: anchor.linkClass.getOr('')
945
899
  };
946
900
  };
947
- var makeDialog = function (settings, onSubmit, editor) {
948
- var urlInput = [{
901
+ const makeDialog = (settings, onSubmit, editor) => {
902
+ const urlInput = [{
949
903
  name: 'url',
950
904
  type: 'urlinput',
951
905
  filetype: 'file',
952
- label: 'URL'
906
+ label: 'URL',
907
+ picker_text: 'Browse links'
953
908
  }];
954
- var displayText = settings.anchor.text.map(function () {
955
- return {
956
- name: 'text',
957
- type: 'input',
958
- label: 'Text to display'
959
- };
960
- }).toArray();
961
- var titleText = settings.flags.titleEnabled ? [{
909
+ const displayText = settings.anchor.text.map(() => ({
910
+ name: 'text',
911
+ type: 'input',
912
+ label: 'Text to display'
913
+ })).toArray();
914
+ const titleText = settings.flags.titleEnabled ? [{
962
915
  name: 'title',
963
916
  type: 'input',
964
917
  label: 'Title'
965
918
  }] : [];
966
- var defaultTarget = Optional.from(getDefaultLinkTarget(editor));
967
- var initialData = getInitialData(settings, defaultTarget);
968
- var catalogs = settings.catalogs;
969
- var dialogDelta = DialogChanges.init(initialData, catalogs);
970
- var body = {
919
+ const defaultTarget = Optional.from(getDefaultLinkTarget(editor));
920
+ const initialData = getInitialData(settings, defaultTarget);
921
+ const catalogs = settings.catalogs;
922
+ const dialogDelta = DialogChanges.init(initialData, catalogs);
923
+ const body = {
971
924
  type: 'panel',
972
925
  items: flatten([
973
926
  urlInput,
@@ -985,7 +938,7 @@
985
938
  return {
986
939
  title: 'Insert/Edit Link',
987
940
  size: 'normal',
988
- body: body,
941
+ body,
989
942
  buttons: [
990
943
  {
991
944
  type: 'cancel',
@@ -999,55 +952,62 @@
999
952
  primary: true
1000
953
  }
1001
954
  ],
1002
- initialData: initialData,
1003
- onChange: function (api, _a) {
1004
- var name = _a.name;
1005
- dialogDelta.onChange(api.getData, { name: name }).each(function (newData) {
955
+ initialData,
956
+ onChange: (api, {name}) => {
957
+ dialogDelta.onChange(api.getData, { name }).each(newData => {
1006
958
  api.setData(newData);
1007
959
  });
1008
960
  },
1009
- onSubmit: onSubmit
961
+ onSubmit
1010
962
  };
1011
963
  };
1012
- var open$1 = function (editor) {
1013
- var data = collectData(editor);
1014
- data.then(function (info) {
1015
- var onSubmit = handleSubmit(editor, info);
964
+ const open$1 = editor => {
965
+ const data = collectData(editor);
966
+ data.then(info => {
967
+ const onSubmit = handleSubmit(editor, info);
1016
968
  return makeDialog(info, onSubmit, editor);
1017
- }).then(function (spec) {
969
+ }).then(spec => {
1018
970
  editor.windowManager.open(spec);
1019
971
  });
1020
972
  };
1021
973
 
1022
- var appendClickRemove = function (link, evt) {
974
+ const register = editor => {
975
+ editor.addCommand('mceLink', (_ui, value) => {
976
+ if ((value === null || value === void 0 ? void 0 : value.dialog) === true || !useQuickLink(editor)) {
977
+ open$1(editor);
978
+ } else {
979
+ editor.dispatch('contexttoolbar-show', { toolbarKey: 'quicklink' });
980
+ }
981
+ });
982
+ };
983
+
984
+ var global = tinymce.util.Tools.resolve('tinymce.util.VK');
985
+
986
+ const appendClickRemove = (link, evt) => {
1023
987
  document.body.appendChild(link);
1024
988
  link.dispatchEvent(evt);
1025
989
  document.body.removeChild(link);
1026
990
  };
1027
- var open = function (url) {
1028
- var link = document.createElement('a');
991
+ const open = url => {
992
+ const link = document.createElement('a');
1029
993
  link.target = '_blank';
1030
994
  link.href = url;
1031
995
  link.rel = 'noreferrer noopener';
1032
- var evt = document.createEvent('MouseEvents');
996
+ const evt = document.createEvent('MouseEvents');
1033
997
  evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
1034
998
  appendClickRemove(link, evt);
1035
999
  };
1036
1000
 
1037
- var getLink = function (editor, elm) {
1038
- return editor.dom.getParent(elm, 'a[href]');
1039
- };
1040
- var getSelectedLink = function (editor) {
1041
- return getLink(editor, editor.selection.getStart());
1042
- };
1043
- var hasOnlyAltModifier = function (e) {
1001
+ const getLink = (editor, elm) => editor.dom.getParent(elm, 'a[href]');
1002
+ const getSelectedLink = editor => getLink(editor, editor.selection.getStart());
1003
+ const hasOnlyAltModifier = e => {
1044
1004
  return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
1045
1005
  };
1046
- var gotoLink = function (editor, a) {
1006
+ const gotoLink = (editor, a) => {
1047
1007
  if (a) {
1048
- var href = getHref(a);
1008
+ const href = getHref(a);
1049
1009
  if (/^#/.test(href)) {
1050
- var targetEl = editor.$(href);
1010
+ const targetEl = editor.dom.select(href);
1051
1011
  if (targetEl.length) {
1052
1012
  editor.selection.scrollIntoView(targetEl[0], true);
1053
1013
  }
@@ -1056,153 +1016,144 @@
1056
1016
  }
1057
1017
  }
1058
1018
  };
1059
- var openDialog = function (editor) {
1060
- return function () {
1061
- open$1(editor);
1062
- };
1019
+ const openDialog = editor => () => {
1020
+ editor.execCommand('mceLink', false, { dialog: true });
1063
1021
  };
1064
- var gotoSelectedLink = function (editor) {
1065
- return function () {
1066
- gotoLink(editor, getSelectedLink(editor));
1067
- };
1022
+ const gotoSelectedLink = editor => () => {
1023
+ gotoLink(editor, getSelectedLink(editor));
1068
1024
  };
1069
- var setupGotoLinks = function (editor) {
1070
- editor.on('click', function (e) {
1071
- var link = getLink(editor, e.target);
1072
- if (link && global$6.metaKeyPressed(e)) {
1025
+ const setupGotoLinks = editor => {
1026
+ editor.on('click', e => {
1027
+ const link = getLink(editor, e.target);
1028
+ if (link && global.metaKeyPressed(e)) {
1073
1029
  e.preventDefault();
1074
1030
  gotoLink(editor, link);
1075
1031
  }
1076
1032
  });
1077
- editor.on('keydown', function (e) {
1078
- var link = getSelectedLink(editor);
1079
- if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
1080
- e.preventDefault();
1081
- gotoLink(editor, link);
1033
+ editor.on('keydown', e => {
1034
+ if (!e.isDefaultPrevented() && e.keyCode === 13 && hasOnlyAltModifier(e)) {
1035
+ const link = getSelectedLink(editor);
1036
+ if (link) {
1037
+ e.preventDefault();
1038
+ gotoLink(editor, link);
1039
+ }
1082
1040
  }
1083
1041
  });
1084
1042
  };
1085
- var toggleState = function (editor, toggler) {
1043
+ const toggleState = (editor, toggler) => {
1086
1044
  editor.on('NodeChange', toggler);
1087
- return function () {
1088
- return editor.off('NodeChange', toggler);
1089
- };
1045
+ return () => editor.off('NodeChange', toggler);
1090
1046
  };
1091
- var toggleActiveState = function (editor) {
1092
- return function (api) {
1093
- var updateState = function () {
1094
- return api.setActive(!editor.mode.isReadOnly() && getAnchorElement(editor, editor.selection.getNode()) !== null);
1095
- };
1096
- updateState();
1097
- return toggleState(editor, updateState);
1047
+ const toggleLinkState = editor => api => {
1048
+ const updateState = () => {
1049
+ api.setActive(!editor.mode.isReadOnly() && isInAnchor(editor, editor.selection.getNode()));
1050
+ api.setEnabled(editor.selection.isEditable());
1098
1051
  };
1052
+ updateState();
1053
+ return toggleState(editor, updateState);
1099
1054
  };
1100
- var toggleEnabledState = function (editor) {
1101
- return function (api) {
1102
- var updateState = function () {
1103
- return api.setDisabled(getAnchorElement(editor, editor.selection.getNode()) === null);
1104
- };
1105
- updateState();
1106
- return toggleState(editor, updateState);
1055
+ const toggleLinkMenuState = editor => api => {
1056
+ const updateState = () => {
1057
+ api.setEnabled(editor.selection.isEditable());
1107
1058
  };
1108
- };
1109
- var toggleUnlinkState = function (editor) {
1110
- return function (api) {
1111
- var hasLinks$1 = function (parents) {
1112
- return hasLinks(parents) || hasLinksInSelection(editor.selection.getRng());
1113
- };
1114
- var parents = editor.dom.getParents(editor.selection.getStart());
1115
- api.setDisabled(!hasLinks$1(parents));
1116
- return toggleState(editor, function (e) {
1117
- return api.setDisabled(!hasLinks$1(e.parents));
1118
- });
1059
+ updateState();
1060
+ return toggleState(editor, updateState);
1061
+ };
1062
+ const hasExactlyOneLinkInSelection = editor => {
1063
+ const links = editor.selection.isCollapsed() ? getLinks$1(editor.dom.getParents(editor.selection.getStart())) : getLinksInSelection(editor.selection.getRng());
1064
+ return links.length === 1;
1065
+ };
1066
+ const toggleGotoLinkState = editor => api => {
1067
+ const updateState = () => api.setEnabled(hasExactlyOneLinkInSelection(editor));
1068
+ updateState();
1069
+ return toggleState(editor, updateState);
1070
+ };
1071
+ const toggleUnlinkState = editor => api => {
1072
+ const hasLinks$1 = parents => hasLinks(parents) || hasLinksInSelection(editor.selection.getRng());
1073
+ const parents = editor.dom.getParents(editor.selection.getStart());
1074
+ const updateEnabled = parents => {
1075
+ api.setEnabled(hasLinks$1(parents) && editor.selection.isEditable());
1119
1076
  };
1077
+ updateEnabled(parents);
1078
+ return toggleState(editor, e => updateEnabled(e.parents));
1120
1079
  };
1121
1080
 
1122
- var register = function (editor) {
1123
- editor.addCommand('mceLink', function () {
1124
- if (useQuickLink(editor)) {
1125
- editor.fire('contexttoolbar-show', { toolbarKey: 'quicklink' });
1126
- } else {
1127
- openDialog(editor)();
1128
- }
1129
- });
1130
- };
1131
-
1132
- var setup = function (editor) {
1133
- editor.addShortcut('Meta+K', '', function () {
1081
+ const setup = editor => {
1082
+ editor.addShortcut('Meta+K', '', () => {
1134
1083
  editor.execCommand('mceLink');
1135
1084
  });
1136
1085
  };
1137
1086
 
1138
- var setupButtons = function (editor) {
1087
+ const setupButtons = editor => {
1139
1088
  editor.ui.registry.addToggleButton('link', {
1140
1089
  icon: 'link',
1141
1090
  tooltip: 'Insert/edit link',
1142
1091
  onAction: openDialog(editor),
1143
- onSetup: toggleActiveState(editor)
1092
+ onSetup: toggleLinkState(editor),
1093
+ shortcut: 'Meta+K'
1144
1094
  });
1145
1095
  editor.ui.registry.addButton('openlink', {
1146
1096
  icon: 'new-tab',
1147
1097
  tooltip: 'Open link',
1148
1098
  onAction: gotoSelectedLink(editor),
1149
- onSetup: toggleEnabledState(editor)
1099
+ onSetup: toggleGotoLinkState(editor)
1150
1100
  });
1151
1101
  editor.ui.registry.addButton('unlink', {
1152
1102
  icon: 'unlink',
1153
1103
  tooltip: 'Remove link',
1154
- onAction: function () {
1155
- return unlink(editor);
1156
- },
1104
+ onAction: () => unlink(editor),
1157
1105
  onSetup: toggleUnlinkState(editor)
1158
1106
  });
1159
1107
  };
1160
- var setupMenuItems = function (editor) {
1108
+ const setupMenuItems = editor => {
1161
1109
  editor.ui.registry.addMenuItem('openlink', {
1162
1110
  text: 'Open link',
1163
1111
  icon: 'new-tab',
1164
1112
  onAction: gotoSelectedLink(editor),
1165
- onSetup: toggleEnabledState(editor)
1113
+ onSetup: toggleGotoLinkState(editor)
1166
1114
  });
1167
1115
  editor.ui.registry.addMenuItem('link', {
1168
1116
  icon: 'link',
1169
1117
  text: 'Link...',
1170
1118
  shortcut: 'Meta+K',
1119
+ onSetup: toggleLinkMenuState(editor),
1171
1120
  onAction: openDialog(editor)
1172
1121
  });
1173
1122
  editor.ui.registry.addMenuItem('unlink', {
1174
1123
  icon: 'unlink',
1175
1124
  text: 'Remove link',
1176
- onAction: function () {
1177
- return unlink(editor);
1178
- },
1125
+ onAction: () => unlink(editor),
1179
1126
  onSetup: toggleUnlinkState(editor)
1180
1127
  });
1181
1128
  };
1182
- var setupContextMenu = function (editor) {
1183
- var inLink = 'link unlink openlink';
1184
- var noLink = 'link';
1129
+ const setupContextMenu = editor => {
1130
+ const inLink = 'link unlink openlink';
1131
+ const noLink = 'link';
1185
1132
  editor.ui.registry.addContextMenu('link', {
1186
- update: function (element) {
1133
+ update: element => {
1134
+ const isEditable = editor.dom.isEditable(element);
1135
+ if (!isEditable) {
1136
+ return '';
1137
+ }
1187
1138
  return hasLinks(editor.dom.getParents(element, 'a')) ? inLink : noLink;
1188
1139
  }
1189
1140
  });
1190
1141
  };
1191
- var setupContextToolbars = function (editor) {
1192
- var collapseSelectionToEnd = function (editor) {
1142
+ const setupContextToolbars = editor => {
1143
+ const collapseSelectionToEnd = editor => {
1193
1144
  editor.selection.collapse(false);
1194
1145
  };
1195
- var onSetupLink = function (buttonApi) {
1196
- var node = editor.selection.getNode();
1197
- buttonApi.setDisabled(!getAnchorElement(editor, node));
1146
+ const onSetupLink = buttonApi => {
1147
+ const node = editor.selection.getNode();
1148
+ buttonApi.setEnabled(isInAnchor(editor, node));
1198
1149
  return noop;
1199
1150
  };
1200
- var getLinkText = function (value) {
1201
- var anchor = getAnchorElement(editor);
1202
- var onlyText = isOnlyTextSelected(editor);
1203
- if (!anchor && onlyText) {
1204
- var text = getAnchorText(editor.selection, anchor);
1205
- return Optional.some(text.length > 0 ? text : value);
1151
+ const getLinkText = value => {
1152
+ const anchor = getAnchorElement(editor);
1153
+ const onlyText = isOnlyTextSelected(editor);
1154
+ if (anchor.isNone() && onlyText) {
1155
+ const text = getAnchorText(editor.selection, anchor);
1156
+ return someIf(text.length === 0, value);
1206
1157
  } else {
1207
1158
  return Optional.none();
1208
1159
  }
@@ -1212,15 +1163,13 @@
1212
1163
  type: 'contextformtogglebutton',
1213
1164
  icon: 'link',
1214
1165
  tooltip: 'Link',
1215
- onSetup: toggleActiveState(editor)
1166
+ onSetup: toggleLinkState(editor)
1216
1167
  },
1217
1168
  label: 'Link',
1218
- predicate: function (node) {
1219
- return !!getAnchorElement(editor, node) && hasContextToolbar(editor);
1220
- },
1221
- initValue: function () {
1222
- var elm = getAnchorElement(editor);
1223
- return !!elm ? getHref(elm) : '';
1169
+ predicate: node => hasContextToolbar(editor) && isInAnchor(editor, node),
1170
+ initValue: () => {
1171
+ const elm = getAnchorElement(editor);
1172
+ return elm.fold(constant(''), getHref);
1224
1173
  },
1225
1174
  commands: [
1226
1175
  {
@@ -1228,24 +1177,24 @@
1228
1177
  icon: 'link',
1229
1178
  tooltip: 'Link',
1230
1179
  primary: true,
1231
- onSetup: function (buttonApi) {
1232
- var node = editor.selection.getNode();
1233
- buttonApi.setActive(!!getAnchorElement(editor, node));
1234
- return toggleActiveState(editor)(buttonApi);
1180
+ onSetup: buttonApi => {
1181
+ const node = editor.selection.getNode();
1182
+ buttonApi.setActive(isInAnchor(editor, node));
1183
+ return toggleLinkState(editor)(buttonApi);
1235
1184
  },
1236
- onAction: function (formApi) {
1237
- var value = formApi.getValue();
1238
- var text = getLinkText(value);
1239
- var attachState = {
1185
+ onAction: formApi => {
1186
+ const value = formApi.getValue();
1187
+ const text = getLinkText(value);
1188
+ const attachState = {
1240
1189
  href: value,
1241
1190
  attach: noop
1242
1191
  };
1243
1192
  link(editor, attachState, {
1244
1193
  href: value,
1245
- text: text,
1194
+ text,
1246
1195
  title: Optional.none(),
1247
1196
  rel: Optional.none(),
1248
- target: Optional.none(),
1197
+ target: Optional.from(getDefaultLinkTarget(editor)),
1249
1198
  class: Optional.none()
1250
1199
  });
1251
1200
  collapseSelectionToEnd(editor);
@@ -1257,7 +1206,7 @@
1257
1206
  icon: 'unlink',
1258
1207
  tooltip: 'Remove link',
1259
1208
  onSetup: onSetupLink,
1260
- onAction: function (formApi) {
1209
+ onAction: formApi => {
1261
1210
  unlink(editor);
1262
1211
  formApi.hide();
1263
1212
  }
@@ -1267,7 +1216,7 @@
1267
1216
  icon: 'new-tab',
1268
1217
  tooltip: 'Open link',
1269
1218
  onSetup: onSetupLink,
1270
- onAction: function (formApi) {
1219
+ onAction: formApi => {
1271
1220
  gotoSelectedLink(editor)();
1272
1221
  formApi.hide();
1273
1222
  }
@@ -1276,8 +1225,9 @@
1276
1225
  });
1277
1226
  };
1278
1227
 
1279
- function Plugin () {
1280
- global$7.add('link', function (editor) {
1228
+ var Plugin = () => {
1229
+ global$5.add('link', editor => {
1230
+ register$1(editor);
1281
1231
  setupButtons(editor);
1282
1232
  setupMenuItems(editor);
1283
1233
  setupContextMenu(editor);
@@ -1286,8 +1236,8 @@
1286
1236
  register(editor);
1287
1237
  setup(editor);
1288
1238
  });
1289
- }
1239
+ };
1290
1240
 
1291
1241
  Plugin();
1292
1242
 
1293
- }());
1243
+ })();