@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,215 +1,200 @@
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 Cell = function (initial) {
13
- var value = initial;
14
- var get = function () {
8
+ const Cell = initial => {
9
+ let value = initial;
10
+ const get = () => {
15
11
  return value;
16
12
  };
17
- var set = function (v) {
13
+ const set = v => {
18
14
  value = v;
19
15
  };
20
16
  return {
21
- get: get,
22
- set: set
17
+ get,
18
+ set
23
19
  };
24
20
  };
25
21
 
26
22
  var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
27
23
 
28
- var __assign = function () {
29
- __assign = Object.assign || function __assign(t) {
30
- for (var s, i = 1, n = arguments.length; i < n; i++) {
31
- s = arguments[i];
32
- for (var p in s)
33
- if (Object.prototype.hasOwnProperty.call(s, p))
34
- t[p] = s[p];
35
- }
36
- return t;
37
- };
38
- return __assign.apply(this, arguments);
24
+ const hasProto = (v, constructor, predicate) => {
25
+ var _a;
26
+ if (predicate(v, constructor.prototype)) {
27
+ return true;
28
+ } else {
29
+ return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
30
+ }
39
31
  };
40
-
41
- var typeOf = function (x) {
42
- var t = typeof x;
32
+ const typeOf = x => {
33
+ const t = typeof x;
43
34
  if (x === null) {
44
35
  return 'null';
45
- } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
36
+ } else if (t === 'object' && Array.isArray(x)) {
46
37
  return 'array';
47
- } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
38
+ } else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
48
39
  return 'string';
49
40
  } else {
50
41
  return t;
51
42
  }
52
43
  };
53
- var isType$1 = function (type) {
54
- return function (value) {
55
- return typeOf(value) === type;
56
- };
57
- };
58
- var isSimpleType = function (type) {
59
- return function (value) {
60
- return typeof value === type;
61
- };
62
- };
63
- var isString = isType$1('string');
64
- var isArray = isType$1('array');
65
- var isBoolean = isSimpleType('boolean');
66
- var isNumber = isSimpleType('number');
44
+ const isType$1 = type => value => typeOf(value) === type;
45
+ const isSimpleType = type => value => typeof value === type;
46
+ const isString = isType$1('string');
47
+ const isArray = isType$1('array');
48
+ const isBoolean = isSimpleType('boolean');
49
+ const isNullable = a => a === null || a === undefined;
50
+ const isNonNullable = a => !isNullable(a);
51
+ const isNumber = isSimpleType('number');
67
52
 
68
- var noop = function () {
53
+ const noop = () => {
69
54
  };
70
- var constant = function (value) {
71
- return function () {
55
+ const constant = value => {
56
+ return () => {
72
57
  return value;
73
58
  };
74
59
  };
75
- var identity = function (x) {
76
- return x;
77
- };
78
- var never = constant(false);
79
- var always = constant(true);
60
+ const always = constant(true);
80
61
 
81
- var punctuationStr = '[!-#%-*,-\\/:;?@\\[-\\]_{}\xA1\xAB\xB7\xBB\xBF;\xB7\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1361-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u3008\u3009\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30\u2E31\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uff3f\uFF5B\uFF5D\uFF5F-\uFF65]';
62
+ const punctuationStr = `[~\u2116|!-*+-\\/:;?@\\[-\`{}\u00A1\u00AB\u00B7\u00BB\u00BF;\u00B7\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1361-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u3008\u3009\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30\u2E31\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]`;
82
63
 
83
- var punctuation$1 = constant(punctuationStr);
64
+ const punctuation$1 = constant(punctuationStr);
84
65
 
85
- var none = function () {
86
- return NONE;
87
- };
88
- var NONE = function () {
89
- var call = function (thunk) {
90
- return thunk();
91
- };
92
- var id = identity;
93
- var me = {
94
- fold: function (n, _s) {
95
- return n();
96
- },
97
- isSome: never,
98
- isNone: always,
99
- getOr: id,
100
- getOrThunk: call,
101
- getOrDie: function (msg) {
102
- throw new Error(msg || 'error: getOrDie called on none.');
103
- },
104
- getOrNull: constant(null),
105
- getOrUndefined: constant(undefined),
106
- or: id,
107
- orThunk: call,
108
- map: none,
109
- each: noop,
110
- bind: none,
111
- exists: never,
112
- forall: always,
113
- filter: function () {
114
- return none();
115
- },
116
- toArray: function () {
117
- return [];
118
- },
119
- toString: constant('none()')
120
- };
121
- return me;
122
- }();
123
- var some = function (a) {
124
- var constant_a = constant(a);
125
- var self = function () {
126
- return me;
127
- };
128
- var bind = function (f) {
129
- return f(a);
130
- };
131
- var me = {
132
- fold: function (n, s) {
133
- return s(a);
134
- },
135
- isSome: always,
136
- isNone: never,
137
- getOr: constant_a,
138
- getOrThunk: constant_a,
139
- getOrDie: constant_a,
140
- getOrNull: constant_a,
141
- getOrUndefined: constant_a,
142
- or: self,
143
- orThunk: self,
144
- map: function (f) {
145
- return some(f(a));
146
- },
147
- each: function (f) {
148
- f(a);
149
- },
150
- bind: bind,
151
- exists: bind,
152
- forall: bind,
153
- filter: function (f) {
154
- return f(a) ? me : NONE;
155
- },
156
- toArray: function () {
157
- return [a];
158
- },
159
- toString: function () {
160
- return 'some(' + a + ')';
66
+ class Optional {
67
+ constructor(tag, value) {
68
+ this.tag = tag;
69
+ this.value = value;
70
+ }
71
+ static some(value) {
72
+ return new Optional(true, value);
73
+ }
74
+ static none() {
75
+ return Optional.singletonNone;
76
+ }
77
+ fold(onNone, onSome) {
78
+ if (this.tag) {
79
+ return onSome(this.value);
80
+ } else {
81
+ return onNone();
161
82
  }
162
- };
163
- return me;
164
- };
165
- var from = function (value) {
166
- return value === null || value === undefined ? NONE : some(value);
167
- };
168
- var Optional = {
169
- some: some,
170
- none: none,
171
- from: from
172
- };
83
+ }
84
+ isSome() {
85
+ return this.tag;
86
+ }
87
+ isNone() {
88
+ return !this.tag;
89
+ }
90
+ map(mapper) {
91
+ if (this.tag) {
92
+ return Optional.some(mapper(this.value));
93
+ } else {
94
+ return Optional.none();
95
+ }
96
+ }
97
+ bind(binder) {
98
+ if (this.tag) {
99
+ return binder(this.value);
100
+ } else {
101
+ return Optional.none();
102
+ }
103
+ }
104
+ exists(predicate) {
105
+ return this.tag && predicate(this.value);
106
+ }
107
+ forall(predicate) {
108
+ return !this.tag || predicate(this.value);
109
+ }
110
+ filter(predicate) {
111
+ if (!this.tag || predicate(this.value)) {
112
+ return this;
113
+ } else {
114
+ return Optional.none();
115
+ }
116
+ }
117
+ getOr(replacement) {
118
+ return this.tag ? this.value : replacement;
119
+ }
120
+ or(replacement) {
121
+ return this.tag ? this : replacement;
122
+ }
123
+ getOrThunk(thunk) {
124
+ return this.tag ? this.value : thunk();
125
+ }
126
+ orThunk(thunk) {
127
+ return this.tag ? this : thunk();
128
+ }
129
+ getOrDie(message) {
130
+ if (!this.tag) {
131
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
132
+ } else {
133
+ return this.value;
134
+ }
135
+ }
136
+ static from(value) {
137
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
138
+ }
139
+ getOrNull() {
140
+ return this.tag ? this.value : null;
141
+ }
142
+ getOrUndefined() {
143
+ return this.value;
144
+ }
145
+ each(worker) {
146
+ if (this.tag) {
147
+ worker(this.value);
148
+ }
149
+ }
150
+ toArray() {
151
+ return this.tag ? [this.value] : [];
152
+ }
153
+ toString() {
154
+ return this.tag ? `some(${ this.value })` : 'none()';
155
+ }
156
+ }
157
+ Optional.singletonNone = new Optional(false);
173
158
 
174
- var punctuation = punctuation$1;
159
+ const punctuation = punctuation$1;
175
160
 
176
161
  var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
177
162
 
178
163
  var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
179
164
 
180
- var nativeSlice = Array.prototype.slice;
181
- var nativePush = Array.prototype.push;
182
- var map = function (xs, f) {
183
- var len = xs.length;
184
- var r = new Array(len);
185
- for (var i = 0; i < len; i++) {
186
- var x = xs[i];
165
+ const nativeSlice = Array.prototype.slice;
166
+ const nativePush = Array.prototype.push;
167
+ const map = (xs, f) => {
168
+ const len = xs.length;
169
+ const r = new Array(len);
170
+ for (let i = 0; i < len; i++) {
171
+ const x = xs[i];
187
172
  r[i] = f(x, i);
188
173
  }
189
174
  return r;
190
175
  };
191
- var each = function (xs, f) {
192
- for (var i = 0, len = xs.length; i < len; i++) {
193
- var x = xs[i];
176
+ const each = (xs, f) => {
177
+ for (let i = 0, len = xs.length; i < len; i++) {
178
+ const x = xs[i];
194
179
  f(x, i);
195
180
  }
196
181
  };
197
- var eachr = function (xs, f) {
198
- for (var i = xs.length - 1; i >= 0; i--) {
199
- var x = xs[i];
182
+ const eachr = (xs, f) => {
183
+ for (let i = xs.length - 1; i >= 0; i--) {
184
+ const x = xs[i];
200
185
  f(x, i);
201
186
  }
202
187
  };
203
- var groupBy = function (xs, f) {
188
+ const groupBy = (xs, f) => {
204
189
  if (xs.length === 0) {
205
190
  return [];
206
191
  } else {
207
- var wasType = f(xs[0]);
208
- var r = [];
209
- var group = [];
210
- for (var i = 0, len = xs.length; i < len; i++) {
211
- var x = xs[i];
212
- var type = f(x);
192
+ let wasType = f(xs[0]);
193
+ const r = [];
194
+ let group = [];
195
+ for (let i = 0, len = xs.length; i < len; i++) {
196
+ const x = xs[i];
197
+ const type = f(x);
213
198
  if (type !== wasType) {
214
199
  r.push(group);
215
200
  group = [];
@@ -223,15 +208,15 @@
223
208
  return r;
224
209
  }
225
210
  };
226
- var foldl = function (xs, f, acc) {
227
- each(xs, function (x, i) {
211
+ const foldl = (xs, f, acc) => {
212
+ each(xs, (x, i) => {
228
213
  acc = f(acc, x, i);
229
214
  });
230
215
  return acc;
231
216
  };
232
- var flatten = function (xs) {
233
- var r = [];
234
- for (var i = 0, len = xs.length; i < len; ++i) {
217
+ const flatten = xs => {
218
+ const r = [];
219
+ for (let i = 0, len = xs.length; i < len; ++i) {
235
220
  if (!isArray(xs[i])) {
236
221
  throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
237
222
  }
@@ -239,38 +224,28 @@
239
224
  }
240
225
  return r;
241
226
  };
242
- var bind = function (xs, f) {
243
- return flatten(map(xs, f));
244
- };
245
- var sort = function (xs, comparator) {
246
- var copy = nativeSlice.call(xs, 0);
227
+ const bind = (xs, f) => flatten(map(xs, f));
228
+ const sort = (xs, comparator) => {
229
+ const copy = nativeSlice.call(xs, 0);
247
230
  copy.sort(comparator);
248
231
  return copy;
249
232
  };
250
233
 
251
- var hasOwnProperty = Object.hasOwnProperty;
252
- var has = function (obj, key) {
253
- return hasOwnProperty.call(obj, key);
254
- };
234
+ const hasOwnProperty = Object.hasOwnProperty;
235
+ const has = (obj, key) => hasOwnProperty.call(obj, key);
255
236
 
256
237
  typeof window !== 'undefined' ? window : Function('return this;')();
257
238
 
258
- var DOCUMENT = 9;
259
- var DOCUMENT_FRAGMENT = 11;
260
- var ELEMENT = 1;
261
- var TEXT = 3;
239
+ const DOCUMENT = 9;
240
+ const DOCUMENT_FRAGMENT = 11;
241
+ const ELEMENT = 1;
242
+ const TEXT = 3;
262
243
 
263
- var type = function (element) {
264
- return element.dom.nodeType;
265
- };
266
- var isType = function (t) {
267
- return function (element) {
268
- return type(element) === t;
269
- };
270
- };
271
- var isText$1 = isType(TEXT);
244
+ const type = element => element.dom.nodeType;
245
+ const isType = t => element => type(element) === t;
246
+ const isText$1 = isType(TEXT);
272
247
 
273
- var rawSet = function (dom, key, value) {
248
+ const rawSet = (dom, key, value) => {
274
249
  if (isString(value) || isBoolean(value) || isNumber(value)) {
275
250
  dom.setAttribute(key, value + '');
276
251
  } else {
@@ -278,164 +253,130 @@
278
253
  throw new Error('Attribute value was not simple');
279
254
  }
280
255
  };
281
- var set = function (element, key, value) {
256
+ const set = (element, key, value) => {
282
257
  rawSet(element.dom, key, value);
283
258
  };
284
259
 
285
- var compareDocumentPosition = function (a, b, match) {
286
- return (a.compareDocumentPosition(b) & match) !== 0;
287
- };
288
- var documentPositionPreceding = function (a, b) {
289
- return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING);
290
- };
291
-
292
- var fromHtml = function (html, scope) {
293
- var doc = scope || document;
294
- var div = doc.createElement('div');
260
+ const fromHtml = (html, scope) => {
261
+ const doc = scope || document;
262
+ const div = doc.createElement('div');
295
263
  div.innerHTML = html;
296
264
  if (!div.hasChildNodes() || div.childNodes.length > 1) {
297
- console.error('HTML does not have a single root node', html);
298
- throw new Error('HTML must have a single root node');
265
+ const message = 'HTML does not have a single root node';
266
+ console.error(message, html);
267
+ throw new Error(message);
299
268
  }
300
269
  return fromDom(div.childNodes[0]);
301
270
  };
302
- var fromTag = function (tag, scope) {
303
- var doc = scope || document;
304
- var node = doc.createElement(tag);
271
+ const fromTag = (tag, scope) => {
272
+ const doc = scope || document;
273
+ const node = doc.createElement(tag);
305
274
  return fromDom(node);
306
275
  };
307
- var fromText = function (text, scope) {
308
- var doc = scope || document;
309
- var node = doc.createTextNode(text);
276
+ const fromText = (text, scope) => {
277
+ const doc = scope || document;
278
+ const node = doc.createTextNode(text);
310
279
  return fromDom(node);
311
280
  };
312
- var fromDom = function (node) {
281
+ const fromDom = node => {
313
282
  if (node === null || node === undefined) {
314
283
  throw new Error('Node cannot be null or undefined');
315
284
  }
316
285
  return { dom: node };
317
286
  };
318
- var fromPoint = function (docElm, x, y) {
319
- return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
320
- };
321
- var SugarElement = {
322
- fromHtml: fromHtml,
323
- fromTag: fromTag,
324
- fromText: fromText,
325
- fromDom: fromDom,
326
- fromPoint: fromPoint
287
+ const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
288
+ const SugarElement = {
289
+ fromHtml,
290
+ fromTag,
291
+ fromText,
292
+ fromDom,
293
+ fromPoint
327
294
  };
328
295
 
329
- var bypassSelector = function (dom) {
330
- return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
331
- };
332
- var all = function (selector, scope) {
333
- var base = scope === undefined ? document : scope.dom;
296
+ const bypassSelector = dom => dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
297
+ const all = (selector, scope) => {
298
+ const base = scope === undefined ? document : scope.dom;
334
299
  return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);
335
300
  };
336
301
 
337
- var parent = function (element) {
338
- return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
339
- };
340
- var children = function (element) {
341
- return map(element.dom.childNodes, SugarElement.fromDom);
342
- };
343
- var spot = function (element, offset) {
344
- return {
345
- element: element,
346
- offset: offset
347
- };
348
- };
349
- var leaf = function (element, offset) {
350
- var cs = children(element);
302
+ const parent = element => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
303
+ const children = element => map(element.dom.childNodes, SugarElement.fromDom);
304
+ const spot = (element, offset) => ({
305
+ element,
306
+ offset
307
+ });
308
+ const leaf = (element, offset) => {
309
+ const cs = children(element);
351
310
  return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
352
311
  };
353
312
 
354
- var before = function (marker, element) {
355
- var parent$1 = parent(marker);
356
- parent$1.each(function (v) {
313
+ const before = (marker, element) => {
314
+ const parent$1 = parent(marker);
315
+ parent$1.each(v => {
357
316
  v.dom.insertBefore(element.dom, marker.dom);
358
317
  });
359
318
  };
360
- var append = function (parent, element) {
319
+ const append = (parent, element) => {
361
320
  parent.dom.appendChild(element.dom);
362
321
  };
363
- var wrap = function (element, wrapper) {
322
+ const wrap = (element, wrapper) => {
364
323
  before(element, wrapper);
365
324
  append(wrapper, element);
366
325
  };
367
326
 
368
- var NodeValue = function (is, name) {
369
- var get = function (element) {
327
+ const NodeValue = (is, name) => {
328
+ const get = element => {
370
329
  if (!is(element)) {
371
330
  throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
372
331
  }
373
332
  return getOption(element).getOr('');
374
333
  };
375
- var getOption = function (element) {
376
- return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();
377
- };
378
- var set = function (element, value) {
334
+ const getOption = element => is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();
335
+ const set = (element, value) => {
379
336
  if (!is(element)) {
380
337
  throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
381
338
  }
382
339
  element.dom.nodeValue = value;
383
340
  };
384
341
  return {
385
- get: get,
386
- getOption: getOption,
387
- set: set
342
+ get,
343
+ getOption,
344
+ set
388
345
  };
389
346
  };
390
347
 
391
- var api = NodeValue(isText$1, 'text');
392
- var get$1 = function (element) {
393
- return api.get(element);
394
- };
348
+ const api = NodeValue(isText$1, 'text');
349
+ const get$1 = element => api.get(element);
395
350
 
396
- var descendants = function (scope, selector) {
397
- return all(selector, scope);
351
+ const compareDocumentPosition = (a, b, match) => {
352
+ return (a.compareDocumentPosition(b) & match) !== 0;
353
+ };
354
+ const documentPositionPreceding = (a, b) => {
355
+ return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING);
398
356
  };
399
357
 
358
+ const descendants = (scope, selector) => all(selector, scope);
359
+
400
360
  var global = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
401
361
 
402
- var isSimpleBoundary = function (dom, node) {
403
- return dom.isBlock(node) || has(dom.schema.getShortEndedElements(), node.nodeName);
404
- };
405
- var isContentEditableFalse = function (dom, node) {
406
- return dom.getContentEditable(node) === 'false';
407
- };
408
- var isContentEditableTrueInCef = function (dom, node) {
409
- return dom.getContentEditable(node) === 'true' && dom.getContentEditableParent(node.parentNode) === 'false';
410
- };
411
- var isHidden = function (dom, node) {
412
- return !dom.isBlock(node) && has(dom.schema.getWhiteSpaceElements(), node.nodeName);
413
- };
414
- var isBoundary = function (dom, node) {
415
- return isSimpleBoundary(dom, node) || isContentEditableFalse(dom, node) || isHidden(dom, node) || isContentEditableTrueInCef(dom, node);
416
- };
417
- var isText = function (node) {
418
- return node.nodeType === 3;
419
- };
420
- var nuSection = function () {
421
- return {
422
- sOffset: 0,
423
- fOffset: 0,
424
- elements: []
425
- };
426
- };
427
- var toLeaf = function (node, offset) {
428
- return leaf(SugarElement.fromDom(node), offset);
429
- };
430
- var walk = function (dom, walkerFn, startNode, callbacks, endNode, skipStart) {
431
- if (skipStart === void 0) {
432
- skipStart = true;
433
- }
434
- var next = skipStart ? walkerFn(false) : startNode;
362
+ const isSimpleBoundary = (dom, node) => dom.isBlock(node) || has(dom.schema.getVoidElements(), node.nodeName);
363
+ const isContentEditableFalse = (dom, node) => !dom.isEditable(node);
364
+ const isContentEditableTrueInCef = (dom, node) => dom.getContentEditable(node) === 'true' && node.parentNode && !dom.isEditable(node.parentNode);
365
+ const isHidden = (dom, node) => !dom.isBlock(node) && has(dom.schema.getWhitespaceElements(), node.nodeName);
366
+ const isBoundary = (dom, node) => isSimpleBoundary(dom, node) || isContentEditableFalse(dom, node) || isHidden(dom, node) || isContentEditableTrueInCef(dom, node);
367
+ const isText = node => node.nodeType === 3;
368
+ const nuSection = () => ({
369
+ sOffset: 0,
370
+ fOffset: 0,
371
+ elements: []
372
+ });
373
+ const toLeaf = (node, offset) => leaf(SugarElement.fromDom(node), offset);
374
+ const walk = (dom, walkerFn, startNode, callbacks, endNode, skipStart = true) => {
375
+ let next = skipStart ? walkerFn(false) : startNode;
435
376
  while (next) {
436
- var isCefNode = isContentEditableFalse(dom, next);
377
+ const isCefNode = isContentEditableFalse(dom, next);
437
378
  if (isCefNode || isHidden(dom, next)) {
438
- var stopWalking = isCefNode ? callbacks.cef(next) : callbacks.boundary(next);
379
+ const stopWalking = isCefNode ? callbacks.cef(next) : callbacks.boundary(next);
439
380
  if (stopWalking) {
440
381
  break;
441
382
  } else {
@@ -456,17 +397,18 @@
456
397
  }
457
398
  }
458
399
  };
459
- var collectTextToBoundary = function (dom, section, node, rootNode, forwards) {
400
+ const collectTextToBoundary = (dom, section, node, rootNode, forwards) => {
401
+ var _a;
460
402
  if (isBoundary(dom, node)) {
461
403
  return;
462
404
  }
463
- var rootBlock = dom.getParent(rootNode, dom.isBlock);
464
- var walker = new global(node, rootBlock);
465
- var walkerFn = forwards ? walker.next.bind(walker) : walker.prev.bind(walker);
405
+ const rootBlock = (_a = dom.getParent(rootNode, dom.isBlock)) !== null && _a !== void 0 ? _a : dom.getRoot();
406
+ const walker = new global(node, rootBlock);
407
+ const walkerFn = forwards ? walker.next.bind(walker) : walker.prev.bind(walker);
466
408
  walk(dom, walkerFn, node, {
467
409
  boundary: always,
468
410
  cef: always,
469
- text: function (next) {
411
+ text: next => {
470
412
  if (forwards) {
471
413
  section.fOffset += next.length;
472
414
  } else {
@@ -476,15 +418,12 @@
476
418
  }
477
419
  });
478
420
  };
479
- var collect = function (dom, rootNode, startNode, endNode, callbacks, skipStart) {
480
- if (skipStart === void 0) {
481
- skipStart = true;
482
- }
483
- var walker = new global(startNode, rootNode);
484
- var sections = [];
485
- var current = nuSection();
421
+ const collect = (dom, rootNode, startNode, endNode, callbacks, skipStart = true) => {
422
+ const walker = new global(startNode, rootNode);
423
+ const sections = [];
424
+ let current = nuSection();
486
425
  collectTextToBoundary(dom, current, startNode, rootNode, false);
487
- var finishSection = function () {
426
+ const finishSection = () => {
488
427
  if (current.elements.length > 0) {
489
428
  sections.push(current);
490
429
  current = nuSection();
@@ -493,14 +432,14 @@
493
432
  };
494
433
  walk(dom, walker.next.bind(walker), startNode, {
495
434
  boundary: finishSection,
496
- cef: function (node) {
435
+ cef: node => {
497
436
  finishSection();
498
437
  if (callbacks) {
499
- sections.push.apply(sections, callbacks.cef(node));
438
+ sections.push(...callbacks.cef(node));
500
439
  }
501
440
  return false;
502
441
  },
503
- text: function (next) {
442
+ text: next => {
504
443
  current.elements.push(SugarElement.fromDom(next));
505
444
  if (callbacks) {
506
445
  callbacks.text(next, current);
@@ -513,59 +452,45 @@
513
452
  finishSection();
514
453
  return sections;
515
454
  };
516
- var collectRangeSections = function (dom, rng) {
517
- var start = toLeaf(rng.startContainer, rng.startOffset);
518
- var startNode = start.element.dom;
519
- var end = toLeaf(rng.endContainer, rng.endOffset);
520
- var endNode = end.element.dom;
455
+ const collectRangeSections = (dom, rng) => {
456
+ const start = toLeaf(rng.startContainer, rng.startOffset);
457
+ const startNode = start.element.dom;
458
+ const end = toLeaf(rng.endContainer, rng.endOffset);
459
+ const endNode = end.element.dom;
521
460
  return collect(dom, rng.commonAncestorContainer, startNode, endNode, {
522
- text: function (node, section) {
461
+ text: (node, section) => {
523
462
  if (node === endNode) {
524
463
  section.fOffset += node.length - end.offset;
525
464
  } else if (node === startNode) {
526
465
  section.sOffset += start.offset;
527
466
  }
528
467
  },
529
- cef: function (node) {
530
- var sections = bind(descendants(SugarElement.fromDom(node), '*[contenteditable=true]'), function (e) {
531
- var ceTrueNode = e.dom;
468
+ cef: node => {
469
+ const sections = bind(descendants(SugarElement.fromDom(node), '*[contenteditable=true]'), e => {
470
+ const ceTrueNode = e.dom;
532
471
  return collect(dom, ceTrueNode, ceTrueNode);
533
472
  });
534
- return sort(sections, function (a, b) {
535
- return documentPositionPreceding(a.elements[0].dom, b.elements[0].dom) ? 1 : -1;
536
- });
473
+ return sort(sections, (a, b) => documentPositionPreceding(a.elements[0].dom, b.elements[0].dom) ? 1 : -1);
537
474
  }
538
475
  }, false);
539
476
  };
540
- var fromRng = function (dom, rng) {
541
- return rng.collapsed ? [] : collectRangeSections(dom, rng);
542
- };
543
- var fromNode = function (dom, node) {
544
- var rng = dom.createRng();
477
+ const fromRng = (dom, rng) => rng.collapsed ? [] : collectRangeSections(dom, rng);
478
+ const fromNode = (dom, node) => {
479
+ const rng = dom.createRng();
545
480
  rng.selectNode(node);
546
481
  return fromRng(dom, rng);
547
482
  };
548
- var fromNodes = function (dom, nodes) {
549
- return bind(nodes, function (node) {
550
- return fromNode(dom, node);
551
- });
552
- };
483
+ const fromNodes = (dom, nodes) => bind(nodes, node => fromNode(dom, node));
553
484
 
554
- var find$2 = function (text, pattern, start, finish) {
555
- if (start === void 0) {
556
- start = 0;
557
- }
558
- if (finish === void 0) {
559
- finish = text.length;
560
- }
561
- var regex = pattern.regex;
485
+ const find$2 = (text, pattern, start = 0, finish = text.length) => {
486
+ const regex = pattern.regex;
562
487
  regex.lastIndex = start;
563
- var results = [];
564
- var match;
488
+ const results = [];
489
+ let match;
565
490
  while (match = regex.exec(text)) {
566
- var matchedText = match[pattern.matchIndex];
567
- var matchStart = match.index + match[0].indexOf(matchedText);
568
- var matchFinish = matchStart + matchedText.length;
491
+ const matchedText = match[pattern.matchIndex];
492
+ const matchStart = match.index + match[0].indexOf(matchedText);
493
+ const matchFinish = matchStart + matchedText.length;
569
494
  if (matchFinish > finish) {
570
495
  break;
571
496
  }
@@ -577,15 +502,15 @@
577
502
  }
578
503
  return results;
579
504
  };
580
- var extract = function (elements, matches) {
581
- var nodePositions = foldl(elements, function (acc, element) {
582
- var content = get$1(element);
583
- var start = acc.last;
584
- var finish = start + content.length;
585
- var positions = bind(matches, function (match, matchIdx) {
505
+ const extract = (elements, matches) => {
506
+ const nodePositions = foldl(elements, (acc, element) => {
507
+ const content = get$1(element);
508
+ const start = acc.last;
509
+ const finish = start + content.length;
510
+ const positions = bind(matches, (match, matchIdx) => {
586
511
  if (match.start < finish && match.finish > start) {
587
512
  return [{
588
- element: element,
513
+ element,
589
514
  start: Math.max(start, match.start) - start,
590
515
  finish: Math.min(finish, match.finish) - start,
591
516
  matchId: matchIdx
@@ -602,64 +527,56 @@
602
527
  results: [],
603
528
  last: 0
604
529
  }).results;
605
- return groupBy(nodePositions, function (position) {
606
- return position.matchId;
607
- });
530
+ return groupBy(nodePositions, position => position.matchId);
608
531
  };
609
532
 
610
- var find$1 = function (pattern, sections) {
611
- return bind(sections, function (section) {
612
- var elements = section.elements;
613
- var content = map(elements, get$1).join('');
614
- var positions = find$2(content, pattern, section.sOffset, content.length - section.fOffset);
615
- return extract(elements, positions);
616
- });
617
- };
618
- var mark = function (matches, replacementNode) {
619
- eachr(matches, function (match, idx) {
620
- eachr(match, function (pos) {
621
- var wrapper = SugarElement.fromDom(replacementNode.cloneNode(false));
533
+ const find$1 = (pattern, sections) => bind(sections, section => {
534
+ const elements = section.elements;
535
+ const content = map(elements, get$1).join('');
536
+ const positions = find$2(content, pattern, section.sOffset, content.length - section.fOffset);
537
+ return extract(elements, positions);
538
+ });
539
+ const mark = (matches, replacementNode) => {
540
+ eachr(matches, (match, idx) => {
541
+ eachr(match, pos => {
542
+ const wrapper = SugarElement.fromDom(replacementNode.cloneNode(false));
622
543
  set(wrapper, 'data-mce-index', idx);
623
- var textNode = pos.element.dom;
544
+ const textNode = pos.element.dom;
624
545
  if (textNode.length === pos.finish && pos.start === 0) {
625
546
  wrap(pos.element, wrapper);
626
547
  } else {
627
548
  if (textNode.length !== pos.finish) {
628
549
  textNode.splitText(pos.finish);
629
550
  }
630
- var matchNode = textNode.splitText(pos.start);
551
+ const matchNode = textNode.splitText(pos.start);
631
552
  wrap(SugarElement.fromDom(matchNode), wrapper);
632
553
  }
633
554
  });
634
555
  });
635
556
  };
636
- var findAndMark = function (dom, pattern, node, replacementNode) {
637
- var textSections = fromNode(dom, node);
638
- var matches = find$1(pattern, textSections);
557
+ const findAndMark = (dom, pattern, node, replacementNode) => {
558
+ const textSections = fromNode(dom, node);
559
+ const matches = find$1(pattern, textSections);
639
560
  mark(matches, replacementNode);
640
561
  return matches.length;
641
562
  };
642
- var findAndMarkInSelection = function (dom, pattern, selection, replacementNode) {
643
- var bookmark = selection.getBookmark();
644
- var nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');
645
- var textSections = nodes.length > 0 ? fromNodes(dom, nodes) : fromRng(dom, selection.getRng());
646
- var matches = find$1(pattern, textSections);
563
+ const findAndMarkInSelection = (dom, pattern, selection, replacementNode) => {
564
+ const bookmark = selection.getBookmark();
565
+ const nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');
566
+ const textSections = nodes.length > 0 ? fromNodes(dom, nodes) : fromRng(dom, selection.getRng());
567
+ const matches = find$1(pattern, textSections);
647
568
  mark(matches, replacementNode);
648
569
  selection.moveToBookmark(bookmark);
649
570
  return matches.length;
650
571
  };
651
572
 
652
- var getElmIndex = function (elm) {
653
- var value = elm.getAttribute('data-mce-index');
654
- if (typeof value === 'number') {
655
- return '' + value;
656
- }
657
- return value;
573
+ const getElmIndex = elm => {
574
+ return elm.getAttribute('data-mce-index');
658
575
  };
659
- var markAllMatches = function (editor, currentSearchState, pattern, inSelection) {
660
- var marker = editor.dom.create('span', { 'data-mce-bogus': 1 });
576
+ const markAllMatches = (editor, currentSearchState, pattern, inSelection) => {
577
+ const marker = editor.dom.create('span', { 'data-mce-bogus': 1 });
661
578
  marker.className = 'mce-match-marker';
662
- var node = editor.getBody();
579
+ const node = editor.getBody();
663
580
  done(editor, currentSearchState, false);
664
581
  if (inSelection) {
665
582
  return findAndMarkInSelection(editor.dom, pattern, editor.selection, marker);
@@ -667,19 +584,20 @@
667
584
  return findAndMark(editor.dom, pattern, node, marker);
668
585
  }
669
586
  };
670
- var unwrap = function (node) {
671
- var parentNode = node.parentNode;
587
+ const unwrap = node => {
588
+ var _a;
589
+ const parentNode = node.parentNode;
672
590
  if (node.firstChild) {
673
591
  parentNode.insertBefore(node.firstChild, node);
674
592
  }
675
- node.parentNode.removeChild(node);
593
+ (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(node);
676
594
  };
677
- var findSpansByIndex = function (editor, index) {
678
- var spans = [];
679
- var nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
595
+ const findSpansByIndex = (editor, index) => {
596
+ const spans = [];
597
+ const nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
680
598
  if (nodes.length) {
681
- for (var i = 0; i < nodes.length; i++) {
682
- var nodeIndex = getElmIndex(nodes[i]);
599
+ for (let i = 0; i < nodes.length; i++) {
600
+ const nodeIndex = getElmIndex(nodes[i]);
683
601
  if (nodeIndex === null || !nodeIndex.length) {
684
602
  continue;
685
603
  }
@@ -690,11 +608,10 @@
690
608
  }
691
609
  return spans;
692
610
  };
693
- var moveSelection = function (editor, currentSearchState, forward) {
694
- var searchState = currentSearchState.get();
695
- var testIndex = searchState.index;
696
- var dom = editor.dom;
697
- forward = forward !== false;
611
+ const moveSelection = (editor, currentSearchState, forward) => {
612
+ const searchState = currentSearchState.get();
613
+ let testIndex = searchState.index;
614
+ const dom = editor.dom;
698
615
  if (forward) {
699
616
  if (testIndex + 1 === searchState.count) {
700
617
  testIndex = 0;
@@ -709,7 +626,7 @@
709
626
  }
710
627
  }
711
628
  dom.removeClass(findSpansByIndex(editor, searchState.index), 'mce-match-marker-selected');
712
- var spans = findSpansByIndex(editor, testIndex);
629
+ const spans = findSpansByIndex(editor, testIndex);
713
630
  if (spans.length) {
714
631
  dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');
715
632
  editor.selection.scrollIntoView(spans[0]);
@@ -717,68 +634,74 @@
717
634
  }
718
635
  return -1;
719
636
  };
720
- var removeNode = function (dom, node) {
721
- var parent = node.parentNode;
637
+ const removeNode = (dom, node) => {
638
+ const parent = node.parentNode;
722
639
  dom.remove(node);
723
- if (dom.isEmpty(parent)) {
640
+ if (parent && dom.isEmpty(parent)) {
724
641
  dom.remove(parent);
725
642
  }
726
643
  };
727
- var escapeSearchText = function (text, wholeWord) {
728
- var escapedText = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&').replace(/\s/g, '[^\\S\\r\\n\\uFEFF]');
729
- var wordRegex = '(' + escapedText + ')';
730
- return wholeWord ? '(?:^|\\s|' + punctuation() + ')' + wordRegex + ('(?=$|\\s|' + punctuation() + ')') : wordRegex;
644
+ const escapeSearchText = (text, wholeWord) => {
645
+ const escapedText = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&').replace(/\s/g, '[^\\S\\r\\n\\uFEFF]');
646
+ const wordRegex = '(' + escapedText + ')';
647
+ return wholeWord ? `(?:^|\\s|${ punctuation() })` + wordRegex + `(?=$|\\s|${ punctuation() })` : wordRegex;
731
648
  };
732
- var find = function (editor, currentSearchState, text, matchCase, wholeWord, inSelection) {
733
- var selection = editor.selection;
734
- var escapedText = escapeSearchText(text, wholeWord);
735
- var isForwardSelection = selection.isForward();
736
- var pattern = {
649
+ const find = (editor, currentSearchState, text, matchCase, wholeWord, inSelection) => {
650
+ const selection = editor.selection;
651
+ const escapedText = escapeSearchText(text, wholeWord);
652
+ const isForwardSelection = selection.isForward();
653
+ const pattern = {
737
654
  regex: new RegExp(escapedText, matchCase ? 'g' : 'gi'),
738
655
  matchIndex: 1
739
656
  };
740
- var count = markAllMatches(editor, currentSearchState, pattern, inSelection);
657
+ const count = markAllMatches(editor, currentSearchState, pattern, inSelection);
741
658
  if (global$2.browser.isSafari()) {
742
659
  selection.setRng(selection.getRng(), isForwardSelection);
743
660
  }
744
661
  if (count) {
745
- var newIndex = moveSelection(editor, currentSearchState, true);
662
+ const newIndex = moveSelection(editor, currentSearchState, true);
746
663
  currentSearchState.set({
747
664
  index: newIndex,
748
- count: count,
749
- text: text,
750
- matchCase: matchCase,
751
- wholeWord: wholeWord,
752
- inSelection: inSelection
665
+ count,
666
+ text,
667
+ matchCase,
668
+ wholeWord,
669
+ inSelection
753
670
  });
754
671
  }
755
672
  return count;
756
673
  };
757
- var next = function (editor, currentSearchState) {
758
- var index = moveSelection(editor, currentSearchState, true);
759
- currentSearchState.set(__assign(__assign({}, currentSearchState.get()), { index: index }));
674
+ const next = (editor, currentSearchState) => {
675
+ const index = moveSelection(editor, currentSearchState, true);
676
+ currentSearchState.set({
677
+ ...currentSearchState.get(),
678
+ index
679
+ });
760
680
  };
761
- var prev = function (editor, currentSearchState) {
762
- var index = moveSelection(editor, currentSearchState, false);
763
- currentSearchState.set(__assign(__assign({}, currentSearchState.get()), { index: index }));
681
+ const prev = (editor, currentSearchState) => {
682
+ const index = moveSelection(editor, currentSearchState, false);
683
+ currentSearchState.set({
684
+ ...currentSearchState.get(),
685
+ index
686
+ });
764
687
  };
765
- var isMatchSpan = function (node) {
766
- var matchIndex = getElmIndex(node);
688
+ const isMatchSpan = node => {
689
+ const matchIndex = getElmIndex(node);
767
690
  return matchIndex !== null && matchIndex.length > 0;
768
691
  };
769
- var replace = function (editor, currentSearchState, text, forward, all) {
770
- var searchState = currentSearchState.get();
771
- var currentIndex = searchState.index;
772
- var currentMatchIndex, nextIndex = currentIndex;
692
+ const replace = (editor, currentSearchState, text, forward, all) => {
693
+ const searchState = currentSearchState.get();
694
+ const currentIndex = searchState.index;
695
+ let currentMatchIndex, nextIndex = currentIndex;
773
696
  forward = forward !== false;
774
- var node = editor.getBody();
775
- var nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);
776
- for (var i = 0; i < nodes.length; i++) {
777
- var nodeIndex = getElmIndex(nodes[i]);
778
- var matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
697
+ const node = editor.getBody();
698
+ const nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);
699
+ for (let i = 0; i < nodes.length; i++) {
700
+ const nodeIndex = getElmIndex(nodes[i]);
701
+ let matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
779
702
  if (all || matchIndex === searchState.index) {
780
703
  if (text.length) {
781
- nodes[i].firstChild.nodeValue = text;
704
+ nodes[i].innerText = text;
782
705
  unwrap(nodes[i]);
783
706
  } else {
784
707
  removeNode(editor.dom, nodes[i]);
@@ -799,10 +722,11 @@
799
722
  nodes[i].setAttribute('data-mce-index', String(currentMatchIndex - 1));
800
723
  }
801
724
  }
802
- currentSearchState.set(__assign(__assign({}, searchState), {
725
+ currentSearchState.set({
726
+ ...searchState,
803
727
  count: all ? 0 : searchState.count - 1,
804
728
  index: nextIndex
805
- }));
729
+ });
806
730
  if (forward) {
807
731
  next(editor, currentSearchState);
808
732
  } else {
@@ -810,12 +734,13 @@
810
734
  }
811
735
  return !all && currentSearchState.get().count > 0;
812
736
  };
813
- var done = function (editor, currentSearchState, keepEditorSelection) {
814
- var startContainer, endContainer;
815
- var searchState = currentSearchState.get();
816
- var nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
817
- for (var i = 0; i < nodes.length; i++) {
818
- var nodeIndex = getElmIndex(nodes[i]);
737
+ const done = (editor, currentSearchState, keepEditorSelection) => {
738
+ let startContainer;
739
+ let endContainer;
740
+ const searchState = currentSearchState.get();
741
+ const nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
742
+ for (let i = 0; i < nodes.length; i++) {
743
+ const nodeIndex = getElmIndex(nodes[i]);
819
744
  if (nodeIndex !== null && nodeIndex.length) {
820
745
  if (nodeIndex === searchState.index.toString()) {
821
746
  if (!startContainer) {
@@ -826,45 +751,41 @@
826
751
  unwrap(nodes[i]);
827
752
  }
828
753
  }
829
- currentSearchState.set(__assign(__assign({}, searchState), {
754
+ currentSearchState.set({
755
+ ...searchState,
830
756
  index: -1,
831
757
  count: 0,
832
758
  text: ''
833
- }));
759
+ });
834
760
  if (startContainer && endContainer) {
835
- var rng = editor.dom.createRng();
761
+ const rng = editor.dom.createRng();
836
762
  rng.setStart(startContainer, 0);
837
763
  rng.setEnd(endContainer, endContainer.data.length);
838
764
  if (keepEditorSelection !== false) {
839
765
  editor.selection.setRng(rng);
840
766
  }
841
767
  return rng;
768
+ } else {
769
+ return undefined;
842
770
  }
843
771
  };
844
- var hasNext = function (editor, currentSearchState) {
845
- return currentSearchState.get().count > 1;
846
- };
847
- var hasPrev = function (editor, currentSearchState) {
848
- return currentSearchState.get().count > 1;
849
- };
772
+ const hasNext = (editor, currentSearchState) => currentSearchState.get().count > 1;
773
+ const hasPrev = (editor, currentSearchState) => currentSearchState.get().count > 1;
850
774
 
851
- var get = function (editor, currentState) {
852
- var done$1 = function (keepEditorSelection) {
775
+ const get = (editor, currentState) => {
776
+ const done$1 = keepEditorSelection => {
853
777
  return done(editor, currentState, keepEditorSelection);
854
778
  };
855
- var find$1 = function (text, matchCase, wholeWord, inSelection) {
856
- if (inSelection === void 0) {
857
- inSelection = false;
858
- }
779
+ const find$1 = (text, matchCase, wholeWord, inSelection = false) => {
859
780
  return find(editor, currentState, text, matchCase, wholeWord, inSelection);
860
781
  };
861
- var next$1 = function () {
782
+ const next$1 = () => {
862
783
  return next(editor, currentState);
863
784
  };
864
- var prev$1 = function () {
785
+ const prev$1 = () => {
865
786
  return prev(editor, currentState);
866
787
  };
867
- var replace$1 = function (text, forward, all) {
788
+ const replace$1 = (text, forward, all) => {
868
789
  return replace(editor, currentState, text, forward, all);
869
790
  };
870
791
  return {
@@ -876,87 +797,79 @@
876
797
  };
877
798
  };
878
799
 
879
- var singleton = function (doRevoke) {
880
- var subject = Cell(Optional.none());
881
- var revoke = function () {
882
- return subject.get().each(doRevoke);
883
- };
884
- var clear = function () {
800
+ const singleton = doRevoke => {
801
+ const subject = Cell(Optional.none());
802
+ const revoke = () => subject.get().each(doRevoke);
803
+ const clear = () => {
885
804
  revoke();
886
805
  subject.set(Optional.none());
887
806
  };
888
- var isSet = function () {
889
- return subject.get().isSome();
890
- };
891
- var get = function () {
892
- return subject.get();
893
- };
894
- var set = function (s) {
807
+ const isSet = () => subject.get().isSome();
808
+ const get = () => subject.get();
809
+ const set = s => {
895
810
  revoke();
896
811
  subject.set(Optional.some(s));
897
812
  };
898
813
  return {
899
- clear: clear,
900
- isSet: isSet,
901
- get: get,
902
- set: set
814
+ clear,
815
+ isSet,
816
+ get,
817
+ set
903
818
  };
904
819
  };
905
- var value = function () {
906
- var subject = singleton(noop);
907
- var on = function (f) {
908
- return subject.get().each(f);
820
+ const value = () => {
821
+ const subject = singleton(noop);
822
+ const on = f => subject.get().each(f);
823
+ return {
824
+ ...subject,
825
+ on
909
826
  };
910
- return __assign(__assign({}, subject), { on: on });
911
827
  };
912
828
 
913
- var open = function (editor, currentSearchState) {
914
- var dialogApi = value();
829
+ const open = (editor, currentSearchState) => {
830
+ const dialogApi = value();
915
831
  editor.undoManager.add();
916
- var selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));
917
- var updateButtonStates = function (api) {
918
- var updateNext = hasNext(editor, currentSearchState) ? api.enable : api.disable;
919
- updateNext('next');
920
- var updatePrev = hasPrev(editor, currentSearchState) ? api.enable : api.disable;
921
- updatePrev('prev');
832
+ const selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));
833
+ const updateButtonStates = api => {
834
+ api.setEnabled('next', hasNext(editor, currentSearchState));
835
+ api.setEnabled('prev', hasPrev(editor, currentSearchState));
922
836
  };
923
- var updateSearchState = function (api) {
924
- var data = api.getData();
925
- var current = currentSearchState.get();
926
- currentSearchState.set(__assign(__assign({}, current), {
837
+ const updateSearchState = api => {
838
+ const data = api.getData();
839
+ const current = currentSearchState.get();
840
+ currentSearchState.set({
841
+ ...current,
927
842
  matchCase: data.matchcase,
928
843
  wholeWord: data.wholewords,
929
844
  inSelection: data.inselection
930
- }));
845
+ });
931
846
  };
932
- var disableAll = function (api, disable) {
933
- var buttons = [
847
+ const disableAll = (api, disable) => {
848
+ const buttons = [
934
849
  'replace',
935
850
  'replaceall',
936
851
  'prev',
937
852
  'next'
938
853
  ];
939
- var toggle = disable ? api.disable : api.enable;
854
+ const toggle = name => api.setEnabled(name, !disable);
940
855
  each(buttons, toggle);
941
856
  };
942
- var notFoundAlert = function (api) {
943
- editor.windowManager.alert('Could not find the specified string.', function () {
944
- api.focus('findtext');
945
- });
857
+ const toggleNotFoundAlert = (isVisible, api) => {
858
+ api.redial(getDialogSpec(isVisible, api.getData()));
946
859
  };
947
- var focusButtonIfRequired = function (api, name) {
860
+ const focusButtonIfRequired = (api, name) => {
948
861
  if (global$2.browser.isSafari() && global$2.deviceType.isTouch() && (name === 'find' || name === 'replace' || name === 'replaceall')) {
949
862
  api.focus(name);
950
863
  }
951
864
  };
952
- var reset = function (api) {
865
+ const reset = api => {
953
866
  done(editor, currentSearchState, false);
954
867
  disableAll(api, true);
955
868
  updateButtonStates(api);
956
869
  };
957
- var doFind = function (api) {
958
- var data = api.getData();
959
- var last = currentSearchState.get();
870
+ const doFind = api => {
871
+ const data = api.getData();
872
+ const last = currentSearchState.get();
960
873
  if (!data.findtext.length) {
961
874
  reset(api);
962
875
  return;
@@ -964,63 +877,75 @@
964
877
  if (last.text === data.findtext && last.matchCase === data.matchcase && last.wholeWord === data.wholewords) {
965
878
  next(editor, currentSearchState);
966
879
  } else {
967
- var count = find(editor, currentSearchState, data.findtext, data.matchcase, data.wholewords, data.inselection);
880
+ const count = find(editor, currentSearchState, data.findtext, data.matchcase, data.wholewords, data.inselection);
968
881
  if (count <= 0) {
969
- notFoundAlert(api);
882
+ toggleNotFoundAlert(true, api);
970
883
  }
971
884
  disableAll(api, count === 0);
972
885
  }
973
886
  updateButtonStates(api);
974
887
  };
975
- var initialState = currentSearchState.get();
976
- var initialData = {
888
+ const initialState = currentSearchState.get();
889
+ const initialData = {
977
890
  findtext: selectedText,
978
891
  replacetext: '',
979
892
  wholewords: initialState.wholeWord,
980
893
  matchcase: initialState.matchCase,
981
894
  inselection: initialState.inSelection
982
895
  };
983
- var spec = {
896
+ const getPanelItems = error => {
897
+ const items = [
898
+ {
899
+ type: 'bar',
900
+ items: [
901
+ {
902
+ type: 'input',
903
+ name: 'findtext',
904
+ placeholder: 'Find',
905
+ maximized: true,
906
+ inputMode: 'search'
907
+ },
908
+ {
909
+ type: 'button',
910
+ name: 'prev',
911
+ text: 'Previous',
912
+ icon: 'action-prev',
913
+ enabled: false,
914
+ borderless: true
915
+ },
916
+ {
917
+ type: 'button',
918
+ name: 'next',
919
+ text: 'Next',
920
+ icon: 'action-next',
921
+ enabled: false,
922
+ borderless: true
923
+ }
924
+ ]
925
+ },
926
+ {
927
+ type: 'input',
928
+ name: 'replacetext',
929
+ placeholder: 'Replace with',
930
+ inputMode: 'search'
931
+ }
932
+ ];
933
+ if (error) {
934
+ items.push({
935
+ type: 'alertbanner',
936
+ level: 'error',
937
+ text: 'Could not find the specified string.',
938
+ icon: 'warning'
939
+ });
940
+ }
941
+ return items;
942
+ };
943
+ const getDialogSpec = (showNoMatchesAlertBanner, initialData) => ({
984
944
  title: 'Find and Replace',
985
945
  size: 'normal',
986
946
  body: {
987
947
  type: 'panel',
988
- items: [
989
- {
990
- type: 'bar',
991
- items: [
992
- {
993
- type: 'input',
994
- name: 'findtext',
995
- placeholder: 'Find',
996
- maximized: true,
997
- inputMode: 'search'
998
- },
999
- {
1000
- type: 'button',
1001
- name: 'prev',
1002
- text: 'Previous',
1003
- icon: 'action-prev',
1004
- disabled: true,
1005
- borderless: true
1006
- },
1007
- {
1008
- type: 'button',
1009
- name: 'next',
1010
- text: 'Next',
1011
- icon: 'action-next',
1012
- disabled: true,
1013
- borderless: true
1014
- }
1015
- ]
1016
- },
1017
- {
1018
- type: 'input',
1019
- name: 'replacetext',
1020
- placeholder: 'Replace with',
1021
- inputMode: 'search'
1022
- }
1023
- ]
948
+ items: getPanelItems(showNoMatchesAlertBanner)
1024
949
  },
1025
950
  buttons: [
1026
951
  {
@@ -1057,23 +982,26 @@
1057
982
  type: 'custom',
1058
983
  name: 'replace',
1059
984
  text: 'Replace',
1060
- disabled: true
985
+ enabled: false
1061
986
  },
1062
987
  {
1063
988
  type: 'custom',
1064
989
  name: 'replaceall',
1065
990
  text: 'Replace all',
1066
- disabled: true
991
+ enabled: false
1067
992
  }
1068
993
  ],
1069
- initialData: initialData,
1070
- onChange: function (api, details) {
994
+ initialData,
995
+ onChange: (api, details) => {
996
+ if (showNoMatchesAlertBanner) {
997
+ toggleNotFoundAlert(false, api);
998
+ }
1071
999
  if (details.name === 'findtext' && currentSearchState.get().count > 0) {
1072
1000
  reset(api);
1073
1001
  }
1074
1002
  },
1075
- onAction: function (api, details) {
1076
- var data = api.getData();
1003
+ onAction: (api, details) => {
1004
+ const data = api.getData();
1077
1005
  switch (details.name) {
1078
1006
  case 'find':
1079
1007
  doFind(api);
@@ -1100,37 +1028,36 @@
1100
1028
  case 'matchcase':
1101
1029
  case 'wholewords':
1102
1030
  case 'inselection':
1031
+ toggleNotFoundAlert(false, api);
1103
1032
  updateSearchState(api);
1104
1033
  reset(api);
1105
1034
  break;
1106
1035
  }
1107
1036
  focusButtonIfRequired(api, details.name);
1108
1037
  },
1109
- onSubmit: function (api) {
1038
+ onSubmit: api => {
1110
1039
  doFind(api);
1111
1040
  focusButtonIfRequired(api, 'find');
1112
1041
  },
1113
- onClose: function () {
1042
+ onClose: () => {
1114
1043
  editor.focus();
1115
1044
  done(editor, currentSearchState);
1116
1045
  editor.undoManager.add();
1117
1046
  }
1118
- };
1119
- dialogApi.set(editor.windowManager.open(spec, { inline: 'toolbar' }));
1047
+ });
1048
+ dialogApi.set(editor.windowManager.open(getDialogSpec(false, initialData), { inline: 'toolbar' }));
1120
1049
  };
1121
1050
 
1122
- var register$1 = function (editor, currentSearchState) {
1123
- editor.addCommand('SearchReplace', function () {
1051
+ const register$1 = (editor, currentSearchState) => {
1052
+ editor.addCommand('SearchReplace', () => {
1124
1053
  open(editor, currentSearchState);
1125
1054
  });
1126
1055
  };
1127
1056
 
1128
- var showDialog = function (editor, currentSearchState) {
1129
- return function () {
1130
- open(editor, currentSearchState);
1131
- };
1057
+ const showDialog = (editor, currentSearchState) => () => {
1058
+ open(editor, currentSearchState);
1132
1059
  };
1133
- var register = function (editor, currentSearchState) {
1060
+ const register = (editor, currentSearchState) => {
1134
1061
  editor.ui.registry.addMenuItem('searchreplace', {
1135
1062
  text: 'Find and replace...',
1136
1063
  shortcut: 'Meta+F',
@@ -1140,14 +1067,15 @@
1140
1067
  editor.ui.registry.addButton('searchreplace', {
1141
1068
  tooltip: 'Find and replace',
1142
1069
  onAction: showDialog(editor, currentSearchState),
1143
- icon: 'search'
1070
+ icon: 'search',
1071
+ shortcut: 'Meta+F'
1144
1072
  });
1145
1073
  editor.shortcuts.add('Meta+F', '', showDialog(editor, currentSearchState));
1146
1074
  };
1147
1075
 
1148
- function Plugin () {
1149
- global$3.add('searchreplace', function (editor) {
1150
- var currentSearchState = Cell({
1076
+ var Plugin = () => {
1077
+ global$3.add('searchreplace', editor => {
1078
+ const currentSearchState = Cell({
1151
1079
  index: -1,
1152
1080
  count: 0,
1153
1081
  text: '',
@@ -1159,8 +1087,8 @@
1159
1087
  register(editor, currentSearchState);
1160
1088
  return get(editor, currentSearchState);
1161
1089
  });
1162
- }
1090
+ };
1163
1091
 
1164
1092
  Plugin();
1165
1093
 
1166
- }());
1094
+ })();