argous 1.2.202 → 1.2.203

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 (407) hide show
  1. package/dist/components/ConfirmModal/ModalProvider.d.ts +1 -1
  2. package/dist/components/Editor/components/Editor.d.ts +4 -4
  3. package/dist/components/Editor/components/Editor.js +3 -3
  4. package/dist/components/Editor/skins/content/dark/content.d.ts +0 -0
  5. package/dist/components/Editor/skins/content/dark/content.js +3 -0
  6. package/dist/components/Editor/skins/content/default/content.d.ts +0 -0
  7. package/dist/components/Editor/skins/content/default/content.js +3 -0
  8. package/dist/components/Editor/skins/content/document/content.d.ts +0 -0
  9. package/dist/components/Editor/skins/content/document/content.js +3 -0
  10. package/dist/components/Editor/skins/content/tinymce-5/content.d.ts +0 -0
  11. package/dist/components/Editor/skins/content/tinymce-5/content.js +3 -0
  12. package/dist/components/Editor/skins/content/tinymce-5-dark/content.d.ts +0 -0
  13. package/dist/components/Editor/skins/content/tinymce-5-dark/content.js +3 -0
  14. package/dist/components/Editor/skins/content/writer/content.d.ts +0 -0
  15. package/dist/components/Editor/skins/content/writer/content.js +3 -0
  16. package/dist/components/Editor/skins/ui/oxide/content.d.ts +0 -0
  17. package/dist/components/Editor/skins/ui/oxide/content.inline.d.ts +0 -0
  18. package/dist/components/Editor/skins/ui/oxide/content.inline.js +3 -0
  19. package/dist/components/Editor/skins/ui/oxide/content.js +3 -0
  20. package/dist/components/Editor/skins/ui/oxide/skin.d.ts +0 -0
  21. package/dist/components/Editor/skins/ui/oxide/skin.js +3 -0
  22. package/dist/components/Editor/skins/ui/oxide/skin.shadowdom.d.ts +0 -0
  23. package/dist/components/Editor/skins/ui/oxide/skin.shadowdom.js +3 -0
  24. package/dist/components/Editor/skins/ui/oxide-dark/content.d.ts +0 -0
  25. package/dist/components/Editor/skins/ui/oxide-dark/content.inline.d.ts +0 -0
  26. package/dist/components/Editor/skins/ui/oxide-dark/content.inline.js +3 -0
  27. package/dist/components/Editor/skins/ui/oxide-dark/content.js +3 -0
  28. package/dist/components/Editor/skins/ui/oxide-dark/skin.d.ts +0 -0
  29. package/dist/components/Editor/skins/ui/oxide-dark/skin.js +3 -0
  30. package/dist/components/Editor/skins/ui/oxide-dark/skin.shadowdom.d.ts +0 -0
  31. package/dist/components/Editor/skins/ui/oxide-dark/skin.shadowdom.js +3 -0
  32. package/dist/components/Editor/skins/ui/tinymce-5/content.d.ts +0 -0
  33. package/dist/components/Editor/skins/ui/tinymce-5/content.inline.d.ts +0 -0
  34. package/dist/components/Editor/skins/ui/tinymce-5/content.inline.js +3 -0
  35. package/dist/components/Editor/skins/ui/tinymce-5/content.js +3 -0
  36. package/dist/components/Editor/skins/ui/tinymce-5/skin.d.ts +0 -0
  37. package/dist/components/Editor/skins/ui/tinymce-5/skin.js +3 -0
  38. package/dist/components/Editor/skins/ui/tinymce-5/skin.shadowdom.d.ts +0 -0
  39. package/dist/components/Editor/skins/ui/tinymce-5/skin.shadowdom.js +3 -0
  40. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.d.ts +0 -0
  41. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.inline.d.ts +0 -0
  42. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.inline.js +3 -0
  43. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.js +3 -0
  44. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.d.ts +0 -0
  45. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.js +3 -0
  46. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.d.ts +0 -0
  47. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.js +3 -0
  48. package/dist/components/Editor/tinymce/tinymce.d.ts +1722 -1447
  49. package/lib/components/Editor/components/Editor.tsx +8 -8
  50. package/lib/components/Editor/skins/content/dark/content.js +2 -0
  51. package/lib/components/Editor/skins/content/dark/content.min.css +1 -8
  52. package/lib/components/Editor/skins/content/default/content.js +2 -0
  53. package/lib/components/Editor/skins/content/default/content.min.css +0 -7
  54. package/lib/components/Editor/skins/content/document/content.js +2 -0
  55. package/lib/components/Editor/skins/content/document/content.min.css +0 -7
  56. package/lib/components/Editor/skins/content/tinymce-5/content.js +2 -0
  57. package/lib/components/Editor/skins/content/tinymce-5/content.min.css +1 -0
  58. package/lib/components/Editor/skins/content/tinymce-5-dark/content.js +2 -0
  59. package/lib/components/Editor/skins/content/tinymce-5-dark/content.min.css +1 -0
  60. package/lib/components/Editor/skins/content/writer/content.js +2 -0
  61. package/lib/components/Editor/skins/content/writer/content.min.css +0 -7
  62. package/lib/components/Editor/skins/ui/oxide/content.inline.js +2 -0
  63. package/lib/components/Editor/skins/ui/oxide/content.inline.min.css +1 -0
  64. package/lib/components/Editor/skins/ui/oxide/content.js +2 -0
  65. package/lib/components/Editor/skins/ui/oxide/content.min.css +1 -0
  66. package/lib/components/Editor/skins/ui/oxide/skin.js +2 -0
  67. package/lib/components/Editor/skins/ui/oxide/skin.min.css +1 -0
  68. package/lib/components/Editor/skins/ui/oxide/skin.shadowdom.js +2 -0
  69. package/lib/components/Editor/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  70. package/lib/components/Editor/skins/ui/oxide-dark/content.inline.js +2 -0
  71. package/lib/components/Editor/skins/ui/oxide-dark/content.inline.min.css +1 -0
  72. package/lib/components/Editor/skins/ui/oxide-dark/content.js +2 -0
  73. package/lib/components/Editor/skins/ui/oxide-dark/content.min.css +1 -0
  74. package/lib/components/Editor/skins/ui/oxide-dark/skin.js +2 -0
  75. package/lib/components/Editor/skins/ui/oxide-dark/skin.min.css +1 -0
  76. package/lib/components/Editor/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  77. package/lib/components/Editor/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  78. package/lib/components/Editor/skins/ui/tinymce-5/content.inline.js +2 -0
  79. package/lib/components/Editor/skins/ui/tinymce-5/content.inline.min.css +1 -0
  80. package/lib/components/Editor/skins/ui/tinymce-5/content.js +2 -0
  81. package/lib/components/Editor/skins/ui/tinymce-5/content.min.css +1 -0
  82. package/lib/components/Editor/skins/ui/tinymce-5/skin.js +2 -0
  83. package/lib/components/Editor/skins/ui/tinymce-5/skin.min.css +1 -0
  84. package/lib/components/Editor/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
  85. package/lib/components/Editor/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  86. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.inline.js +2 -0
  87. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  88. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.js +2 -0
  89. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.min.css +1 -0
  90. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.js +2 -0
  91. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  92. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
  93. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  94. package/lib/components/Editor/tinymce/README.md +24 -14
  95. package/lib/components/Editor/tinymce/icons/default/icons.js +185 -163
  96. package/lib/components/Editor/tinymce/icons/default/icons.min.js +1 -1
  97. package/lib/components/Editor/tinymce/langs/README.md +1 -1
  98. package/lib/components/Editor/tinymce/license.txt +21 -504
  99. package/lib/components/Editor/tinymce/models/dom/model.js +8040 -0
  100. package/lib/components/Editor/tinymce/models/dom/model.min.js +4 -0
  101. package/lib/components/Editor/tinymce/plugins/accordion/plugin.js +1054 -0
  102. package/lib/components/Editor/tinymce/plugins/accordion/plugin.min.js +4 -0
  103. package/lib/components/Editor/tinymce/plugins/advlist/plugin.js +187 -208
  104. package/lib/components/Editor/tinymce/plugins/advlist/plugin.min.js +2 -7
  105. package/lib/components/Editor/tinymce/plugins/anchor/plugin.js +82 -84
  106. package/lib/components/Editor/tinymce/plugins/anchor/plugin.min.js +2 -7
  107. package/lib/components/Editor/tinymce/plugins/autolink/plugin.js +210 -167
  108. package/lib/components/Editor/tinymce/plugins/autolink/plugin.min.js +2 -7
  109. package/lib/components/Editor/tinymce/plugins/autoresize/plugin.js +118 -97
  110. package/lib/components/Editor/tinymce/plugins/autoresize/plugin.min.js +2 -7
  111. package/lib/components/Editor/tinymce/plugins/autosave/plugin.js +129 -108
  112. package/lib/components/Editor/tinymce/plugins/autosave/plugin.min.js +2 -7
  113. package/lib/components/Editor/tinymce/plugins/charmap/plugin.js +285 -333
  114. package/lib/components/Editor/tinymce/plugins/charmap/plugin.min.js +2 -7
  115. package/lib/components/Editor/tinymce/plugins/code/plugin.js +19 -26
  116. package/lib/components/Editor/tinymce/plugins/code/plugin.min.js +2 -7
  117. package/lib/components/Editor/tinymce/plugins/codesample/plugin.js +2225 -2094
  118. package/lib/components/Editor/tinymce/plugins/codesample/plugin.min.js +2 -7
  119. package/lib/components/Editor/tinymce/plugins/directionality/plugin.js +318 -243
  120. package/lib/components/Editor/tinymce/plugins/directionality/plugin.min.js +2 -7
  121. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojiimages.js +1 -9424
  122. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojiimages.min.js +1 -1
  123. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojis.js +1 -9423
  124. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojis.min.js +1 -1
  125. package/lib/components/Editor/tinymce/plugins/emoticons/plugin.js +406 -416
  126. package/lib/components/Editor/tinymce/plugins/emoticons/plugin.min.js +2 -7
  127. package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.js +821 -604
  128. package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.min.js +2 -7
  129. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ar.js +90 -0
  130. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
  131. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ca.js +90 -0
  132. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/cs.js +90 -0
  133. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/da.js +90 -0
  134. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/de.js +90 -0
  135. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/el.js +90 -0
  136. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/en.js +90 -0
  137. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/es.js +90 -0
  138. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/eu.js +90 -0
  139. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/fa.js +90 -0
  140. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/fi.js +90 -0
  141. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
  142. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/he_IL.js +90 -0
  143. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/hi.js +90 -0
  144. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/hr.js +90 -0
  145. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
  146. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/id.js +90 -0
  147. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/it.js +90 -0
  148. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ja.js +90 -0
  149. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/kk.js +90 -0
  150. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
  151. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ms.js +90 -0
  152. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
  153. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/nl.js +90 -0
  154. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/pl.js +90 -0
  155. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
  156. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
  157. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ro.js +90 -0
  158. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ru.js +90 -0
  159. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/sk.js +90 -0
  160. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
  161. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
  162. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/th_TH.js +90 -0
  163. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/tr.js +90 -0
  164. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/uk.js +90 -0
  165. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/vi.js +90 -0
  166. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
  167. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
  168. package/lib/components/Editor/tinymce/plugins/help/plugin.js +428 -403
  169. package/lib/components/Editor/tinymce/plugins/help/plugin.min.js +2 -7
  170. package/lib/components/Editor/tinymce/plugins/image/plugin.js +887 -1043
  171. package/lib/components/Editor/tinymce/plugins/image/plugin.min.js +2 -7
  172. package/lib/components/Editor/tinymce/plugins/importcss/plugin.js +163 -162
  173. package/lib/components/Editor/tinymce/plugins/importcss/plugin.min.js +2 -7
  174. package/lib/components/Editor/tinymce/plugins/insertdatetime/plugin.js +101 -91
  175. package/lib/components/Editor/tinymce/plugins/insertdatetime/plugin.min.js +2 -7
  176. package/lib/components/Editor/tinymce/plugins/link/plugin.js +739 -784
  177. package/lib/components/Editor/tinymce/plugins/link/plugin.min.js +2 -7
  178. package/lib/components/Editor/tinymce/plugins/lists/plugin.js +1282 -1396
  179. package/lib/components/Editor/tinymce/plugins/lists/plugin.min.js +2 -7
  180. package/lib/components/Editor/tinymce/plugins/media/plugin.js +641 -806
  181. package/lib/components/Editor/tinymce/plugins/media/plugin.min.js +2 -7
  182. package/lib/components/Editor/tinymce/plugins/nonbreaking/plugin.js +76 -54
  183. package/lib/components/Editor/tinymce/plugins/nonbreaking/plugin.min.js +2 -7
  184. package/lib/components/Editor/tinymce/plugins/pagebreak/plugin.js +58 -46
  185. package/lib/components/Editor/tinymce/plugins/pagebreak/plugin.min.js +2 -7
  186. package/lib/components/Editor/tinymce/plugins/preview/plugin.js +39 -69
  187. package/lib/components/Editor/tinymce/plugins/preview/plugin.min.js +2 -7
  188. package/lib/components/Editor/tinymce/plugins/quickbars/plugin.js +307 -349
  189. package/lib/components/Editor/tinymce/plugins/quickbars/plugin.min.js +2 -7
  190. package/lib/components/Editor/tinymce/plugins/save/plugin.js +50 -51
  191. package/lib/components/Editor/tinymce/plugins/save/plugin.min.js +2 -7
  192. package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.js +517 -587
  193. package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.min.js +2 -7
  194. package/lib/components/Editor/tinymce/plugins/table/plugin.js +2666 -10142
  195. package/lib/components/Editor/tinymce/plugins/table/plugin.min.js +2 -7
  196. package/lib/components/Editor/tinymce/plugins/template/plugin.js +403 -413
  197. package/lib/components/Editor/tinymce/plugins/template/plugin.min.js +2 -7
  198. package/lib/components/Editor/tinymce/plugins/visualblocks/plugin.js +42 -48
  199. package/lib/components/Editor/tinymce/plugins/visualblocks/plugin.min.js +2 -7
  200. package/lib/components/Editor/tinymce/plugins/visualchars/plugin.js +352 -333
  201. package/lib/components/Editor/tinymce/plugins/visualchars/plugin.min.js +2 -7
  202. package/lib/components/Editor/tinymce/plugins/wordcount/plugin.js +184 -195
  203. package/lib/components/Editor/tinymce/plugins/wordcount/plugin.min.js +2 -7
  204. package/lib/components/Editor/tinymce/skins/content/dark/content.css +2 -8
  205. package/lib/components/Editor/tinymce/skins/content/dark/content.js +2 -0
  206. package/lib/components/Editor/tinymce/skins/content/dark/content.js.map +1 -0
  207. package/lib/components/Editor/tinymce/skins/content/dark/content.min.css +2 -8
  208. package/lib/components/Editor/tinymce/skins/content/dark/content.min.css.map +1 -1
  209. package/lib/components/Editor/tinymce/skins/content/default/content.css +0 -6
  210. package/lib/components/Editor/tinymce/skins/content/default/content.js +2 -0
  211. package/lib/components/Editor/tinymce/skins/content/default/content.js.map +1 -0
  212. package/lib/components/Editor/tinymce/skins/content/default/content.min.css +1 -7
  213. package/lib/components/Editor/tinymce/skins/content/default/content.min.css.map +1 -1
  214. package/lib/components/Editor/tinymce/skins/content/document/content.css +0 -6
  215. package/lib/components/Editor/tinymce/skins/content/document/content.js +2 -0
  216. package/lib/components/Editor/tinymce/skins/content/document/content.js.map +1 -0
  217. package/lib/components/Editor/tinymce/skins/content/document/content.min.css +0 -6
  218. package/lib/components/Editor/tinymce/skins/content/document/content.min.css.map +1 -1
  219. package/lib/components/Editor/{skins/content/default → tinymce/skins/content/tinymce-5}/content.css +0 -6
  220. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.js +2 -0
  221. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.js.map +1 -0
  222. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.min.css +2 -0
  223. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.min.css.map +1 -0
  224. package/lib/components/Editor/{skins/content/dark → tinymce/skins/content/tinymce-5-dark}/content.css +1 -7
  225. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.js +2 -0
  226. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.js.map +1 -0
  227. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.min.css +2 -0
  228. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.min.css.map +1 -0
  229. package/lib/components/Editor/tinymce/skins/content/writer/content.css +0 -6
  230. package/lib/components/Editor/tinymce/skins/content/writer/content.js +2 -0
  231. package/lib/components/Editor/tinymce/skins/content/writer/content.js.map +1 -0
  232. package/lib/components/Editor/tinymce/skins/content/writer/content.min.css +0 -6
  233. package/lib/components/Editor/tinymce/skins/content/writer/content.min.css.map +1 -1
  234. package/lib/components/Editor/tinymce/skins/ui/oxide/content.css +74 -21
  235. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.css +74 -21
  236. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.js +2 -0
  237. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.js.map +1 -0
  238. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css +1 -7
  239. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css.map +1 -1
  240. package/lib/components/Editor/tinymce/skins/ui/oxide/content.js +2 -0
  241. package/lib/components/Editor/tinymce/skins/ui/oxide/content.js.map +1 -0
  242. package/lib/components/Editor/tinymce/skins/ui/oxide/content.min.css +1 -7
  243. package/lib/components/Editor/tinymce/skins/ui/oxide/content.min.css.map +1 -1
  244. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.css +1131 -402
  245. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.js +2 -0
  246. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.js.map +1 -0
  247. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.min.css +1 -7
  248. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.min.css.map +1 -1
  249. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.css +8 -15
  250. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.js +2 -0
  251. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.js.map +1 -0
  252. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -7
  253. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map +1 -1
  254. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.css +72 -20
  255. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.css +74 -21
  256. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.js +2 -0
  257. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.js.map +1 -0
  258. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -7
  259. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css.map +1 -1
  260. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.js +2 -0
  261. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.js.map +1 -0
  262. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css +1 -7
  263. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css.map +1 -1
  264. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.css +1155 -423
  265. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.js +2 -0
  266. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.js.map +1 -0
  267. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css +1 -7
  268. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css.map +1 -1
  269. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +8 -15
  270. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  271. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.js.map +1 -0
  272. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -7
  273. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map +1 -1
  274. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/content.css +75 -22
  275. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/content.inline.css +75 -22
  276. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.js +2 -0
  277. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.js.map +1 -0
  278. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.min.css +2 -0
  279. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.min.css.map +1 -0
  280. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.js +2 -0
  281. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.js.map +1 -0
  282. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.min.css +2 -0
  283. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.min.css.map +1 -0
  284. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/skin.css +1261 -438
  285. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.js +2 -0
  286. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.js.map +1 -0
  287. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.min.css +2 -0
  288. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.min.css.map +1 -0
  289. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/skin.shadowdom.css +8 -15
  290. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
  291. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.js.map +1 -0
  292. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +2 -0
  293. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css.map +1 -0
  294. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/content.css +73 -21
  295. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/content.inline.css +75 -22
  296. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.js +2 -0
  297. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.js.map +1 -0
  298. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +2 -0
  299. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css.map +1 -0
  300. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.js +2 -0
  301. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.js.map +1 -0
  302. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.min.css +2 -0
  303. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.min.css.map +1 -0
  304. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/skin.css +1244 -421
  305. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.js +2 -0
  306. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.js.map +1 -0
  307. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css +2 -0
  308. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css.map +1 -0
  309. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/skin.shadowdom.css +8 -15
  310. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
  311. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js.map +1 -0
  312. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +2 -0
  313. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css.map +1 -0
  314. package/lib/components/Editor/tinymce/themes/silver/theme.js +23228 -24955
  315. package/lib/components/Editor/tinymce/themes/silver/theme.min.js +2 -7
  316. package/lib/components/Editor/tinymce/tinymce.d.ts +1722 -1447
  317. package/lib/components/Editor/tinymce/tinymce.js +23668 -22018
  318. package/lib/components/Editor/tinymce/tinymce.min.js +2 -30104
  319. package/package.json +1 -1
  320. package/lib/components/Editor/skins/content/dark/content.min.css.map +0 -1
  321. package/lib/components/Editor/skins/content/default/content.min.css.map +0 -1
  322. package/lib/components/Editor/skins/content/document/content.css +0 -72
  323. package/lib/components/Editor/skins/content/document/content.min.css.map +0 -1
  324. package/lib/components/Editor/skins/content/writer/content.css +0 -68
  325. package/lib/components/Editor/skins/content/writer/content.min.css.map +0 -1
  326. package/lib/components/Editor/skins/ui/dark/content.inline.min.css +0 -8
  327. package/lib/components/Editor/skins/ui/dark/content.inline.min.css.map +0 -1
  328. package/lib/components/Editor/skins/ui/dark/content.min.css +0 -8
  329. package/lib/components/Editor/skins/ui/dark/content.min.css.map +0 -1
  330. package/lib/components/Editor/skins/ui/dark/content.mobile.css +0 -29
  331. package/lib/components/Editor/skins/ui/dark/content.mobile.min.css +0 -8
  332. package/lib/components/Editor/skins/ui/dark/content.mobile.min.css.map +0 -1
  333. package/lib/components/Editor/skins/ui/dark/fonts/tinymce-mobile.woff +0 -0
  334. package/lib/components/Editor/skins/ui/dark/skin.min.css +0 -8
  335. package/lib/components/Editor/skins/ui/dark/skin.min.css.map +0 -1
  336. package/lib/components/Editor/skins/ui/dark/skin.mobile.css +0 -673
  337. package/lib/components/Editor/skins/ui/dark/skin.mobile.min.css +0 -8
  338. package/lib/components/Editor/skins/ui/dark/skin.mobile.min.css.map +0 -1
  339. package/lib/components/Editor/skins/ui/dark/skin.shadowdom.min.css +0 -8
  340. package/lib/components/Editor/skins/ui/dark/skin.shadowdom.min.css.map +0 -1
  341. package/lib/components/Editor/skins/ui/default/content.inline.min.css +0 -8
  342. package/lib/components/Editor/skins/ui/default/content.inline.min.css.map +0 -1
  343. package/lib/components/Editor/skins/ui/default/content.min.css +0 -8
  344. package/lib/components/Editor/skins/ui/default/content.min.css.map +0 -1
  345. package/lib/components/Editor/skins/ui/default/content.mobile.css +0 -29
  346. package/lib/components/Editor/skins/ui/default/content.mobile.min.css +0 -8
  347. package/lib/components/Editor/skins/ui/default/content.mobile.min.css.map +0 -1
  348. package/lib/components/Editor/skins/ui/default/fonts/tinymce-mobile.woff +0 -0
  349. package/lib/components/Editor/skins/ui/default/skin.min.css +0 -8
  350. package/lib/components/Editor/skins/ui/default/skin.min.css.map +0 -1
  351. package/lib/components/Editor/skins/ui/default/skin.mobile.css +0 -673
  352. package/lib/components/Editor/skins/ui/default/skin.mobile.min.css +0 -8
  353. package/lib/components/Editor/skins/ui/default/skin.mobile.min.css.map +0 -1
  354. package/lib/components/Editor/skins/ui/default/skin.shadowdom.min.css +0 -8
  355. package/lib/components/Editor/skins/ui/default/skin.shadowdom.min.css.map +0 -1
  356. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/fonts/tinymce-mobile.woff +0 -0
  357. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.css +0 -1641
  358. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.min.css +0 -8
  359. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.min.css.map +0 -1
  360. package/lib/components/Editor/tinymce/jquery.tinymce.min.js +0 -92
  361. package/lib/components/Editor/tinymce/langs/pt_BR.js +0 -419
  362. package/lib/components/Editor/tinymce/plugins/bbcode/plugin.js +0 -99
  363. package/lib/components/Editor/tinymce/plugins/bbcode/plugin.min.js +0 -9
  364. package/lib/components/Editor/tinymce/plugins/colorpicker/plugin.js +0 -22
  365. package/lib/components/Editor/tinymce/plugins/colorpicker/plugin.min.js +0 -9
  366. package/lib/components/Editor/tinymce/plugins/contextmenu/plugin.js +0 -22
  367. package/lib/components/Editor/tinymce/plugins/contextmenu/plugin.min.js +0 -9
  368. package/lib/components/Editor/tinymce/plugins/fullpage/plugin.js +0 -544
  369. package/lib/components/Editor/tinymce/plugins/fullpage/plugin.min.js +0 -9
  370. package/lib/components/Editor/tinymce/plugins/hr/plugin.js +0 -46
  371. package/lib/components/Editor/tinymce/plugins/hr/plugin.min.js +0 -9
  372. package/lib/components/Editor/tinymce/plugins/imagetools/plugin.js +0 -1354
  373. package/lib/components/Editor/tinymce/plugins/imagetools/plugin.min.js +0 -9
  374. package/lib/components/Editor/tinymce/plugins/legacyoutput/plugin.js +0 -199
  375. package/lib/components/Editor/tinymce/plugins/legacyoutput/plugin.min.js +0 -9
  376. package/lib/components/Editor/tinymce/plugins/noneditable/plugin.js +0 -117
  377. package/lib/components/Editor/tinymce/plugins/noneditable/plugin.min.js +0 -9
  378. package/lib/components/Editor/tinymce/plugins/paste/plugin.js +0 -1764
  379. package/lib/components/Editor/tinymce/plugins/paste/plugin.min.js +0 -9
  380. package/lib/components/Editor/tinymce/plugins/print/plugin.js +0 -53
  381. package/lib/components/Editor/tinymce/plugins/print/plugin.min.js +0 -9
  382. package/lib/components/Editor/tinymce/plugins/spellchecker/plugin.js +0 -731
  383. package/lib/components/Editor/tinymce/plugins/spellchecker/plugin.min.js +0 -9
  384. package/lib/components/Editor/tinymce/plugins/tabfocus/plugin.js +0 -129
  385. package/lib/components/Editor/tinymce/plugins/tabfocus/plugin.min.js +0 -9
  386. package/lib/components/Editor/tinymce/plugins/textcolor/plugin.js +0 -22
  387. package/lib/components/Editor/tinymce/plugins/textcolor/plugin.min.js +0 -9
  388. package/lib/components/Editor/tinymce/plugins/textpattern/plugin.js +0 -1394
  389. package/lib/components/Editor/tinymce/plugins/textpattern/plugin.min.js +0 -9
  390. package/lib/components/Editor/tinymce/plugins/toc/plugin.js +0 -236
  391. package/lib/components/Editor/tinymce/plugins/toc/plugin.min.js +0 -9
  392. package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.css +0 -29
  393. package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.min.css +0 -8
  394. package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.min.css.map +0 -1
  395. package/lib/components/Editor/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
  396. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.css +0 -673
  397. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.min.css +0 -8
  398. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.min.css.map +0 -1
  399. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.css +0 -29
  400. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.min.css +0 -8
  401. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map +0 -1
  402. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
  403. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.css +0 -673
  404. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +0 -8
  405. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map +0 -1
  406. package/lib/components/Editor/tinymce/themes/mobile/theme.js +0 -13587
  407. package/lib/components/Editor/tinymce/themes/mobile/theme.min.js +0 -9
@@ -1,203 +1,205 @@
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.9.0 (TBD)
2
+ * TinyMCE version 6.8.2 (2023-12-11)
8
3
  */
4
+
9
5
  (function () {
10
6
  'use strict';
11
7
 
12
- var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
8
+ var global$7 = tinymce.util.Tools.resolve('tinymce.PluginManager');
13
9
 
14
- var typeOf = function (x) {
15
- 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;
16
20
  if (x === null) {
17
21
  return 'null';
18
- } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
22
+ } else if (t === 'object' && Array.isArray(x)) {
19
23
  return 'array';
20
- } 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))) {
21
25
  return 'string';
22
26
  } else {
23
27
  return t;
24
28
  }
25
29
  };
26
- var isType = function (type) {
27
- return function (value) {
28
- return typeOf(value) === type;
29
- };
30
- };
31
- var isSimpleType = function (type) {
32
- return function (value) {
33
- return typeof value === type;
34
- };
35
- };
36
- var isString = isType('string');
37
- var isObject = isType('object');
38
- var isArray = isType('array');
39
- var isBoolean = isSimpleType('boolean');
40
- var isFunction = isSimpleType('function');
41
- var isNumber = isSimpleType('number');
30
+ const isType$1 = type => value => typeOf(value) === type;
31
+ const isSimpleType = type => value => typeof value === type;
32
+ const isString = isType$1('string');
33
+ const isObject = isType$1('object');
34
+ const isArray = isType$1('array');
35
+ const isBoolean = isSimpleType('boolean');
36
+ const isNullable = a => a === null || a === undefined;
37
+ const isNonNullable = a => !isNullable(a);
38
+ const isFunction = isSimpleType('function');
39
+ const isNumber = isSimpleType('number');
42
40
 
43
- var noop = function () {
41
+ const noop = () => {
44
42
  };
45
- var constant = function (value) {
46
- return function () {
43
+ const compose1 = (fbc, fab) => a => fbc(fab(a));
44
+ const constant = value => {
45
+ return () => {
47
46
  return value;
48
47
  };
49
48
  };
50
- var not = function (f) {
51
- return function (t) {
52
- return !f(t);
53
- };
49
+ const tripleEquals = (a, b) => {
50
+ return a === b;
54
51
  };
55
- var never = constant(false);
56
- var always = constant(true);
57
-
58
- var none = function () {
59
- return NONE;
60
- };
61
- var NONE = function () {
62
- var eq = function (o) {
63
- return o.isNone();
64
- };
65
- var call = function (thunk) {
66
- return thunk();
67
- };
68
- var id = function (n) {
69
- return n;
52
+ function curry(fn, ...initialArgs) {
53
+ return (...restArgs) => {
54
+ const all = initialArgs.concat(restArgs);
55
+ return fn.apply(null, all);
70
56
  };
71
- var me = {
72
- fold: function (n, _s) {
73
- return n();
74
- },
75
- is: never,
76
- isSome: never,
77
- isNone: always,
78
- getOr: id,
79
- getOrThunk: call,
80
- getOrDie: function (msg) {
81
- throw new Error(msg || 'error: getOrDie called on none.');
82
- },
83
- getOrNull: constant(null),
84
- getOrUndefined: constant(undefined),
85
- or: id,
86
- orThunk: call,
87
- map: none,
88
- each: noop,
89
- bind: none,
90
- exists: never,
91
- forall: always,
92
- filter: none,
93
- equals: eq,
94
- equals_: eq,
95
- toArray: function () {
96
- return [];
97
- },
98
- toString: constant('none()')
99
- };
100
- return me;
101
- }();
102
- var some = function (a) {
103
- var constant_a = constant(a);
104
- var self = function () {
105
- return me;
106
- };
107
- var bind = function (f) {
108
- return f(a);
109
- };
110
- var me = {
111
- fold: function (n, s) {
112
- return s(a);
113
- },
114
- is: function (v) {
115
- return a === v;
116
- },
117
- isSome: always,
118
- isNone: never,
119
- getOr: constant_a,
120
- getOrThunk: constant_a,
121
- getOrDie: constant_a,
122
- getOrNull: constant_a,
123
- getOrUndefined: constant_a,
124
- or: self,
125
- orThunk: self,
126
- map: function (f) {
127
- return some(f(a));
128
- },
129
- each: function (f) {
130
- f(a);
131
- },
132
- bind: bind,
133
- exists: bind,
134
- forall: bind,
135
- filter: function (f) {
136
- return f(a) ? me : NONE;
137
- },
138
- toArray: function () {
139
- return [a];
140
- },
141
- toString: function () {
142
- return 'some(' + a + ')';
143
- },
144
- equals: function (o) {
145
- return o.is(a);
146
- },
147
- equals_: function (o, elementEq) {
148
- return o.fold(never, function (b) {
149
- return elementEq(a, b);
150
- });
57
+ }
58
+ const not = f => t => !f(t);
59
+ const never = constant(false);
60
+
61
+ class Optional {
62
+ constructor(tag, value) {
63
+ this.tag = tag;
64
+ this.value = value;
65
+ }
66
+ static some(value) {
67
+ return new Optional(true, value);
68
+ }
69
+ static none() {
70
+ return Optional.singletonNone;
71
+ }
72
+ fold(onNone, onSome) {
73
+ if (this.tag) {
74
+ return onSome(this.value);
75
+ } else {
76
+ return onNone();
151
77
  }
152
- };
153
- return me;
154
- };
155
- var from = function (value) {
156
- return value === null || value === undefined ? NONE : some(value);
157
- };
158
- var Optional = {
159
- some: some,
160
- none: none,
161
- from: from
78
+ }
79
+ isSome() {
80
+ return this.tag;
81
+ }
82
+ isNone() {
83
+ return !this.tag;
84
+ }
85
+ map(mapper) {
86
+ if (this.tag) {
87
+ return Optional.some(mapper(this.value));
88
+ } else {
89
+ return Optional.none();
90
+ }
91
+ }
92
+ bind(binder) {
93
+ if (this.tag) {
94
+ return binder(this.value);
95
+ } else {
96
+ return Optional.none();
97
+ }
98
+ }
99
+ exists(predicate) {
100
+ return this.tag && predicate(this.value);
101
+ }
102
+ forall(predicate) {
103
+ return !this.tag || predicate(this.value);
104
+ }
105
+ filter(predicate) {
106
+ if (!this.tag || predicate(this.value)) {
107
+ return this;
108
+ } else {
109
+ return Optional.none();
110
+ }
111
+ }
112
+ getOr(replacement) {
113
+ return this.tag ? this.value : replacement;
114
+ }
115
+ or(replacement) {
116
+ return this.tag ? this : replacement;
117
+ }
118
+ getOrThunk(thunk) {
119
+ return this.tag ? this.value : thunk();
120
+ }
121
+ orThunk(thunk) {
122
+ return this.tag ? this : thunk();
123
+ }
124
+ getOrDie(message) {
125
+ if (!this.tag) {
126
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
127
+ } else {
128
+ return this.value;
129
+ }
130
+ }
131
+ static from(value) {
132
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
133
+ }
134
+ getOrNull() {
135
+ return this.tag ? this.value : null;
136
+ }
137
+ getOrUndefined() {
138
+ return this.value;
139
+ }
140
+ each(worker) {
141
+ if (this.tag) {
142
+ worker(this.value);
143
+ }
144
+ }
145
+ toArray() {
146
+ return this.tag ? [this.value] : [];
147
+ }
148
+ toString() {
149
+ return this.tag ? `some(${ this.value })` : 'none()';
150
+ }
151
+ }
152
+ Optional.singletonNone = new Optional(false);
153
+
154
+ const nativeSlice = Array.prototype.slice;
155
+ const nativeIndexOf = Array.prototype.indexOf;
156
+ const nativePush = Array.prototype.push;
157
+ const rawIndexOf = (ts, t) => nativeIndexOf.call(ts, t);
158
+ const contains$1 = (xs, x) => rawIndexOf(xs, x) > -1;
159
+ const exists = (xs, pred) => {
160
+ for (let i = 0, len = xs.length; i < len; i++) {
161
+ const x = xs[i];
162
+ if (pred(x, i)) {
163
+ return true;
164
+ }
165
+ }
166
+ return false;
162
167
  };
163
-
164
- var nativeSlice = Array.prototype.slice;
165
- var nativePush = Array.prototype.push;
166
- var map = function (xs, f) {
167
- var len = xs.length;
168
- var r = new Array(len);
169
- for (var i = 0; i < len; i++) {
170
- var x = xs[i];
168
+ const map = (xs, f) => {
169
+ const len = xs.length;
170
+ const r = new Array(len);
171
+ for (let i = 0; i < len; i++) {
172
+ const x = xs[i];
171
173
  r[i] = f(x, i);
172
174
  }
173
175
  return r;
174
176
  };
175
- var each = function (xs, f) {
176
- for (var i = 0, len = xs.length; i < len; i++) {
177
- var x = xs[i];
177
+ const each$1 = (xs, f) => {
178
+ for (let i = 0, len = xs.length; i < len; i++) {
179
+ const x = xs[i];
178
180
  f(x, i);
179
181
  }
180
182
  };
181
- var filter = function (xs, pred) {
182
- var r = [];
183
- for (var i = 0, len = xs.length; i < len; i++) {
184
- var x = xs[i];
183
+ const filter$1 = (xs, pred) => {
184
+ const r = [];
185
+ for (let i = 0, len = xs.length; i < len; i++) {
186
+ const x = xs[i];
185
187
  if (pred(x, i)) {
186
188
  r.push(x);
187
189
  }
188
190
  }
189
191
  return r;
190
192
  };
191
- var groupBy = function (xs, f) {
193
+ const groupBy = (xs, f) => {
192
194
  if (xs.length === 0) {
193
195
  return [];
194
196
  } else {
195
- var wasType = f(xs[0]);
196
- var r = [];
197
- var group = [];
198
- for (var i = 0, len = xs.length; i < len; i++) {
199
- var x = xs[i];
200
- var type = f(x);
197
+ let wasType = f(xs[0]);
198
+ const r = [];
199
+ let group = [];
200
+ for (let i = 0, len = xs.length; i < len; i++) {
201
+ const x = xs[i];
202
+ const type = f(x);
201
203
  if (type !== wasType) {
202
204
  r.push(group);
203
205
  group = [];
@@ -211,15 +213,15 @@
211
213
  return r;
212
214
  }
213
215
  };
214
- var foldl = function (xs, f, acc) {
215
- each(xs, function (x) {
216
- acc = f(acc, x);
216
+ const foldl = (xs, f, acc) => {
217
+ each$1(xs, (x, i) => {
218
+ acc = f(acc, x, i);
217
219
  });
218
220
  return acc;
219
221
  };
220
- var findUntil = function (xs, pred, until) {
221
- for (var i = 0, len = xs.length; i < len; i++) {
222
- var x = xs[i];
222
+ const findUntil = (xs, pred, until) => {
223
+ for (let i = 0, len = xs.length; i < len; i++) {
224
+ const x = xs[i];
223
225
  if (pred(x, i)) {
224
226
  return Optional.some(x);
225
227
  } else if (until(x, i)) {
@@ -228,12 +230,12 @@
228
230
  }
229
231
  return Optional.none();
230
232
  };
231
- var find = function (xs, pred) {
233
+ const find = (xs, pred) => {
232
234
  return findUntil(xs, pred, never);
233
235
  };
234
- var flatten = function (xs) {
235
- var r = [];
236
- for (var i = 0, len = xs.length; i < len; ++i) {
236
+ const flatten = xs => {
237
+ const r = [];
238
+ for (let i = 0, len = xs.length; i < len; ++i) {
237
239
  if (!isArray(xs[i])) {
238
240
  throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
239
241
  }
@@ -241,449 +243,79 @@
241
243
  }
242
244
  return r;
243
245
  };
244
- var bind = function (xs, f) {
245
- return flatten(map(xs, f));
246
- };
247
- var reverse = function (xs) {
248
- var r = nativeSlice.call(xs, 0);
246
+ const bind = (xs, f) => flatten(map(xs, f));
247
+ const reverse = xs => {
248
+ const r = nativeSlice.call(xs, 0);
249
249
  r.reverse();
250
250
  return r;
251
251
  };
252
- var get = function (xs, i) {
253
- return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
254
- };
255
- var head = function (xs) {
256
- return get(xs, 0);
257
- };
258
- var last = function (xs) {
259
- return get(xs, xs.length - 1);
260
- };
261
-
262
- var __assign = function () {
263
- __assign = Object.assign || function __assign(t) {
264
- for (var s, i = 1, n = arguments.length; i < n; i++) {
265
- s = arguments[i];
266
- for (var p in s)
267
- if (Object.prototype.hasOwnProperty.call(s, p))
268
- t[p] = s[p];
269
- }
270
- return t;
271
- };
272
- return __assign.apply(this, arguments);
273
- };
274
- function __spreadArrays() {
275
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
276
- s += arguments[i].length;
277
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
278
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
279
- r[k] = a[j];
280
- return r;
281
- }
282
-
283
- var cached = function (f) {
284
- var called = false;
285
- var r;
286
- return function () {
287
- var args = [];
288
- for (var _i = 0; _i < arguments.length; _i++) {
289
- args[_i] = arguments[_i];
290
- }
291
- if (!called) {
292
- called = true;
293
- r = f.apply(null, args);
294
- }
295
- return r;
296
- };
297
- };
298
-
299
- var DeviceType = function (os, browser, userAgent, mediaMatch) {
300
- var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
301
- var isiPhone = os.isiOS() && !isiPad;
302
- var isMobile = os.isiOS() || os.isAndroid();
303
- var isTouch = isMobile || mediaMatch('(pointer:coarse)');
304
- var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');
305
- var isPhone = isiPhone || isMobile && !isTablet;
306
- var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
307
- var isDesktop = !isPhone && !isTablet && !iOSwebview;
308
- return {
309
- isiPad: constant(isiPad),
310
- isiPhone: constant(isiPhone),
311
- isTablet: constant(isTablet),
312
- isPhone: constant(isPhone),
313
- isTouch: constant(isTouch),
314
- isAndroid: os.isAndroid,
315
- isiOS: os.isiOS,
316
- isWebView: constant(iOSwebview),
317
- isDesktop: constant(isDesktop)
318
- };
319
- };
320
-
321
- var firstMatch = function (regexes, s) {
322
- for (var i = 0; i < regexes.length; i++) {
323
- var x = regexes[i];
324
- if (x.test(s)) {
325
- return x;
326
- }
327
- }
328
- return undefined;
329
- };
330
- var find$1 = function (regexes, agent) {
331
- var r = firstMatch(regexes, agent);
332
- if (!r) {
333
- return {
334
- major: 0,
335
- minor: 0
336
- };
337
- }
338
- var group = function (i) {
339
- return Number(agent.replace(r, '$' + i));
340
- };
341
- return nu(group(1), group(2));
342
- };
343
- var detect = function (versionRegexes, agent) {
344
- var cleanedAgent = String(agent).toLowerCase();
345
- if (versionRegexes.length === 0) {
346
- return unknown();
347
- }
348
- return find$1(versionRegexes, cleanedAgent);
349
- };
350
- var unknown = function () {
351
- return nu(0, 0);
352
- };
353
- var nu = function (major, minor) {
354
- return {
355
- major: major,
356
- minor: minor
357
- };
358
- };
359
- var Version = {
360
- nu: nu,
361
- detect: detect,
362
- unknown: unknown
363
- };
364
-
365
- var detect$1 = function (candidates, userAgent) {
366
- var agent = String(userAgent).toLowerCase();
367
- return find(candidates, function (candidate) {
368
- return candidate.search(agent);
369
- });
370
- };
371
- var detectBrowser = function (browsers, userAgent) {
372
- return detect$1(browsers, userAgent).map(function (browser) {
373
- var version = Version.detect(browser.versionRegexes, userAgent);
374
- return {
375
- current: browser.name,
376
- version: version
377
- };
378
- });
379
- };
380
- var detectOs = function (oses, userAgent) {
381
- return detect$1(oses, userAgent).map(function (os) {
382
- var version = Version.detect(os.versionRegexes, userAgent);
383
- return {
384
- current: os.name,
385
- version: version
386
- };
387
- });
388
- };
389
- var UaString = {
390
- detectBrowser: detectBrowser,
391
- detectOs: detectOs
392
- };
393
-
394
- var contains = function (str, substr) {
395
- return str.indexOf(substr) !== -1;
396
- };
397
- var blank = function (r) {
398
- return function (s) {
399
- return s.replace(r, '');
400
- };
401
- };
402
- var trim = blank(/^\s+|\s+$/g);
403
- var isNotEmpty = function (s) {
404
- return s.length > 0;
405
- };
406
- var isEmpty = function (s) {
407
- return !isNotEmpty(s);
408
- };
409
-
410
- var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
411
- var checkContains = function (target) {
412
- return function (uastring) {
413
- return contains(uastring, target);
414
- };
415
- };
416
- var browsers = [
417
- {
418
- name: 'Edge',
419
- versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
420
- search: function (uastring) {
421
- return contains(uastring, 'edge/') && contains(uastring, 'chrome') && contains(uastring, 'safari') && contains(uastring, 'applewebkit');
422
- }
423
- },
424
- {
425
- name: 'Chrome',
426
- versionRegexes: [
427
- /.*?chrome\/([0-9]+)\.([0-9]+).*/,
428
- normalVersionRegex
429
- ],
430
- search: function (uastring) {
431
- return contains(uastring, 'chrome') && !contains(uastring, 'chromeframe');
432
- }
433
- },
434
- {
435
- name: 'IE',
436
- versionRegexes: [
437
- /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
438
- /.*?rv:([0-9]+)\.([0-9]+).*/
439
- ],
440
- search: function (uastring) {
441
- return contains(uastring, 'msie') || contains(uastring, 'trident');
442
- }
443
- },
444
- {
445
- name: 'Opera',
446
- versionRegexes: [
447
- normalVersionRegex,
448
- /.*?opera\/([0-9]+)\.([0-9]+).*/
449
- ],
450
- search: checkContains('opera')
451
- },
452
- {
453
- name: 'Firefox',
454
- versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
455
- search: checkContains('firefox')
456
- },
457
- {
458
- name: 'Safari',
459
- versionRegexes: [
460
- normalVersionRegex,
461
- /.*?cpu os ([0-9]+)_([0-9]+).*/
462
- ],
463
- search: function (uastring) {
464
- return (contains(uastring, 'safari') || contains(uastring, 'mobile/')) && contains(uastring, 'applewebkit');
252
+ const get$1 = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
253
+ const head = xs => get$1(xs, 0);
254
+ const last = xs => get$1(xs, xs.length - 1);
255
+ const unique = (xs, comparator) => {
256
+ const r = [];
257
+ const isDuplicated = isFunction(comparator) ? x => exists(r, i => comparator(i, x)) : x => contains$1(r, x);
258
+ for (let i = 0, len = xs.length; i < len; i++) {
259
+ const x = xs[i];
260
+ if (!isDuplicated(x)) {
261
+ r.push(x);
465
262
  }
466
263
  }
467
- ];
468
- var oses = [
469
- {
470
- name: 'Windows',
471
- search: checkContains('win'),
472
- versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
473
- },
474
- {
475
- name: 'iOS',
476
- search: function (uastring) {
477
- return contains(uastring, 'iphone') || contains(uastring, 'ipad');
478
- },
479
- versionRegexes: [
480
- /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
481
- /.*cpu os ([0-9]+)_([0-9]+).*/,
482
- /.*cpu iphone os ([0-9]+)_([0-9]+).*/
483
- ]
484
- },
485
- {
486
- name: 'Android',
487
- search: checkContains('android'),
488
- versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
489
- },
490
- {
491
- name: 'OSX',
492
- search: checkContains('mac os x'),
493
- versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]
494
- },
495
- {
496
- name: 'Linux',
497
- search: checkContains('linux'),
498
- versionRegexes: []
499
- },
500
- {
501
- name: 'Solaris',
502
- search: checkContains('sunos'),
503
- versionRegexes: []
504
- },
505
- {
506
- name: 'FreeBSD',
507
- search: checkContains('freebsd'),
508
- versionRegexes: []
509
- },
510
- {
511
- name: 'ChromeOS',
512
- search: checkContains('cros'),
513
- versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/]
514
- }
515
- ];
516
- var PlatformInfo = {
517
- browsers: constant(browsers),
518
- oses: constant(oses)
519
- };
520
-
521
- var edge = 'Edge';
522
- var chrome = 'Chrome';
523
- var ie = 'IE';
524
- var opera = 'Opera';
525
- var firefox = 'Firefox';
526
- var safari = 'Safari';
527
- var unknown$1 = function () {
528
- return nu$1({
529
- current: undefined,
530
- version: Version.unknown()
531
- });
532
- };
533
- var nu$1 = function (info) {
534
- var current = info.current;
535
- var version = info.version;
536
- var isBrowser = function (name) {
537
- return function () {
538
- return current === name;
539
- };
540
- };
541
- return {
542
- current: current,
543
- version: version,
544
- isEdge: isBrowser(edge),
545
- isChrome: isBrowser(chrome),
546
- isIE: isBrowser(ie),
547
- isOpera: isBrowser(opera),
548
- isFirefox: isBrowser(firefox),
549
- isSafari: isBrowser(safari)
550
- };
551
- };
552
- var Browser = {
553
- unknown: unknown$1,
554
- nu: nu$1,
555
- edge: constant(edge),
556
- chrome: constant(chrome),
557
- ie: constant(ie),
558
- opera: constant(opera),
559
- firefox: constant(firefox),
560
- safari: constant(safari)
561
- };
562
-
563
- var windows = 'Windows';
564
- var ios = 'iOS';
565
- var android = 'Android';
566
- var linux = 'Linux';
567
- var osx = 'OSX';
568
- var solaris = 'Solaris';
569
- var freebsd = 'FreeBSD';
570
- var chromeos = 'ChromeOS';
571
- var unknown$2 = function () {
572
- return nu$2({
573
- current: undefined,
574
- version: Version.unknown()
575
- });
576
- };
577
- var nu$2 = function (info) {
578
- var current = info.current;
579
- var version = info.version;
580
- var isOS = function (name) {
581
- return function () {
582
- return current === name;
583
- };
584
- };
585
- return {
586
- current: current,
587
- version: version,
588
- isWindows: isOS(windows),
589
- isiOS: isOS(ios),
590
- isAndroid: isOS(android),
591
- isOSX: isOS(osx),
592
- isLinux: isOS(linux),
593
- isSolaris: isOS(solaris),
594
- isFreeBSD: isOS(freebsd),
595
- isChromeOS: isOS(chromeos)
596
- };
597
- };
598
- var OperatingSystem = {
599
- unknown: unknown$2,
600
- nu: nu$2,
601
- windows: constant(windows),
602
- ios: constant(ios),
603
- android: constant(android),
604
- linux: constant(linux),
605
- osx: constant(osx),
606
- solaris: constant(solaris),
607
- freebsd: constant(freebsd),
608
- chromeos: constant(chromeos)
609
- };
610
-
611
- var detect$2 = function (userAgent, mediaMatch) {
612
- var browsers = PlatformInfo.browsers();
613
- var oses = PlatformInfo.oses();
614
- var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);
615
- var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
616
- var deviceType = DeviceType(os, browser, userAgent, mediaMatch);
617
- return {
618
- browser: browser,
619
- os: os,
620
- deviceType: deviceType
621
- };
622
- };
623
- var PlatformDetection = { detect: detect$2 };
624
-
625
- var mediaMatch = function (query) {
626
- return window.matchMedia(query).matches;
627
- };
628
- var platform = cached(function () {
629
- return PlatformDetection.detect(navigator.userAgent, mediaMatch);
630
- });
631
- var detect$3 = function () {
632
- return platform();
264
+ return r;
633
265
  };
634
266
 
635
- var compareDocumentPosition = function (a, b, match) {
636
- return (a.compareDocumentPosition(b) & match) !== 0;
637
- };
638
- var documentPositionContainedBy = function (a, b) {
639
- return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);
640
- };
267
+ const is$2 = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
268
+ const equals = (lhs, rhs, comparator = tripleEquals) => lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
269
+ const lift2 = (oa, ob, f) => oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();
641
270
 
642
- var ELEMENT = 1;
271
+ const COMMENT = 8;
272
+ const DOCUMENT = 9;
273
+ const DOCUMENT_FRAGMENT = 11;
274
+ const ELEMENT = 1;
275
+ const TEXT = 3;
643
276
 
644
- var fromHtml = function (html, scope) {
645
- var doc = scope || document;
646
- var div = doc.createElement('div');
277
+ const fromHtml = (html, scope) => {
278
+ const doc = scope || document;
279
+ const div = doc.createElement('div');
647
280
  div.innerHTML = html;
648
281
  if (!div.hasChildNodes() || div.childNodes.length > 1) {
649
- console.error('HTML does not have a single root node', html);
650
- throw new Error('HTML must have a single root node');
282
+ const message = 'HTML does not have a single root node';
283
+ console.error(message, html);
284
+ throw new Error(message);
651
285
  }
652
- return fromDom(div.childNodes[0]);
286
+ return fromDom$1(div.childNodes[0]);
653
287
  };
654
- var fromTag = function (tag, scope) {
655
- var doc = scope || document;
656
- var node = doc.createElement(tag);
657
- return fromDom(node);
288
+ const fromTag = (tag, scope) => {
289
+ const doc = scope || document;
290
+ const node = doc.createElement(tag);
291
+ return fromDom$1(node);
658
292
  };
659
- var fromText = function (text, scope) {
660
- var doc = scope || document;
661
- var node = doc.createTextNode(text);
662
- return fromDom(node);
293
+ const fromText = (text, scope) => {
294
+ const doc = scope || document;
295
+ const node = doc.createTextNode(text);
296
+ return fromDom$1(node);
663
297
  };
664
- var fromDom = function (node) {
298
+ const fromDom$1 = node => {
665
299
  if (node === null || node === undefined) {
666
300
  throw new Error('Node cannot be null or undefined');
667
301
  }
668
302
  return { dom: node };
669
303
  };
670
- var fromPoint = function (docElm, x, y) {
671
- return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
672
- };
673
- var SugarElement = {
674
- fromHtml: fromHtml,
675
- fromTag: fromTag,
676
- fromText: fromText,
677
- fromDom: fromDom,
678
- fromPoint: fromPoint
304
+ const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom$1);
305
+ const SugarElement = {
306
+ fromHtml,
307
+ fromTag,
308
+ fromText,
309
+ fromDom: fromDom$1,
310
+ fromPoint
679
311
  };
680
312
 
681
- var is = function (element, selector) {
682
- var dom = element.dom;
313
+ const is$1 = (element, selector) => {
314
+ const dom = element.dom;
683
315
  if (dom.nodeType !== ELEMENT) {
684
316
  return false;
685
317
  } else {
686
- var elem = dom;
318
+ const elem = dom;
687
319
  if (elem.matches !== undefined) {
688
320
  return elem.matches(selector);
689
321
  } else if (elem.msMatchesSelector !== undefined) {
@@ -698,458 +330,551 @@
698
330
  }
699
331
  };
700
332
 
701
- var eq = function (e1, e2) {
702
- return e1.dom === e2.dom;
703
- };
704
- var regularContains = function (e1, e2) {
705
- var d1 = e1.dom;
706
- var d2 = e2.dom;
333
+ const eq = (e1, e2) => e1.dom === e2.dom;
334
+ const contains = (e1, e2) => {
335
+ const d1 = e1.dom;
336
+ const d2 = e2.dom;
707
337
  return d1 === d2 ? false : d1.contains(d2);
708
338
  };
709
- var ieContains = function (e1, e2) {
710
- return documentPositionContainedBy(e1.dom, e2.dom);
711
- };
712
- var contains$1 = function (e1, e2) {
713
- return detect$3().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);
714
- };
715
- var is$1 = is;
339
+ const is = is$1;
716
340
 
717
- var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
341
+ const Global = typeof window !== 'undefined' ? window : Function('return this;')();
718
342
 
719
- var global$2 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
720
-
721
- var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
722
-
723
- var keys = Object.keys;
724
- var each$1 = function (obj, f) {
725
- var props = keys(obj);
726
- for (var k = 0, len = props.length; k < len; k++) {
727
- var i = props[k];
728
- var x = obj[i];
729
- f(x, i);
343
+ const path = (parts, scope) => {
344
+ let o = scope !== undefined && scope !== null ? scope : Global;
345
+ for (let i = 0; i < parts.length && o !== undefined && o !== null; ++i) {
346
+ o = o[parts[i]];
730
347
  }
348
+ return o;
731
349
  };
732
- var objAcc = function (r) {
733
- return function (x, i) {
734
- r[i] = x;
735
- };
350
+ const resolve = (p, scope) => {
351
+ const parts = p.split('.');
352
+ return path(parts, scope);
736
353
  };
737
- var internalFilter = function (obj, pred, onTrue, onFalse) {
738
- var r = {};
739
- each$1(obj, function (x, i) {
740
- (pred(x, i) ? onTrue : onFalse)(x, i);
741
- });
742
- return r;
354
+
355
+ const unsafe = (name, scope) => {
356
+ return resolve(name, scope);
743
357
  };
744
- var filter$1 = function (obj, pred) {
745
- var t = {};
746
- internalFilter(obj, pred, objAcc(t), noop);
747
- return t;
358
+ const getOrDie = (name, scope) => {
359
+ const actual = unsafe(name, scope);
360
+ if (actual === undefined || actual === null) {
361
+ throw new Error(name + ' not available on this browser');
362
+ }
363
+ return actual;
748
364
  };
749
365
 
750
- var Global = typeof window !== 'undefined' ? window : Function('return this;')();
366
+ const getPrototypeOf = Object.getPrototypeOf;
367
+ const sandHTMLElement = scope => {
368
+ return getOrDie('HTMLElement', scope);
369
+ };
370
+ const isPrototypeOf = x => {
371
+ const scope = resolve('ownerDocument.defaultView', x);
372
+ return isObject(x) && (sandHTMLElement(scope).prototype.isPrototypeOf(x) || /^HTML\w*Element$/.test(getPrototypeOf(x).constructor.name));
373
+ };
751
374
 
752
- var name = function (element) {
753
- var r = element.dom.nodeName;
375
+ const name = element => {
376
+ const r = element.dom.nodeName;
754
377
  return r.toLowerCase();
755
378
  };
756
- var type = function (element) {
757
- return element.dom.nodeType;
379
+ const type = element => element.dom.nodeType;
380
+ const isType = t => element => type(element) === t;
381
+ const isComment = element => type(element) === COMMENT || name(element) === '#comment';
382
+ const isHTMLElement = element => isElement$1(element) && isPrototypeOf(element.dom);
383
+ const isElement$1 = isType(ELEMENT);
384
+ const isText = isType(TEXT);
385
+ const isDocument = isType(DOCUMENT);
386
+ const isDocumentFragment = isType(DOCUMENT_FRAGMENT);
387
+ const isTag = tag => e => isElement$1(e) && name(e) === tag;
388
+
389
+ const owner = element => SugarElement.fromDom(element.dom.ownerDocument);
390
+ const documentOrOwner = dos => isDocument(dos) ? dos : owner(dos);
391
+ const parent = element => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
392
+ const parentElement = element => Optional.from(element.dom.parentElement).map(SugarElement.fromDom);
393
+ const nextSibling = element => Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
394
+ const children = element => map(element.dom.childNodes, SugarElement.fromDom);
395
+ const child = (element, index) => {
396
+ const cs = element.dom.childNodes;
397
+ return Optional.from(cs[index]).map(SugarElement.fromDom);
758
398
  };
759
- var isType$1 = function (t) {
760
- return function (element) {
761
- return type(element) === t;
762
- };
399
+ const firstChild = element => child(element, 0);
400
+ const lastChild = element => child(element, element.dom.childNodes.length - 1);
401
+
402
+ const isShadowRoot = dos => isDocumentFragment(dos) && isNonNullable(dos.dom.host);
403
+ const supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
404
+ const getRootNode = supported ? e => SugarElement.fromDom(e.dom.getRootNode()) : documentOrOwner;
405
+ const getShadowRoot = e => {
406
+ const r = getRootNode(e);
407
+ return isShadowRoot(r) ? Optional.some(r) : Optional.none();
763
408
  };
764
- var isElement = isType$1(ELEMENT);
409
+ const getShadowHost = e => SugarElement.fromDom(e.dom.host);
765
410
 
766
- var rawSet = function (dom, key, value) {
767
- if (isString(value) || isBoolean(value) || isNumber(value)) {
768
- dom.setAttribute(key, value + '');
769
- } else {
770
- console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
771
- throw new Error('Attribute value was not simple');
411
+ const inBody = element => {
412
+ const dom = isText(element) ? element.dom.parentNode : element.dom;
413
+ if (dom === undefined || dom === null || dom.ownerDocument === null) {
414
+ return false;
772
415
  }
773
- };
774
- var setAll = function (element, attrs) {
775
- var dom = element.dom;
776
- each$1(attrs, function (v, k) {
777
- rawSet(dom, k, v);
778
- });
779
- };
780
- var clone = function (element) {
781
- return foldl(element.dom.attributes, function (acc, attr) {
782
- acc[attr.name] = attr.value;
783
- return acc;
784
- }, {});
416
+ const doc = dom.ownerDocument;
417
+ return getShadowRoot(SugarElement.fromDom(dom)).fold(() => doc.body.contains(dom), compose1(inBody, getShadowHost));
785
418
  };
786
419
 
787
- var parent = function (element) {
788
- return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
420
+ var ClosestOrAncestor = (is, ancestor, scope, a, isRoot) => {
421
+ if (is(scope, a)) {
422
+ return Optional.some(scope);
423
+ } else if (isFunction(isRoot) && isRoot(scope)) {
424
+ return Optional.none();
425
+ } else {
426
+ return ancestor(scope, a, isRoot);
427
+ }
789
428
  };
790
- var children = function (element) {
791
- return map(element.dom.childNodes, SugarElement.fromDom);
429
+
430
+ const ancestor$3 = (scope, predicate, isRoot) => {
431
+ let element = scope.dom;
432
+ const stop = isFunction(isRoot) ? isRoot : never;
433
+ while (element.parentNode) {
434
+ element = element.parentNode;
435
+ const el = SugarElement.fromDom(element);
436
+ if (predicate(el)) {
437
+ return Optional.some(el);
438
+ } else if (stop(el)) {
439
+ break;
440
+ }
441
+ }
442
+ return Optional.none();
792
443
  };
793
- var child = function (element, index) {
794
- var cs = element.dom.childNodes;
795
- return Optional.from(cs[index]).map(SugarElement.fromDom);
444
+ const closest$2 = (scope, predicate, isRoot) => {
445
+ const is = (s, test) => test(s);
446
+ return ClosestOrAncestor(is, ancestor$3, scope, predicate, isRoot);
796
447
  };
797
- var firstChild = function (element) {
798
- return child(element, 0);
448
+
449
+ const ancestor$2 = (scope, selector, isRoot) => ancestor$3(scope, e => is$1(e, selector), isRoot);
450
+ const closest$1 = (scope, selector, isRoot) => {
451
+ const is = (element, selector) => is$1(element, selector);
452
+ return ClosestOrAncestor(is, ancestor$2, scope, selector, isRoot);
799
453
  };
800
- var lastChild = function (element) {
801
- return child(element, element.dom.childNodes.length - 1);
454
+
455
+ const closest = target => closest$1(target, '[contenteditable]');
456
+ const isEditable = (element, assumeEditable = false) => {
457
+ if (inBody(element)) {
458
+ return element.dom.isContentEditable;
459
+ } else {
460
+ return closest(element).fold(constant(assumeEditable), editable => getRaw(editable) === 'true');
461
+ }
802
462
  };
463
+ const getRaw = element => element.dom.contentEditable;
803
464
 
804
- var before = function (marker, element) {
805
- var parent$1 = parent(marker);
806
- parent$1.each(function (v) {
465
+ const before$1 = (marker, element) => {
466
+ const parent$1 = parent(marker);
467
+ parent$1.each(v => {
807
468
  v.dom.insertBefore(element.dom, marker.dom);
808
469
  });
809
470
  };
810
- var append = function (parent, element) {
471
+ const after = (marker, element) => {
472
+ const sibling = nextSibling(marker);
473
+ sibling.fold(() => {
474
+ const parent$1 = parent(marker);
475
+ parent$1.each(v => {
476
+ append$1(v, element);
477
+ });
478
+ }, v => {
479
+ before$1(v, element);
480
+ });
481
+ };
482
+ const prepend = (parent, element) => {
483
+ const firstChild$1 = firstChild(parent);
484
+ firstChild$1.fold(() => {
485
+ append$1(parent, element);
486
+ }, v => {
487
+ parent.dom.insertBefore(element.dom, v.dom);
488
+ });
489
+ };
490
+ const append$1 = (parent, element) => {
811
491
  parent.dom.appendChild(element.dom);
812
492
  };
813
493
 
814
- var before$1 = function (marker, elements) {
815
- each(elements, function (x) {
816
- before(marker, x);
494
+ const before = (marker, elements) => {
495
+ each$1(elements, x => {
496
+ before$1(marker, x);
817
497
  });
818
498
  };
819
- var append$1 = function (parent, elements) {
820
- each(elements, function (x) {
821
- append(parent, x);
499
+ const append = (parent, elements) => {
500
+ each$1(elements, x => {
501
+ append$1(parent, x);
822
502
  });
823
503
  };
824
504
 
825
- var remove = function (element) {
826
- var dom = element.dom;
505
+ const empty = element => {
506
+ element.dom.textContent = '';
507
+ each$1(children(element), rogue => {
508
+ remove(rogue);
509
+ });
510
+ };
511
+ const remove = element => {
512
+ const dom = element.dom;
827
513
  if (dom.parentNode !== null) {
828
514
  dom.parentNode.removeChild(dom);
829
515
  }
830
516
  };
831
517
 
832
- var clone$1 = function (original, isDeep) {
833
- return SugarElement.fromDom(original.dom.cloneNode(isDeep));
834
- };
835
- var deep = function (original) {
836
- return clone$1(original, true);
837
- };
838
- var shallowAs = function (original, tag) {
839
- var nu = SugarElement.fromTag(tag);
840
- var attributes = clone(original);
841
- setAll(nu, attributes);
842
- return nu;
843
- };
844
- var mutate = function (original, tag) {
845
- var nu = shallowAs(original, tag);
846
- before(original, nu);
847
- var children$1 = children(original);
848
- append$1(nu, children$1);
849
- remove(original);
850
- return nu;
851
- };
518
+ var global$6 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
852
519
 
853
- var global$4 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
520
+ var global$5 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
854
521
 
855
- var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
522
+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
856
523
 
857
- var matchNodeName = function (name) {
858
- return function (node) {
859
- return node && node.nodeName.toLowerCase() === name;
860
- };
524
+ const fromDom = nodes => map(nodes, SugarElement.fromDom);
525
+
526
+ const keys = Object.keys;
527
+ const each = (obj, f) => {
528
+ const props = keys(obj);
529
+ for (let k = 0, len = props.length; k < len; k++) {
530
+ const i = props[k];
531
+ const x = obj[i];
532
+ f(x, i);
533
+ }
861
534
  };
862
- var matchNodeNames = function (regex) {
863
- return function (node) {
864
- return node && regex.test(node.nodeName);
865
- };
535
+ const objAcc = r => (x, i) => {
536
+ r[i] = x;
537
+ };
538
+ const internalFilter = (obj, pred, onTrue, onFalse) => {
539
+ each(obj, (x, i) => {
540
+ (pred(x, i) ? onTrue : onFalse)(x, i);
541
+ });
866
542
  };
867
- var isTextNode = function (node) {
868
- return node && node.nodeType === 3;
543
+ const filter = (obj, pred) => {
544
+ const t = {};
545
+ internalFilter(obj, pred, objAcc(t), noop);
546
+ return t;
547
+ };
548
+
549
+ const rawSet = (dom, key, value) => {
550
+ if (isString(value) || isBoolean(value) || isNumber(value)) {
551
+ dom.setAttribute(key, value + '');
552
+ } else {
553
+ console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
554
+ throw new Error('Attribute value was not simple');
555
+ }
869
556
  };
870
- var isListNode = matchNodeNames(/^(OL|UL|DL)$/);
871
- var isOlUlNode = matchNodeNames(/^(OL|UL)$/);
872
- var isOlNode = matchNodeName('ol');
873
- var isListItemNode = matchNodeNames(/^(LI|DT|DD)$/);
874
- var isDlItemNode = matchNodeNames(/^(DT|DD)$/);
875
- var isTableCellNode = matchNodeNames(/^(TH|TD)$/);
876
- var isBr = matchNodeName('br');
877
- var isFirstChild = function (node) {
878
- return node.parentNode.firstChild === node;
557
+ const setAll = (element, attrs) => {
558
+ const dom = element.dom;
559
+ each(attrs, (v, k) => {
560
+ rawSet(dom, k, v);
561
+ });
879
562
  };
880
- var isTextBlock = function (editor, node) {
881
- return node && !!editor.schema.getTextBlockElements()[node.nodeName];
563
+ const clone$1 = element => foldl(element.dom.attributes, (acc, attr) => {
564
+ acc[attr.name] = attr.value;
565
+ return acc;
566
+ }, {});
567
+
568
+ const clone = (original, isDeep) => SugarElement.fromDom(original.dom.cloneNode(isDeep));
569
+ const deep = original => clone(original, true);
570
+ const shallowAs = (original, tag) => {
571
+ const nu = SugarElement.fromTag(tag);
572
+ const attributes = clone$1(original);
573
+ setAll(nu, attributes);
574
+ return nu;
882
575
  };
883
- var isBlock = function (node, blockElements) {
884
- return node && node.nodeName in blockElements;
576
+ const mutate = (original, tag) => {
577
+ const nu = shallowAs(original, tag);
578
+ after(original, nu);
579
+ const children$1 = children(original);
580
+ append(nu, children$1);
581
+ remove(original);
582
+ return nu;
885
583
  };
886
- var isBogusBr = function (dom, node) {
584
+
585
+ var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
586
+
587
+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
588
+
589
+ const matchNodeName = name => node => isNonNullable(node) && node.nodeName.toLowerCase() === name;
590
+ const matchNodeNames = regex => node => isNonNullable(node) && regex.test(node.nodeName);
591
+ const isTextNode$1 = node => isNonNullable(node) && node.nodeType === 3;
592
+ const isElement = node => isNonNullable(node) && node.nodeType === 1;
593
+ const isListNode = matchNodeNames(/^(OL|UL|DL)$/);
594
+ const isOlUlNode = matchNodeNames(/^(OL|UL)$/);
595
+ const isOlNode = matchNodeName('ol');
596
+ const isListItemNode = matchNodeNames(/^(LI|DT|DD)$/);
597
+ const isDlItemNode = matchNodeNames(/^(DT|DD)$/);
598
+ const isTableCellNode = matchNodeNames(/^(TH|TD)$/);
599
+ const isBr = matchNodeName('br');
600
+ const isFirstChild = node => {
601
+ var _a;
602
+ return ((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === node;
603
+ };
604
+ const isTextBlock = (editor, node) => isNonNullable(node) && node.nodeName in editor.schema.getTextBlockElements();
605
+ const isBlock = (node, blockElements) => isNonNullable(node) && node.nodeName in blockElements;
606
+ const isVoid = (editor, node) => isNonNullable(node) && node.nodeName in editor.schema.getVoidElements();
607
+ const isBogusBr = (dom, node) => {
887
608
  if (!isBr(node)) {
888
609
  return false;
889
610
  }
890
611
  return dom.isBlock(node.nextSibling) && !isBr(node.previousSibling);
891
612
  };
892
- var isEmpty$1 = function (dom, elm, keepBookmarks) {
893
- var empty = dom.isEmpty(elm);
613
+ const isEmpty$2 = (dom, elm, keepBookmarks) => {
614
+ const empty = dom.isEmpty(elm);
894
615
  if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
895
616
  return false;
896
617
  }
897
618
  return empty;
898
619
  };
899
- var isChildOfBody = function (dom, elm) {
900
- return dom.isChildOf(elm, dom.getRoot());
901
- };
620
+ const isChildOfBody = (dom, elm) => dom.isChildOf(elm, dom.getRoot());
902
621
 
903
- var shouldIndentOnTab = function (editor) {
904
- return editor.getParam('lists_indent_on_tab', true);
905
- };
906
- var getForcedRootBlock = function (editor) {
907
- var block = editor.getParam('forced_root_block', 'p');
908
- if (block === false) {
909
- return '';
910
- } else if (block === true) {
911
- return 'p';
912
- } else {
913
- return block;
914
- }
915
- };
916
- var getForcedRootBlockAttrs = function (editor) {
917
- return editor.getParam('forced_root_block_attrs', {});
622
+ const option = name => editor => editor.options.get(name);
623
+ const register$3 = editor => {
624
+ const registerOption = editor.options.register;
625
+ registerOption('lists_indent_on_tab', {
626
+ processor: 'boolean',
627
+ default: true
628
+ });
918
629
  };
919
-
920
- var createTextBlock = function (editor, contentNode) {
921
- var dom = editor.dom;
922
- var blockElements = editor.schema.getBlockElements();
923
- var fragment = dom.createFragment();
924
- var blockName = getForcedRootBlock(editor);
925
- var node, textBlock, hasContentNode;
926
- if (blockName) {
927
- textBlock = dom.create(blockName);
928
- if (textBlock.tagName === blockName.toUpperCase()) {
929
- dom.setAttribs(textBlock, getForcedRootBlockAttrs(editor));
930
- }
931
- if (!isBlock(contentNode.firstChild, blockElements)) {
932
- fragment.appendChild(textBlock);
630
+ const shouldIndentOnTab = option('lists_indent_on_tab');
631
+ const getForcedRootBlock = option('forced_root_block');
632
+ const getForcedRootBlockAttrs = option('forced_root_block_attrs');
633
+
634
+ const createTextBlock = (editor, contentNode) => {
635
+ const dom = editor.dom;
636
+ const blockElements = editor.schema.getBlockElements();
637
+ const fragment = dom.createFragment();
638
+ const blockName = getForcedRootBlock(editor);
639
+ const blockAttrs = getForcedRootBlockAttrs(editor);
640
+ let node;
641
+ let textBlock;
642
+ let hasContentNode = false;
643
+ textBlock = dom.create(blockName, blockAttrs);
644
+ if (!isBlock(contentNode.firstChild, blockElements)) {
645
+ fragment.appendChild(textBlock);
646
+ }
647
+ while (node = contentNode.firstChild) {
648
+ const nodeName = node.nodeName;
649
+ if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
650
+ hasContentNode = true;
933
651
  }
934
- }
935
- if (contentNode) {
936
- while (node = contentNode.firstChild) {
937
- var nodeName = node.nodeName;
938
- if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
939
- hasContentNode = true;
940
- }
941
- if (isBlock(node, blockElements)) {
942
- fragment.appendChild(node);
943
- textBlock = null;
944
- } else {
945
- if (blockName) {
946
- if (!textBlock) {
947
- textBlock = dom.create(blockName);
948
- fragment.appendChild(textBlock);
949
- }
950
- textBlock.appendChild(node);
951
- } else {
952
- fragment.appendChild(node);
953
- }
652
+ if (isBlock(node, blockElements)) {
653
+ fragment.appendChild(node);
654
+ textBlock = null;
655
+ } else {
656
+ if (!textBlock) {
657
+ textBlock = dom.create(blockName, blockAttrs);
658
+ fragment.appendChild(textBlock);
954
659
  }
660
+ textBlock.appendChild(node);
955
661
  }
956
662
  }
957
- if (!blockName) {
958
- fragment.appendChild(dom.create('br'));
959
- } else {
960
- if (!hasContentNode) {
961
- textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' }));
962
- }
663
+ if (!hasContentNode && textBlock) {
664
+ textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' }));
963
665
  }
964
666
  return fragment;
965
667
  };
966
668
 
967
- var DOM = global$4.DOM;
968
- var splitList = function (editor, ul, li) {
969
- var removeAndKeepBookmarks = function (targetNode) {
970
- global$5.each(bookmarks, function (node) {
971
- targetNode.parentNode.insertBefore(node, li.parentNode);
972
- });
973
- DOM.remove(targetNode);
669
+ const DOM$2 = global$3.DOM;
670
+ const splitList = (editor, list, li) => {
671
+ const removeAndKeepBookmarks = targetNode => {
672
+ const parent = targetNode.parentNode;
673
+ if (parent) {
674
+ global$2.each(bookmarks, node => {
675
+ parent.insertBefore(node, li.parentNode);
676
+ });
677
+ }
678
+ DOM$2.remove(targetNode);
974
679
  };
975
- var bookmarks = DOM.select('span[data-mce-type="bookmark"]', ul);
976
- var newBlock = createTextBlock(editor, li);
977
- var tmpRng = DOM.createRng();
680
+ const bookmarks = DOM$2.select('span[data-mce-type="bookmark"]', list);
681
+ const newBlock = createTextBlock(editor, li);
682
+ const tmpRng = DOM$2.createRng();
978
683
  tmpRng.setStartAfter(li);
979
- tmpRng.setEndAfter(ul);
980
- var fragment = tmpRng.extractContents();
981
- for (var node = fragment.firstChild; node; node = node.firstChild) {
684
+ tmpRng.setEndAfter(list);
685
+ const fragment = tmpRng.extractContents();
686
+ for (let node = fragment.firstChild; node; node = node.firstChild) {
982
687
  if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
983
- DOM.remove(node);
688
+ DOM$2.remove(node);
984
689
  break;
985
690
  }
986
691
  }
987
692
  if (!editor.dom.isEmpty(fragment)) {
988
- DOM.insertAfter(fragment, ul);
693
+ DOM$2.insertAfter(fragment, list);
989
694
  }
990
- DOM.insertAfter(newBlock, ul);
991
- if (isEmpty$1(editor.dom, li.parentNode)) {
992
- removeAndKeepBookmarks(li.parentNode);
695
+ DOM$2.insertAfter(newBlock, list);
696
+ const parent = li.parentElement;
697
+ if (parent && isEmpty$2(editor.dom, parent)) {
698
+ removeAndKeepBookmarks(parent);
993
699
  }
994
- DOM.remove(li);
995
- if (isEmpty$1(editor.dom, ul)) {
996
- DOM.remove(ul);
700
+ DOM$2.remove(li);
701
+ if (isEmpty$2(editor.dom, list)) {
702
+ DOM$2.remove(list);
997
703
  }
998
704
  };
999
705
 
1000
- var outdentDlItem = function (editor, item) {
1001
- if (is$1(item, 'dd')) {
706
+ const isDescriptionDetail = isTag('dd');
707
+ const isDescriptionTerm = isTag('dt');
708
+ const outdentDlItem = (editor, item) => {
709
+ if (isDescriptionDetail(item)) {
1002
710
  mutate(item, 'dt');
1003
- } else if (is$1(item, 'dt')) {
1004
- parent(item).each(function (dl) {
1005
- return splitList(editor, dl.dom, item.dom);
1006
- });
711
+ } else if (isDescriptionTerm(item)) {
712
+ parentElement(item).each(dl => splitList(editor, dl.dom, item.dom));
1007
713
  }
1008
714
  };
1009
- var indentDlItem = function (item) {
1010
- if (is$1(item, 'dt')) {
715
+ const indentDlItem = item => {
716
+ if (isDescriptionTerm(item)) {
1011
717
  mutate(item, 'dd');
1012
718
  }
1013
719
  };
1014
- var dlIndentation = function (editor, indentation, dlItems) {
720
+ const dlIndentation = (editor, indentation, dlItems) => {
1015
721
  if (indentation === 'Indent') {
1016
- each(dlItems, indentDlItem);
722
+ each$1(dlItems, indentDlItem);
1017
723
  } else {
1018
- each(dlItems, function (item) {
1019
- return outdentDlItem(editor, item);
1020
- });
724
+ each$1(dlItems, item => outdentDlItem(editor, item));
1021
725
  }
1022
726
  };
1023
727
 
1024
- var getNormalizedPoint = function (container, offset) {
1025
- if (isTextNode(container)) {
728
+ const getNormalizedPoint = (container, offset) => {
729
+ if (isTextNode$1(container)) {
1026
730
  return {
1027
- container: container,
1028
- offset: offset
731
+ container,
732
+ offset
1029
733
  };
1030
734
  }
1031
- var node = global$1.getNode(container, offset);
1032
- if (isTextNode(node)) {
735
+ const node = global$6.getNode(container, offset);
736
+ if (isTextNode$1(node)) {
1033
737
  return {
1034
738
  container: node,
1035
739
  offset: offset >= container.childNodes.length ? node.data.length : 0
1036
740
  };
1037
- } else if (node.previousSibling && isTextNode(node.previousSibling)) {
741
+ } else if (node.previousSibling && isTextNode$1(node.previousSibling)) {
1038
742
  return {
1039
743
  container: node.previousSibling,
1040
744
  offset: node.previousSibling.data.length
1041
745
  };
1042
- } else if (node.nextSibling && isTextNode(node.nextSibling)) {
746
+ } else if (node.nextSibling && isTextNode$1(node.nextSibling)) {
1043
747
  return {
1044
748
  container: node.nextSibling,
1045
749
  offset: 0
1046
750
  };
1047
751
  }
1048
752
  return {
1049
- container: container,
1050
- offset: offset
753
+ container,
754
+ offset
1051
755
  };
1052
756
  };
1053
- var normalizeRange = function (rng) {
1054
- var outRng = rng.cloneRange();
1055
- var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset);
757
+ const normalizeRange = rng => {
758
+ const outRng = rng.cloneRange();
759
+ const rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset);
1056
760
  outRng.setStart(rangeStart.container, rangeStart.offset);
1057
- var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset);
761
+ const rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset);
1058
762
  outRng.setEnd(rangeEnd.container, rangeEnd.offset);
1059
763
  return outRng;
1060
764
  };
1061
765
 
1062
- var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
1063
-
1064
- var getParentList = function (editor, node) {
1065
- var selectionStart = node || editor.selection.getStart(true);
1066
- return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));
1067
- };
1068
- var isParentListSelected = function (parentList, selectedBlocks) {
1069
- return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
1070
- };
1071
- var findSubLists = function (parentList) {
1072
- return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) {
1073
- return isListNode(elm);
1074
- });
1075
- };
1076
- var getSelectedSubLists = function (editor) {
1077
- var parentList = getParentList(editor);
1078
- var selectedBlocks = editor.selection.getSelectedBlocks();
766
+ const listNames = [
767
+ 'OL',
768
+ 'UL',
769
+ 'DL'
770
+ ];
771
+ const listSelector = listNames.join(',');
772
+ const getParentList = (editor, node) => {
773
+ const selectionStart = node || editor.selection.getStart(true);
774
+ return editor.dom.getParent(selectionStart, listSelector, getClosestListHost(editor, selectionStart));
775
+ };
776
+ const isParentListSelected = (parentList, selectedBlocks) => isNonNullable(parentList) && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
777
+ const findSubLists = parentList => filter$1(parentList.querySelectorAll(listSelector), isListNode);
778
+ const getSelectedSubLists = editor => {
779
+ const parentList = getParentList(editor);
780
+ const selectedBlocks = editor.selection.getSelectedBlocks();
1079
781
  if (isParentListSelected(parentList, selectedBlocks)) {
1080
782
  return findSubLists(parentList);
1081
783
  } else {
1082
- return global$5.grep(selectedBlocks, function (elm) {
784
+ return filter$1(selectedBlocks, elm => {
1083
785
  return isListNode(elm) && parentList !== elm;
1084
786
  });
1085
787
  }
1086
788
  };
1087
- var findParentListItemsNodes = function (editor, elms) {
1088
- var listItemsElms = global$5.map(elms, function (elm) {
1089
- var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
789
+ const findParentListItemsNodes = (editor, elms) => {
790
+ const listItemsElms = global$2.map(elms, elm => {
791
+ const parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListHost(editor, elm));
1090
792
  return parentLi ? parentLi : elm;
1091
793
  });
1092
- return global$6.unique(listItemsElms);
794
+ return unique(listItemsElms);
795
+ };
796
+ const getSelectedListItems = editor => {
797
+ const selectedBlocks = editor.selection.getSelectedBlocks();
798
+ return filter$1(findParentListItemsNodes(editor, selectedBlocks), isListItemNode);
799
+ };
800
+ const getSelectedDlItems = editor => filter$1(getSelectedListItems(editor), isDlItemNode);
801
+ const getClosestEditingHost = (editor, elm) => {
802
+ const parentTableCell = editor.dom.getParents(elm, 'TD,TH');
803
+ return parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
804
+ };
805
+ const isListHost = (schema, node) => !isListNode(node) && !isListItemNode(node) && exists(listNames, listName => schema.isValidChild(node.nodeName, listName));
806
+ const getClosestListHost = (editor, elm) => {
807
+ const parentBlocks = editor.dom.getParents(elm, editor.dom.isBlock);
808
+ const parentBlock = find(parentBlocks, elm => isListHost(editor.schema, elm));
809
+ return parentBlock.getOr(editor.getBody());
810
+ };
811
+ const isListInsideAnLiWithFirstAndLastNotListElement = list => parent(list).exists(parent => isListItemNode(parent.dom) && firstChild(parent).exists(firstChild => !isListNode(firstChild.dom)) && lastChild(parent).exists(lastChild => !isListNode(lastChild.dom)));
812
+ const findLastParentListNode = (editor, elm) => {
813
+ const parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListHost(editor, elm));
814
+ return last(parentLists);
1093
815
  };
1094
- var getSelectedListItems = function (editor) {
1095
- var selectedBlocks = editor.selection.getSelectedBlocks();
1096
- return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
1097
- return isListItemNode(block);
1098
- });
816
+ const getSelectedLists = editor => {
817
+ const firstList = findLastParentListNode(editor, editor.selection.getStart());
818
+ const subsequentLists = filter$1(editor.selection.getSelectedBlocks(), isOlUlNode);
819
+ return firstList.toArray().concat(subsequentLists);
1099
820
  };
1100
- var getSelectedDlItems = function (editor) {
1101
- return filter(getSelectedListItems(editor), isDlItemNode);
821
+ const getParentLists = editor => {
822
+ const elm = editor.selection.getStart();
823
+ return editor.dom.getParents(elm, 'ol,ul', getClosestListHost(editor, elm));
1102
824
  };
1103
- var getClosestListRootElm = function (editor, elm) {
1104
- var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
1105
- var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
1106
- return root;
825
+ const getSelectedListRoots = editor => {
826
+ const selectedLists = getSelectedLists(editor);
827
+ const parentLists = getParentLists(editor);
828
+ return find(parentLists, p => isListInsideAnLiWithFirstAndLastNotListElement(SugarElement.fromDom(p))).fold(() => getUniqueListRoots(editor, selectedLists), l => [l]);
1107
829
  };
1108
- var findLastParentListNode = function (editor, elm) {
1109
- var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListRootElm(editor, elm));
1110
- return last(parentLists);
830
+ const getUniqueListRoots = (editor, lists) => {
831
+ const listRoots = map(lists, list => findLastParentListNode(editor, list).getOr(list));
832
+ return unique(listRoots);
1111
833
  };
1112
- var getSelectedLists = function (editor) {
1113
- var firstList = findLastParentListNode(editor, editor.selection.getStart());
1114
- var subsequentLists = filter(editor.selection.getSelectedBlocks(), isOlUlNode);
1115
- return firstList.toArray().concat(subsequentLists);
834
+
835
+ const isCustomList = list => /\btox\-/.test(list.className);
836
+ const inList = (parents, listName) => findUntil(parents, isListNode, isTableCellNode).exists(list => list.nodeName === listName && !isCustomList(list));
837
+ const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
838
+ const selectionIsWithinNonEditableList = editor => {
839
+ const parentList = getParentList(editor);
840
+ return isWithinNonEditable(editor, parentList);
1116
841
  };
1117
- var getSelectedListRoots = function (editor) {
1118
- var selectedLists = getSelectedLists(editor);
1119
- return getUniqueListRoots(editor, selectedLists);
842
+ const isWithinNonEditableList = (editor, element) => {
843
+ const parentList = editor.dom.getParent(element, 'ol,ul,dl');
844
+ return isWithinNonEditable(editor, parentList);
1120
845
  };
1121
- var getUniqueListRoots = function (editor, lists) {
1122
- var listRoots = map(lists, function (list) {
1123
- return findLastParentListNode(editor, list).getOr(list);
846
+ const setNodeChangeHandler = (editor, nodeChangeHandler) => {
847
+ const initialNode = editor.selection.getNode();
848
+ nodeChangeHandler({
849
+ parents: editor.dom.getParents(initialNode),
850
+ element: initialNode
1124
851
  });
1125
- return global$6.unique(listRoots);
1126
- };
1127
-
1128
- var lift2 = function (oa, ob, f) {
1129
- return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();
852
+ editor.on('NodeChange', nodeChangeHandler);
853
+ return () => editor.off('NodeChange', nodeChangeHandler);
1130
854
  };
1131
855
 
1132
- var fromElements = function (elements, scope) {
1133
- var doc = scope || document;
1134
- var fragment = doc.createDocumentFragment();
1135
- each(elements, function (element) {
856
+ const fromElements = (elements, scope) => {
857
+ const doc = scope || document;
858
+ const fragment = doc.createDocumentFragment();
859
+ each$1(elements, element => {
1136
860
  fragment.appendChild(element.dom);
1137
861
  });
1138
862
  return SugarElement.fromDom(fragment);
1139
863
  };
1140
864
 
1141
- var fireListEvent = function (editor, action, element) {
1142
- return editor.fire('ListMutation', {
1143
- action: action,
1144
- element: element
1145
- });
1146
- };
865
+ const fireListEvent = (editor, action, element) => editor.dispatch('ListMutation', {
866
+ action,
867
+ element
868
+ });
1147
869
 
1148
- var isSupported = function (dom) {
1149
- return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
1150
- };
870
+ const blank = r => s => s.replace(r, '');
871
+ const trim = blank(/^\s+|\s+$/g);
872
+ const isNotEmpty = s => s.length > 0;
873
+ const isEmpty$1 = s => !isNotEmpty(s);
874
+
875
+ const isSupported = dom => dom.style !== undefined && isFunction(dom.style.getPropertyValue);
1151
876
 
1152
- var internalSet = function (dom, property, value) {
877
+ const internalSet = (dom, property, value) => {
1153
878
  if (!isString(value)) {
1154
879
  console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
1155
880
  throw new Error('CSS value must be a string: ' + value);
@@ -1158,124 +883,137 @@
1158
883
  dom.style.setProperty(property, value);
1159
884
  }
1160
885
  };
1161
- var set = function (element, property, value) {
1162
- var dom = element.dom;
886
+ const set = (element, property, value) => {
887
+ const dom = element.dom;
1163
888
  internalSet(dom, property, value);
1164
889
  };
1165
890
 
1166
- var joinSegment = function (parent, child) {
1167
- append(parent.item, child.list);
891
+ const isList = el => is(el, 'OL,UL');
892
+ const isListItem = el => is(el, 'LI');
893
+ const hasFirstChildList = el => firstChild(el).exists(isList);
894
+ const hasLastChildList = el => lastChild(el).exists(isList);
895
+
896
+ const isEntryList = entry => 'listAttributes' in entry;
897
+ const isEntryComment = entry => 'isComment' in entry;
898
+ const isEntryFragment = entry => 'isFragment' in entry;
899
+ const isIndented = entry => entry.depth > 0;
900
+ const isSelected = entry => entry.isSelected;
901
+ const cloneItemContent = li => {
902
+ const children$1 = children(li);
903
+ const content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1;
904
+ return map(content, deep);
1168
905
  };
1169
- var joinSegments = function (segments) {
1170
- for (var i = 1; i < segments.length; i++) {
906
+ const createEntry = (li, depth, isSelected) => parent(li).filter(isElement$1).map(list => ({
907
+ depth,
908
+ dirty: false,
909
+ isSelected,
910
+ content: cloneItemContent(li),
911
+ itemAttributes: clone$1(li),
912
+ listAttributes: clone$1(list),
913
+ listType: name(list),
914
+ isInPreviousLi: false
915
+ }));
916
+
917
+ const joinSegment = (parent, child) => {
918
+ append$1(parent.item, child.list);
919
+ };
920
+ const joinSegments = segments => {
921
+ for (let i = 1; i < segments.length; i++) {
1171
922
  joinSegment(segments[i - 1], segments[i]);
1172
923
  }
1173
924
  };
1174
- var appendSegments = function (head$1, tail) {
925
+ const appendSegments = (head$1, tail) => {
1175
926
  lift2(last(head$1), head(tail), joinSegment);
1176
927
  };
1177
- var createSegment = function (scope, listType) {
1178
- var segment = {
928
+ const createSegment = (scope, listType) => {
929
+ const segment = {
1179
930
  list: SugarElement.fromTag(listType, scope),
1180
931
  item: SugarElement.fromTag('li', scope)
1181
932
  };
1182
- append(segment.list, segment.item);
933
+ append$1(segment.list, segment.item);
1183
934
  return segment;
1184
935
  };
1185
- var createSegments = function (scope, entry, size) {
1186
- var segments = [];
1187
- for (var i = 0; i < size; i++) {
1188
- segments.push(createSegment(scope, entry.listType));
936
+ const createSegments = (scope, entry, size) => {
937
+ const segments = [];
938
+ for (let i = 0; i < size; i++) {
939
+ segments.push(createSegment(scope, isEntryList(entry) ? entry.listType : entry.parentListType));
1189
940
  }
1190
941
  return segments;
1191
942
  };
1192
- var populateSegments = function (segments, entry) {
1193
- for (var i = 0; i < segments.length - 1; i++) {
943
+ const populateSegments = (segments, entry) => {
944
+ for (let i = 0; i < segments.length - 1; i++) {
1194
945
  set(segments[i].item, 'list-style-type', 'none');
1195
946
  }
1196
- last(segments).each(function (segment) {
1197
- setAll(segment.list, entry.listAttributes);
1198
- setAll(segment.item, entry.itemAttributes);
1199
- append$1(segment.item, entry.content);
947
+ last(segments).each(segment => {
948
+ if (isEntryList(entry)) {
949
+ setAll(segment.list, entry.listAttributes);
950
+ setAll(segment.item, entry.itemAttributes);
951
+ }
952
+ append(segment.item, entry.content);
1200
953
  });
1201
954
  };
1202
- var normalizeSegment = function (segment, entry) {
955
+ const normalizeSegment = (segment, entry) => {
1203
956
  if (name(segment.list) !== entry.listType) {
1204
957
  segment.list = mutate(segment.list, entry.listType);
1205
958
  }
1206
959
  setAll(segment.list, entry.listAttributes);
1207
960
  };
1208
- var createItem = function (scope, attr, content) {
1209
- var item = SugarElement.fromTag('li', scope);
961
+ const createItem = (scope, attr, content) => {
962
+ const item = SugarElement.fromTag('li', scope);
1210
963
  setAll(item, attr);
1211
- append$1(item, content);
964
+ append(item, content);
1212
965
  return item;
1213
966
  };
1214
- var appendItem = function (segment, item) {
1215
- append(segment.list, item);
967
+ const appendItem = (segment, item) => {
968
+ append$1(segment.list, item);
1216
969
  segment.item = item;
1217
970
  };
1218
- var writeShallow = function (scope, cast, entry) {
1219
- var newCast = cast.slice(0, entry.depth);
1220
- last(newCast).each(function (segment) {
1221
- var item = createItem(scope, entry.itemAttributes, entry.content);
1222
- appendItem(segment, item);
1223
- normalizeSegment(segment, entry);
971
+ const writeShallow = (scope, cast, entry) => {
972
+ const newCast = cast.slice(0, entry.depth);
973
+ last(newCast).each(segment => {
974
+ if (isEntryList(entry)) {
975
+ const item = createItem(scope, entry.itemAttributes, entry.content);
976
+ appendItem(segment, item);
977
+ normalizeSegment(segment, entry);
978
+ } else if (isEntryFragment(entry)) {
979
+ append(segment.item, entry.content);
980
+ } else {
981
+ const item = SugarElement.fromHtml(`<!--${ entry.content }-->`);
982
+ append$1(segment.list, item);
983
+ }
1224
984
  });
1225
985
  return newCast;
1226
986
  };
1227
- var writeDeep = function (scope, cast, entry) {
1228
- var segments = createSegments(scope, entry, entry.depth - cast.length);
987
+ const writeDeep = (scope, cast, entry) => {
988
+ const segments = createSegments(scope, entry, entry.depth - cast.length);
1229
989
  joinSegments(segments);
1230
990
  populateSegments(segments, entry);
1231
991
  appendSegments(cast, segments);
1232
992
  return cast.concat(segments);
1233
993
  };
1234
- var composeList = function (scope, entries) {
1235
- var cast = foldl(entries, function (cast, entry) {
1236
- return entry.depth > cast.length ? writeDeep(scope, cast, entry) : writeShallow(scope, cast, entry);
994
+ const composeList = (scope, entries) => {
995
+ let firstCommentEntryOpt = Optional.none();
996
+ const cast = foldl(entries, (cast, entry, i) => {
997
+ if (!isEntryComment(entry)) {
998
+ return entry.depth > cast.length ? writeDeep(scope, cast, entry) : writeShallow(scope, cast, entry);
999
+ } else {
1000
+ if (i === 0) {
1001
+ firstCommentEntryOpt = Optional.some(entry);
1002
+ return cast;
1003
+ }
1004
+ return writeShallow(scope, cast, entry);
1005
+ }
1237
1006
  }, []);
1238
- return head(cast).map(function (segment) {
1239
- return segment.list;
1240
- });
1241
- };
1242
-
1243
- var isList = function (el) {
1244
- return is$1(el, 'OL,UL');
1245
- };
1246
- var hasFirstChildList = function (el) {
1247
- return firstChild(el).map(isList).getOr(false);
1248
- };
1249
- var hasLastChildList = function (el) {
1250
- return lastChild(el).map(isList).getOr(false);
1251
- };
1252
-
1253
- var isIndented = function (entry) {
1254
- return entry.depth > 0;
1255
- };
1256
- var isSelected = function (entry) {
1257
- return entry.isSelected;
1258
- };
1259
- var cloneItemContent = function (li) {
1260
- var children$1 = children(li);
1261
- var content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1;
1262
- return map(content, deep);
1263
- };
1264
- var createEntry = function (li, depth, isSelected) {
1265
- return parent(li).filter(isElement).map(function (list) {
1266
- return {
1267
- depth: depth,
1268
- dirty: false,
1269
- isSelected: isSelected,
1270
- content: cloneItemContent(li),
1271
- itemAttributes: clone(li),
1272
- listAttributes: clone(list),
1273
- listType: name(list)
1274
- };
1007
+ firstCommentEntryOpt.each(firstCommentEntry => {
1008
+ const item = SugarElement.fromHtml(`<!--${ firstCommentEntry.content }-->`);
1009
+ head(cast).each(fistCast => {
1010
+ prepend(fistCast.list, item);
1011
+ });
1275
1012
  });
1013
+ return head(cast).map(segment => segment.list);
1276
1014
  };
1277
1015
 
1278
- var indentEntry = function (indentation, entry) {
1016
+ const indentEntry = (indentation, entry) => {
1279
1017
  switch (indentation) {
1280
1018
  case 'Indent':
1281
1019
  entry.depth++;
@@ -1289,143 +1027,151 @@
1289
1027
  entry.dirty = true;
1290
1028
  };
1291
1029
 
1292
- var cloneListProperties = function (target, source) {
1293
- target.listType = source.listType;
1294
- target.listAttributes = __assign({}, source.listAttributes);
1030
+ const cloneListProperties = (target, source) => {
1031
+ if (isEntryList(target) && isEntryList(source)) {
1032
+ target.listType = source.listType;
1033
+ target.listAttributes = { ...source.listAttributes };
1034
+ }
1295
1035
  };
1296
- var cleanListProperties = function (entry) {
1297
- entry.listAttributes = filter$1(entry.listAttributes, function (_value, key) {
1298
- return key !== 'start';
1299
- });
1036
+ const cleanListProperties = entry => {
1037
+ entry.listAttributes = filter(entry.listAttributes, (_value, key) => key !== 'start');
1300
1038
  };
1301
- var closestSiblingEntry = function (entries, start) {
1302
- var depth = entries[start].depth;
1303
- var matches = function (entry) {
1304
- return entry.depth === depth && !entry.dirty;
1305
- };
1306
- var until = function (entry) {
1307
- return entry.depth < depth;
1308
- };
1309
- return findUntil(reverse(entries.slice(0, start)), matches, until).orThunk(function () {
1310
- return findUntil(entries.slice(start + 1), matches, until);
1311
- });
1039
+ const closestSiblingEntry = (entries, start) => {
1040
+ const depth = entries[start].depth;
1041
+ const matches = entry => entry.depth === depth && !entry.dirty;
1042
+ const until = entry => entry.depth < depth;
1043
+ return findUntil(reverse(entries.slice(0, start)), matches, until).orThunk(() => findUntil(entries.slice(start + 1), matches, until));
1312
1044
  };
1313
- var normalizeEntries = function (entries) {
1314
- each(entries, function (entry, i) {
1315
- closestSiblingEntry(entries, i).fold(function () {
1316
- if (entry.dirty) {
1045
+ const normalizeEntries = entries => {
1046
+ each$1(entries, (entry, i) => {
1047
+ closestSiblingEntry(entries, i).fold(() => {
1048
+ if (entry.dirty && isEntryList(entry)) {
1317
1049
  cleanListProperties(entry);
1318
1050
  }
1319
- }, function (matchingEntry) {
1320
- return cloneListProperties(entry, matchingEntry);
1321
- });
1051
+ }, matchingEntry => cloneListProperties(entry, matchingEntry));
1322
1052
  });
1323
1053
  return entries;
1324
1054
  };
1325
1055
 
1326
- var Cell = function (initial) {
1327
- var value = initial;
1328
- var get = function () {
1056
+ const Cell = initial => {
1057
+ let value = initial;
1058
+ const get = () => {
1329
1059
  return value;
1330
1060
  };
1331
- var set = function (v) {
1061
+ const set = v => {
1332
1062
  value = v;
1333
1063
  };
1334
1064
  return {
1335
- get: get,
1336
- set: set
1065
+ get,
1066
+ set
1337
1067
  };
1338
1068
  };
1339
1069
 
1340
- var parseItem = function (depth, itemSelection, selectionState, item) {
1341
- return firstChild(item).filter(isList).fold(function () {
1342
- itemSelection.each(function (selection) {
1343
- if (eq(selection.start, item)) {
1344
- selectionState.set(true);
1345
- }
1346
- });
1347
- var currentItemEntry = createEntry(item, depth, selectionState.get());
1348
- itemSelection.each(function (selection) {
1349
- if (eq(selection.end, item)) {
1350
- selectionState.set(false);
1351
- }
1352
- });
1353
- var childListEntries = lastChild(item).filter(isList).map(function (list) {
1354
- return parseList(depth, itemSelection, selectionState, list);
1355
- }).getOr([]);
1356
- return currentItemEntry.toArray().concat(childListEntries);
1357
- }, function (list) {
1358
- return parseList(depth, itemSelection, selectionState, list);
1359
- });
1360
- };
1361
- var parseList = function (depth, itemSelection, selectionState, list) {
1362
- return bind(children(list), function (element) {
1363
- var parser = isList(element) ? parseList : parseItem;
1364
- var newDepth = depth + 1;
1365
- return parser(newDepth, itemSelection, selectionState, element);
1070
+ const parseSingleItem = (depth, itemSelection, selectionState, item) => {
1071
+ var _a;
1072
+ if (isComment(item)) {
1073
+ return [{
1074
+ depth: depth + 1,
1075
+ content: (_a = item.dom.nodeValue) !== null && _a !== void 0 ? _a : '',
1076
+ dirty: false,
1077
+ isSelected: false,
1078
+ isComment: true
1079
+ }];
1080
+ }
1081
+ itemSelection.each(selection => {
1082
+ if (eq(selection.start, item)) {
1083
+ selectionState.set(true);
1084
+ }
1366
1085
  });
1367
- };
1368
- var parseLists = function (lists, itemSelection) {
1369
- var selectionState = Cell(false);
1370
- var initialDepth = 0;
1371
- return map(lists, function (list) {
1372
- return {
1373
- sourceList: list,
1374
- entries: parseList(initialDepth, itemSelection, selectionState, list)
1375
- };
1086
+ const currentItemEntry = createEntry(item, depth, selectionState.get());
1087
+ itemSelection.each(selection => {
1088
+ if (eq(selection.end, item)) {
1089
+ selectionState.set(false);
1090
+ }
1376
1091
  });
1092
+ const childListEntries = lastChild(item).filter(isList).map(list => parseList(depth, itemSelection, selectionState, list)).getOr([]);
1093
+ return currentItemEntry.toArray().concat(childListEntries);
1377
1094
  };
1378
-
1379
- var outdentedComposer = function (editor, entries) {
1380
- var normalizedEntries = normalizeEntries(entries);
1381
- return map(normalizedEntries, function (entry) {
1382
- var content = fromElements(entry.content);
1095
+ const parseItem = (depth, itemSelection, selectionState, item) => firstChild(item).filter(isList).fold(() => parseSingleItem(depth, itemSelection, selectionState, item), list => {
1096
+ const parsedSiblings = foldl(children(item), (acc, liChild, i) => {
1097
+ if (i === 0) {
1098
+ return acc;
1099
+ } else {
1100
+ if (isListItem(liChild)) {
1101
+ return acc.concat(parseSingleItem(depth, itemSelection, selectionState, liChild));
1102
+ } else {
1103
+ const fragment = {
1104
+ isFragment: true,
1105
+ depth,
1106
+ content: [liChild],
1107
+ isSelected: false,
1108
+ dirty: false,
1109
+ parentListType: name(list)
1110
+ };
1111
+ return acc.concat(fragment);
1112
+ }
1113
+ }
1114
+ }, []);
1115
+ return parseList(depth, itemSelection, selectionState, list).concat(parsedSiblings);
1116
+ });
1117
+ const parseList = (depth, itemSelection, selectionState, list) => bind(children(list), element => {
1118
+ const parser = isList(element) ? parseList : parseItem;
1119
+ const newDepth = depth + 1;
1120
+ return parser(newDepth, itemSelection, selectionState, element);
1121
+ });
1122
+ const parseLists = (lists, itemSelection) => {
1123
+ const selectionState = Cell(false);
1124
+ const initialDepth = 0;
1125
+ return map(lists, list => ({
1126
+ sourceList: list,
1127
+ entries: parseList(initialDepth, itemSelection, selectionState, list)
1128
+ }));
1129
+ };
1130
+
1131
+ const outdentedComposer = (editor, entries) => {
1132
+ const normalizedEntries = normalizeEntries(entries);
1133
+ return map(normalizedEntries, entry => {
1134
+ const content = !isEntryComment(entry) ? fromElements(entry.content) : fromElements([SugarElement.fromHtml(`<!--${ entry.content }-->`)]);
1383
1135
  return SugarElement.fromDom(createTextBlock(editor, content.dom));
1384
1136
  });
1385
1137
  };
1386
- var indentedComposer = function (editor, entries) {
1387
- var normalizedEntries = normalizeEntries(entries);
1138
+ const indentedComposer = (editor, entries) => {
1139
+ const normalizedEntries = normalizeEntries(entries);
1388
1140
  return composeList(editor.contentDocument, normalizedEntries).toArray();
1389
1141
  };
1390
- var composeEntries = function (editor, entries) {
1391
- return bind(groupBy(entries, isIndented), function (entries) {
1392
- var groupIsIndented = head(entries).map(isIndented).getOr(false);
1393
- return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries);
1394
- });
1395
- };
1396
- var indentSelectedEntries = function (entries, indentation) {
1397
- each(filter(entries, isSelected), function (entry) {
1398
- return indentEntry(indentation, entry);
1399
- });
1400
- };
1401
- var getItemSelection = function (editor) {
1402
- var selectedListItems = map(getSelectedListItems(editor), SugarElement.fromDom);
1403
- return lift2(find(selectedListItems, not(hasFirstChildList)), find(reverse(selectedListItems), not(hasFirstChildList)), function (start, end) {
1404
- return {
1405
- start: start,
1406
- end: end
1407
- };
1408
- });
1409
- };
1410
- var listIndentation = function (editor, lists, indentation) {
1411
- var entrySets = parseLists(lists, getItemSelection(editor));
1412
- each(entrySets, function (entrySet) {
1142
+ const composeEntries = (editor, entries) => bind(groupBy(entries, isIndented), entries => {
1143
+ const groupIsIndented = head(entries).exists(isIndented);
1144
+ return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries);
1145
+ });
1146
+ const indentSelectedEntries = (entries, indentation) => {
1147
+ each$1(filter$1(entries, isSelected), entry => indentEntry(indentation, entry));
1148
+ };
1149
+ const getItemSelection = editor => {
1150
+ const selectedListItems = map(getSelectedListItems(editor), SugarElement.fromDom);
1151
+ return lift2(find(selectedListItems, not(hasFirstChildList)), find(reverse(selectedListItems), not(hasFirstChildList)), (start, end) => ({
1152
+ start,
1153
+ end
1154
+ }));
1155
+ };
1156
+ const listIndentation = (editor, lists, indentation) => {
1157
+ const entrySets = parseLists(lists, getItemSelection(editor));
1158
+ each$1(entrySets, entrySet => {
1413
1159
  indentSelectedEntries(entrySet.entries, indentation);
1414
- var composedLists = composeEntries(editor, entrySet.entries);
1415
- each(composedLists, function (composedList) {
1160
+ const composedLists = composeEntries(editor, entrySet.entries);
1161
+ each$1(composedLists, composedList => {
1416
1162
  fireListEvent(editor, indentation === 'Indent' ? 'IndentList' : 'OutdentList', composedList.dom);
1417
1163
  });
1418
- before$1(entrySet.sourceList, composedLists);
1164
+ before(entrySet.sourceList, composedLists);
1419
1165
  remove(entrySet.sourceList);
1420
1166
  });
1421
1167
  };
1422
1168
 
1423
- var selectionIndentation = function (editor, indentation) {
1424
- var lists = map(getSelectedListRoots(editor), SugarElement.fromDom);
1425
- var dlItems = map(getSelectedDlItems(editor), SugarElement.fromDom);
1426
- var isHandled = false;
1169
+ const selectionIndentation = (editor, indentation) => {
1170
+ const lists = fromDom(getSelectedListRoots(editor));
1171
+ const dlItems = fromDom(getSelectedDlItems(editor));
1172
+ let isHandled = false;
1427
1173
  if (lists.length || dlItems.length) {
1428
- var bookmark = editor.selection.getBookmark();
1174
+ const bookmark = editor.selection.getBookmark();
1429
1175
  listIndentation(editor, lists, indentation);
1430
1176
  dlIndentation(editor, indentation, dlItems);
1431
1177
  editor.selection.moveToBookmark(bookmark);
@@ -1435,27 +1181,28 @@
1435
1181
  }
1436
1182
  return isHandled;
1437
1183
  };
1438
- var indentListSelection = function (editor) {
1439
- return selectionIndentation(editor, 'Indent');
1440
- };
1441
- var outdentListSelection = function (editor) {
1442
- return selectionIndentation(editor, 'Outdent');
1443
- };
1444
- var flattenListSelection = function (editor) {
1445
- return selectionIndentation(editor, 'Flatten');
1446
- };
1184
+ const handleIndentation = (editor, indentation) => !selectionIsWithinNonEditableList(editor) && selectionIndentation(editor, indentation);
1185
+ const indentListSelection = editor => handleIndentation(editor, 'Indent');
1186
+ const outdentListSelection = editor => handleIndentation(editor, 'Outdent');
1187
+ const flattenListSelection = editor => handleIndentation(editor, 'Flatten');
1188
+
1189
+ const zeroWidth = '\uFEFF';
1190
+ const isZwsp = char => char === zeroWidth;
1447
1191
 
1448
- var global$7 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
1192
+ const ancestor$1 = (scope, predicate, isRoot) => ancestor$3(scope, predicate, isRoot).isSome();
1449
1193
 
1450
- var DOM$1 = global$4.DOM;
1451
- var createBookmark = function (rng) {
1452
- var bookmark = {};
1453
- var setupEndPoint = function (start) {
1454
- var offsetNode, container, offset;
1455
- container = rng[start ? 'startContainer' : 'endContainer'];
1456
- offset = rng[start ? 'startOffset' : 'endOffset'];
1457
- if (container.nodeType === 1) {
1458
- offsetNode = DOM$1.create('span', { 'data-mce-type': 'bookmark' });
1194
+ const ancestor = (element, target) => ancestor$1(element, curry(eq, target));
1195
+
1196
+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
1197
+
1198
+ const DOM$1 = global$3.DOM;
1199
+ const createBookmark = rng => {
1200
+ const bookmark = {};
1201
+ const setupEndPoint = start => {
1202
+ let container = rng[start ? 'startContainer' : 'endContainer'];
1203
+ let offset = rng[start ? 'startOffset' : 'endOffset'];
1204
+ if (isElement(container)) {
1205
+ const offsetNode = DOM$1.create('span', { 'data-mce-type': 'bookmark' });
1459
1206
  if (container.hasChildNodes()) {
1460
1207
  offset = Math.min(offset, container.childNodes.length - 1);
1461
1208
  if (start) {
@@ -1478,28 +1225,30 @@
1478
1225
  }
1479
1226
  return bookmark;
1480
1227
  };
1481
- var resolveBookmark = function (bookmark) {
1482
- var restoreEndPoint = function (start) {
1483
- var container, offset, node;
1484
- var nodeIndex = function (container) {
1485
- var node = container.parentNode.firstChild, idx = 0;
1228
+ const resolveBookmark = bookmark => {
1229
+ const restoreEndPoint = start => {
1230
+ const nodeIndex = container => {
1231
+ var _a;
1232
+ let node = (_a = container.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild;
1233
+ let idx = 0;
1486
1234
  while (node) {
1487
1235
  if (node === container) {
1488
1236
  return idx;
1489
1237
  }
1490
- if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
1238
+ if (!isElement(node) || node.getAttribute('data-mce-type') !== 'bookmark') {
1491
1239
  idx++;
1492
1240
  }
1493
1241
  node = node.nextSibling;
1494
1242
  }
1495
1243
  return -1;
1496
1244
  };
1497
- container = node = bookmark[start ? 'startContainer' : 'endContainer'];
1498
- offset = bookmark[start ? 'startOffset' : 'endOffset'];
1245
+ let container = bookmark[start ? 'startContainer' : 'endContainer'];
1246
+ let offset = bookmark[start ? 'startOffset' : 'endOffset'];
1499
1247
  if (!container) {
1500
1248
  return;
1501
1249
  }
1502
- if (container.nodeType === 1) {
1250
+ if (isElement(container) && container.parentNode) {
1251
+ const node = container;
1503
1252
  offset = nodeIndex(container);
1504
1253
  container = container.parentNode;
1505
1254
  DOM$1.remove(node);
@@ -1512,7 +1261,7 @@
1512
1261
  };
1513
1262
  restoreEndPoint(true);
1514
1263
  restoreEndPoint();
1515
- var rng = DOM$1.createRng();
1264
+ const rng = DOM$1.createRng();
1516
1265
  rng.setStart(bookmark.startContainer, bookmark.startOffset);
1517
1266
  if (bookmark.endContainer) {
1518
1267
  rng.setEnd(bookmark.endContainer, bookmark.endOffset);
@@ -1520,7 +1269,7 @@
1520
1269
  return normalizeRange(rng);
1521
1270
  };
1522
1271
 
1523
- var listToggleActionFromListName = function (listName) {
1272
+ const listToggleActionFromListName = listName => {
1524
1273
  switch (listName) {
1525
1274
  case 'UL':
1526
1275
  return 'ToggleUlList';
@@ -1531,82 +1280,107 @@
1531
1280
  }
1532
1281
  };
1533
1282
 
1534
- var isCustomList = function (list) {
1535
- return /\btox\-/.test(list.className);
1536
- };
1537
- var listState = function (editor, listName, activate) {
1538
- var nodeChangeHandler = function (e) {
1539
- var inList = findUntil(e.parents, isListNode, isTableCellNode).filter(function (list) {
1540
- return list.nodeName === listName && !isCustomList(list);
1541
- }).isSome();
1542
- activate(inList);
1543
- };
1544
- var parents = editor.dom.getParents(editor.selection.getNode());
1545
- nodeChangeHandler({ parents: parents });
1546
- editor.on('NodeChange', nodeChangeHandler);
1547
- return function () {
1548
- return editor.off('NodeChange', nodeChangeHandler);
1549
- };
1550
- };
1551
-
1552
- var updateListStyle = function (dom, el, detail) {
1553
- var type = detail['list-style-type'] ? detail['list-style-type'] : null;
1283
+ const updateListStyle = (dom, el, detail) => {
1284
+ const type = detail['list-style-type'] ? detail['list-style-type'] : null;
1554
1285
  dom.setStyle(el, 'list-style-type', type);
1555
1286
  };
1556
- var setAttribs = function (elm, attrs) {
1557
- global$5.each(attrs, function (value, key) {
1287
+ const setAttribs = (elm, attrs) => {
1288
+ global$2.each(attrs, (value, key) => {
1558
1289
  elm.setAttribute(key, value);
1559
1290
  });
1560
1291
  };
1561
- var updateListAttrs = function (dom, el, detail) {
1292
+ const updateListAttrs = (dom, el, detail) => {
1562
1293
  setAttribs(el, detail['list-attributes']);
1563
- global$5.each(dom.select('li', el), function (li) {
1294
+ global$2.each(dom.select('li', el), li => {
1564
1295
  setAttribs(li, detail['list-item-attributes']);
1565
1296
  });
1566
1297
  };
1567
- var updateListWithDetails = function (dom, el, detail) {
1298
+ const updateListWithDetails = (dom, el, detail) => {
1568
1299
  updateListStyle(dom, el, detail);
1569
1300
  updateListAttrs(dom, el, detail);
1570
1301
  };
1571
- var removeStyles = function (dom, element, styles) {
1572
- global$5.each(styles, function (style) {
1573
- var _a;
1574
- return dom.setStyle(element, (_a = {}, _a[style] = '', _a));
1575
- });
1302
+ const removeStyles = (dom, element, styles) => {
1303
+ global$2.each(styles, style => dom.setStyle(element, style, ''));
1576
1304
  };
1577
- var getEndPointNode = function (editor, rng, start, root) {
1578
- var container = rng[start ? 'startContainer' : 'endContainer'];
1579
- var offset = rng[start ? 'startOffset' : 'endOffset'];
1580
- if (container.nodeType === 1) {
1305
+ const isInline = (editor, node) => isNonNullable(node) && !isBlock(node, editor.schema.getBlockElements());
1306
+ const getEndPointNode = (editor, rng, start, root) => {
1307
+ let container = rng[start ? 'startContainer' : 'endContainer'];
1308
+ const offset = rng[start ? 'startOffset' : 'endOffset'];
1309
+ if (isElement(container)) {
1581
1310
  container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
1582
1311
  }
1583
1312
  if (!start && isBr(container.nextSibling)) {
1584
1313
  container = container.nextSibling;
1585
1314
  }
1315
+ const findBlockAncestor = node => {
1316
+ while (!editor.dom.isBlock(node) && node.parentNode && root !== node) {
1317
+ node = node.parentNode;
1318
+ }
1319
+ return node;
1320
+ };
1321
+ const findBetterContainer = (container, forward) => {
1322
+ var _a;
1323
+ const walker = new global$5(container, findBlockAncestor(container));
1324
+ const dir = forward ? 'next' : 'prev';
1325
+ let node;
1326
+ while (node = walker[dir]()) {
1327
+ if (!(isVoid(editor, node) || isZwsp(node.textContent) || ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length) === 0)) {
1328
+ return Optional.some(node);
1329
+ }
1330
+ }
1331
+ return Optional.none();
1332
+ };
1333
+ if (start && isTextNode$1(container)) {
1334
+ if (isZwsp(container.textContent)) {
1335
+ container = findBetterContainer(container, false).getOr(container);
1336
+ } else {
1337
+ if (container.parentNode !== null && isInline(editor, container.parentNode)) {
1338
+ container = container.parentNode;
1339
+ }
1340
+ while (container.previousSibling !== null && (isInline(editor, container.previousSibling) || isTextNode$1(container.previousSibling))) {
1341
+ container = container.previousSibling;
1342
+ }
1343
+ }
1344
+ }
1345
+ if (!start && isTextNode$1(container)) {
1346
+ if (isZwsp(container.textContent)) {
1347
+ container = findBetterContainer(container, true).getOr(container);
1348
+ } else {
1349
+ if (container.parentNode !== null && isInline(editor, container.parentNode)) {
1350
+ container = container.parentNode;
1351
+ }
1352
+ while (container.nextSibling !== null && (isInline(editor, container.nextSibling) || isTextNode$1(container.nextSibling))) {
1353
+ container = container.nextSibling;
1354
+ }
1355
+ }
1356
+ }
1586
1357
  while (container.parentNode !== root) {
1358
+ const parent = container.parentNode;
1587
1359
  if (isTextBlock(editor, container)) {
1588
1360
  return container;
1589
1361
  }
1590
- if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
1362
+ if (/^(TD|TH)$/.test(parent.nodeName)) {
1591
1363
  return container;
1592
1364
  }
1593
- container = container.parentNode;
1365
+ container = parent;
1594
1366
  }
1595
1367
  return container;
1596
1368
  };
1597
- var getSelectedTextBlocks = function (editor, rng, root) {
1598
- var textBlocks = [], dom = editor.dom;
1599
- var startNode = getEndPointNode(editor, rng, true, root);
1600
- var endNode = getEndPointNode(editor, rng, false, root);
1601
- var block;
1602
- var siblings = [];
1603
- for (var node = startNode; node; node = node.nextSibling) {
1369
+ const getSelectedTextBlocks = (editor, rng, root) => {
1370
+ const textBlocks = [];
1371
+ const dom = editor.dom;
1372
+ const startNode = getEndPointNode(editor, rng, true, root);
1373
+ const endNode = getEndPointNode(editor, rng, false, root);
1374
+ let block;
1375
+ const siblings = [];
1376
+ for (let node = startNode; node; node = node.nextSibling) {
1604
1377
  siblings.push(node);
1605
1378
  if (node === endNode) {
1606
1379
  break;
1607
1380
  }
1608
1381
  }
1609
- global$5.each(siblings, function (node) {
1382
+ global$2.each(siblings, node => {
1383
+ var _a;
1610
1384
  if (isTextBlock(editor, node)) {
1611
1385
  textBlocks.push(node);
1612
1386
  block = null;
@@ -1619,8 +1393,8 @@
1619
1393
  block = null;
1620
1394
  return;
1621
1395
  }
1622
- var nextSibling = node.nextSibling;
1623
- if (global$7.isBookmarkNode(node)) {
1396
+ const nextSibling = node.nextSibling;
1397
+ if (global$1.isBookmarkNode(node)) {
1624
1398
  if (isListNode(nextSibling) || isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
1625
1399
  block = null;
1626
1400
  return;
@@ -1628,24 +1402,33 @@
1628
1402
  }
1629
1403
  if (!block) {
1630
1404
  block = dom.create('p');
1631
- node.parentNode.insertBefore(block, node);
1405
+ (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(block, node);
1632
1406
  textBlocks.push(block);
1633
1407
  }
1634
1408
  block.appendChild(node);
1635
1409
  });
1636
1410
  return textBlocks;
1637
1411
  };
1638
- var hasCompatibleStyle = function (dom, sib, detail) {
1639
- var sibStyle = dom.getStyle(sib, 'list-style-type');
1640
- var detailStyle = detail ? detail['list-style-type'] : '';
1412
+ const hasCompatibleStyle = (dom, sib, detail) => {
1413
+ const sibStyle = dom.getStyle(sib, 'list-style-type');
1414
+ let detailStyle = detail ? detail['list-style-type'] : '';
1641
1415
  detailStyle = detailStyle === null ? '' : detailStyle;
1642
1416
  return sibStyle === detailStyle;
1643
1417
  };
1644
- var applyList = function (editor, listName, detail) {
1645
- var rng = editor.selection.getRng();
1646
- var listItemName = 'LI';
1647
- var root = getClosestListRootElm(editor, editor.selection.getStart(true));
1648
- var dom = editor.dom;
1418
+ const getRootSearchStart = (editor, range) => {
1419
+ const start = editor.selection.getStart(true);
1420
+ const startPoint = getEndPointNode(editor, range, true, editor.getBody());
1421
+ if (ancestor(SugarElement.fromDom(startPoint), SugarElement.fromDom(range.commonAncestorContainer))) {
1422
+ return range.commonAncestorContainer;
1423
+ } else {
1424
+ return start;
1425
+ }
1426
+ };
1427
+ const applyList = (editor, listName, detail) => {
1428
+ const rng = editor.selection.getRng();
1429
+ let listItemName = 'LI';
1430
+ const root = getClosestListHost(editor, getRootSearchStart(editor, rng));
1431
+ const dom = editor.dom;
1649
1432
  if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
1650
1433
  return;
1651
1434
  }
@@ -1653,12 +1436,12 @@
1653
1436
  if (listName === 'DL') {
1654
1437
  listItemName = 'DT';
1655
1438
  }
1656
- var bookmark = createBookmark(rng);
1657
- var selectedTextBlocks = getSelectedTextBlocks(editor, rng, root);
1658
- global$5.each(selectedTextBlocks, function (block) {
1659
- var listBlock;
1660
- var sibling = block.previousSibling;
1661
- var parent = block.parentNode;
1439
+ const bookmark = createBookmark(rng);
1440
+ const selectedTextBlocks = filter$1(getSelectedTextBlocks(editor, rng, root), editor.dom.isEditable);
1441
+ global$2.each(selectedTextBlocks, block => {
1442
+ let listBlock;
1443
+ const sibling = block.previousSibling;
1444
+ const parent = block.parentNode;
1662
1445
  if (!isListItemNode(parent)) {
1663
1446
  if (sibling && isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
1664
1447
  listBlock = sibling;
@@ -1666,7 +1449,7 @@
1666
1449
  sibling.appendChild(block);
1667
1450
  } else {
1668
1451
  listBlock = dom.create(listName);
1669
- block.parentNode.insertBefore(listBlock, block);
1452
+ parent.insertBefore(listBlock, block);
1670
1453
  listBlock.appendChild(block);
1671
1454
  block = dom.rename(block, listItemName);
1672
1455
  }
@@ -1688,40 +1471,60 @@
1688
1471
  });
1689
1472
  editor.selection.setRng(resolveBookmark(bookmark));
1690
1473
  };
1691
- var isValidLists = function (list1, list2) {
1692
- return list1 && list2 && isListNode(list1) && list1.nodeName === list2.nodeName;
1474
+ const isValidLists = (list1, list2) => {
1475
+ return isListNode(list1) && list1.nodeName === (list2 === null || list2 === void 0 ? void 0 : list2.nodeName);
1693
1476
  };
1694
- var hasSameListStyle = function (dom, list1, list2) {
1695
- var targetStyle = dom.getStyle(list1, 'list-style-type', true);
1696
- var style = dom.getStyle(list2, 'list-style-type', true);
1477
+ const hasSameListStyle = (dom, list1, list2) => {
1478
+ const targetStyle = dom.getStyle(list1, 'list-style-type', true);
1479
+ const style = dom.getStyle(list2, 'list-style-type', true);
1697
1480
  return targetStyle === style;
1698
1481
  };
1699
- var hasSameClasses = function (elm1, elm2) {
1482
+ const hasSameClasses = (elm1, elm2) => {
1700
1483
  return elm1.className === elm2.className;
1701
1484
  };
1702
- var shouldMerge = function (dom, list1, list2) {
1485
+ const shouldMerge = (dom, list1, list2) => {
1703
1486
  return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
1704
1487
  };
1705
- var mergeWithAdjacentLists = function (dom, listBlock) {
1706
- var sibling, node;
1707
- sibling = listBlock.nextSibling;
1488
+ const mergeWithAdjacentLists = (dom, listBlock) => {
1489
+ let node;
1490
+ let sibling = listBlock.nextSibling;
1708
1491
  if (shouldMerge(dom, listBlock, sibling)) {
1709
- while (node = sibling.firstChild) {
1492
+ const liSibling = sibling;
1493
+ while (node = liSibling.firstChild) {
1710
1494
  listBlock.appendChild(node);
1711
1495
  }
1712
- dom.remove(sibling);
1496
+ dom.remove(liSibling);
1713
1497
  }
1714
1498
  sibling = listBlock.previousSibling;
1715
1499
  if (shouldMerge(dom, listBlock, sibling)) {
1716
- while (node = sibling.lastChild) {
1500
+ const liSibling = sibling;
1501
+ while (node = liSibling.lastChild) {
1717
1502
  listBlock.insertBefore(node, listBlock.firstChild);
1718
1503
  }
1719
- dom.remove(sibling);
1504
+ dom.remove(liSibling);
1505
+ }
1506
+ };
1507
+ const updateList$1 = (editor, list, listName, detail) => {
1508
+ if (list.nodeName !== listName) {
1509
+ const newList = editor.dom.rename(list, listName);
1510
+ updateListWithDetails(editor.dom, newList, detail);
1511
+ fireListEvent(editor, listToggleActionFromListName(listName), newList);
1512
+ } else {
1513
+ updateListWithDetails(editor.dom, list, detail);
1514
+ fireListEvent(editor, listToggleActionFromListName(listName), list);
1720
1515
  }
1721
1516
  };
1722
- var updateList = function (editor, list, listName, detail) {
1517
+ const updateCustomList = (editor, list, listName, detail) => {
1518
+ list.classList.forEach((cls, _, classList) => {
1519
+ if (cls.startsWith('tox-')) {
1520
+ classList.remove(cls);
1521
+ if (classList.length === 0) {
1522
+ list.removeAttribute('class');
1523
+ }
1524
+ }
1525
+ });
1723
1526
  if (list.nodeName !== listName) {
1724
- var newList = editor.dom.rename(list, listName);
1527
+ const newList = editor.dom.rename(list, listName);
1725
1528
  updateListWithDetails(editor.dom, newList, detail);
1726
1529
  fireListEvent(editor, listToggleActionFromListName(listName), newList);
1727
1530
  } else {
@@ -1729,24 +1532,28 @@
1729
1532
  fireListEvent(editor, listToggleActionFromListName(listName), list);
1730
1533
  }
1731
1534
  };
1732
- var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
1733
- var parentIsList = isListNode(parentList);
1734
- if (parentIsList && parentList.nodeName === listName && !hasListStyleDetail(detail)) {
1535
+ const toggleMultipleLists = (editor, parentList, lists, listName, detail) => {
1536
+ const parentIsList = isListNode(parentList);
1537
+ if (parentIsList && parentList.nodeName === listName && !hasListStyleDetail(detail) && !isCustomList(parentList)) {
1735
1538
  flattenListSelection(editor);
1736
1539
  } else {
1737
1540
  applyList(editor, listName, detail);
1738
- var bookmark = createBookmark(editor.selection.getRng(true));
1739
- var allLists = parentIsList ? __spreadArrays([parentList], lists) : lists;
1740
- global$5.each(allLists, function (elm) {
1741
- updateList(editor, elm, listName, detail);
1541
+ const bookmark = createBookmark(editor.selection.getRng());
1542
+ const allLists = parentIsList ? [
1543
+ parentList,
1544
+ ...lists
1545
+ ] : lists;
1546
+ const updateFunction = parentIsList && isCustomList(parentList) ? updateCustomList : updateList$1;
1547
+ global$2.each(allLists, elm => {
1548
+ updateFunction(editor, elm, listName, detail);
1742
1549
  });
1743
1550
  editor.selection.setRng(resolveBookmark(bookmark));
1744
1551
  }
1745
1552
  };
1746
- var hasListStyleDetail = function (detail) {
1553
+ const hasListStyleDetail = detail => {
1747
1554
  return 'list-style-type' in detail;
1748
1555
  };
1749
- var toggleSingleList = function (editor, parentList, listName, detail) {
1556
+ const toggleSingleList = (editor, parentList, listName, detail) => {
1750
1557
  if (parentList === editor.getBody()) {
1751
1558
  return;
1752
1559
  }
@@ -1754,9 +1561,19 @@
1754
1561
  if (parentList.nodeName === listName && !hasListStyleDetail(detail) && !isCustomList(parentList)) {
1755
1562
  flattenListSelection(editor);
1756
1563
  } else {
1757
- var bookmark = createBookmark(editor.selection.getRng(true));
1564
+ const bookmark = createBookmark(editor.selection.getRng());
1565
+ if (isCustomList(parentList)) {
1566
+ parentList.classList.forEach((cls, _, classList) => {
1567
+ if (cls.startsWith('tox-')) {
1568
+ classList.remove(cls);
1569
+ if (classList.length === 0) {
1570
+ parentList.removeAttribute('class');
1571
+ }
1572
+ }
1573
+ });
1574
+ }
1758
1575
  updateListWithDetails(editor.dom, parentList, detail);
1759
- var newList = editor.dom.rename(parentList, listName);
1576
+ const newList = editor.dom.rename(parentList, listName);
1760
1577
  mergeWithAdjacentLists(editor.dom, newList);
1761
1578
  editor.selection.setRng(resolveBookmark(bookmark));
1762
1579
  applyList(editor, listName, detail);
@@ -1767,10 +1584,13 @@
1767
1584
  fireListEvent(editor, listToggleActionFromListName(listName), parentList);
1768
1585
  }
1769
1586
  };
1770
- var toggleList = function (editor, listName, _detail) {
1771
- var parentList = getParentList(editor);
1772
- var selectedSubLists = getSelectedSubLists(editor);
1773
- var detail = isObject(_detail) ? _detail : {};
1587
+ const toggleList = (editor, listName, _detail) => {
1588
+ const parentList = getParentList(editor);
1589
+ if (isWithinNonEditableList(editor, parentList)) {
1590
+ return;
1591
+ }
1592
+ const selectedSubLists = getSelectedSubLists(editor);
1593
+ const detail = isObject(_detail) ? _detail : {};
1774
1594
  if (selectedSubLists.length > 0) {
1775
1595
  toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
1776
1596
  } else {
@@ -1778,84 +1598,87 @@
1778
1598
  }
1779
1599
  };
1780
1600
 
1781
- var DOM$2 = global$4.DOM;
1782
- var normalizeList = function (dom, ul) {
1783
- var sibling;
1784
- var parentNode = ul.parentNode;
1785
- if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
1786
- sibling = parentNode.previousSibling;
1601
+ const DOM = global$3.DOM;
1602
+ const normalizeList = (dom, list) => {
1603
+ const parentNode = list.parentElement;
1604
+ if (parentNode && parentNode.nodeName === 'LI' && parentNode.firstChild === list) {
1605
+ const sibling = parentNode.previousSibling;
1787
1606
  if (sibling && sibling.nodeName === 'LI') {
1788
- sibling.appendChild(ul);
1789
- if (isEmpty$1(dom, parentNode)) {
1790
- DOM$2.remove(parentNode);
1607
+ sibling.appendChild(list);
1608
+ if (isEmpty$2(dom, parentNode)) {
1609
+ DOM.remove(parentNode);
1791
1610
  }
1792
1611
  } else {
1793
- DOM$2.setStyle(parentNode, 'listStyleType', 'none');
1612
+ DOM.setStyle(parentNode, 'listStyleType', 'none');
1794
1613
  }
1795
1614
  }
1796
1615
  if (isListNode(parentNode)) {
1797
- sibling = parentNode.previousSibling;
1616
+ const sibling = parentNode.previousSibling;
1798
1617
  if (sibling && sibling.nodeName === 'LI') {
1799
- sibling.appendChild(ul);
1618
+ sibling.appendChild(list);
1800
1619
  }
1801
1620
  }
1802
1621
  };
1803
- var normalizeLists = function (dom, element) {
1804
- global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) {
1805
- normalizeList(dom, ul);
1622
+ const normalizeLists = (dom, element) => {
1623
+ const lists = global$2.grep(dom.select('ol,ul', element));
1624
+ global$2.each(lists, list => {
1625
+ normalizeList(dom, list);
1806
1626
  });
1807
1627
  };
1808
1628
 
1809
- var findNextCaretContainer = function (editor, rng, isForward, root) {
1810
- var node = rng.startContainer;
1811
- var offset = rng.startOffset;
1812
- if (isTextNode(node) && (isForward ? offset < node.data.length : offset > 0)) {
1629
+ const findNextCaretContainer = (editor, rng, isForward, root) => {
1630
+ let node = rng.startContainer;
1631
+ const offset = rng.startOffset;
1632
+ if (isTextNode$1(node) && (isForward ? offset < node.data.length : offset > 0)) {
1813
1633
  return node;
1814
1634
  }
1815
- var nonEmptyBlocks = editor.schema.getNonEmptyElements();
1816
- if (node.nodeType === 1) {
1817
- node = global$1.getNode(node, offset);
1635
+ const nonEmptyBlocks = editor.schema.getNonEmptyElements();
1636
+ if (isElement(node)) {
1637
+ node = global$6.getNode(node, offset);
1818
1638
  }
1819
- var walker = new global$2(node, root);
1639
+ const walker = new global$5(node, root);
1820
1640
  if (isForward) {
1821
1641
  if (isBogusBr(editor.dom, node)) {
1822
1642
  walker.next();
1823
1643
  }
1824
1644
  }
1825
- while (node = walker[isForward ? 'next' : 'prev2']()) {
1645
+ const walkFn = isForward ? walker.next.bind(walker) : walker.prev2.bind(walker);
1646
+ while (node = walkFn()) {
1826
1647
  if (node.nodeName === 'LI' && !node.hasChildNodes()) {
1827
1648
  return node;
1828
1649
  }
1829
1650
  if (nonEmptyBlocks[node.nodeName]) {
1830
1651
  return node;
1831
1652
  }
1832
- if (isTextNode(node) && node.data.length > 0) {
1653
+ if (isTextNode$1(node) && node.data.length > 0) {
1833
1654
  return node;
1834
1655
  }
1835
1656
  }
1657
+ return null;
1836
1658
  };
1837
- var hasOnlyOneBlockChild = function (dom, elm) {
1838
- var childNodes = elm.childNodes;
1659
+ const hasOnlyOneBlockChild = (dom, elm) => {
1660
+ const childNodes = elm.childNodes;
1839
1661
  return childNodes.length === 1 && !isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
1840
1662
  };
1841
- var unwrapSingleBlockChild = function (dom, elm) {
1842
- if (hasOnlyOneBlockChild(dom, elm)) {
1663
+ const isUnwrappable = node => Optional.from(node).map(SugarElement.fromDom).filter(isHTMLElement).exists(el => isEditable(el) && !contains$1(['details'], name(el)));
1664
+ const unwrapSingleBlockChild = (dom, elm) => {
1665
+ if (hasOnlyOneBlockChild(dom, elm) && isUnwrappable(elm.firstChild)) {
1843
1666
  dom.remove(elm.firstChild, true);
1844
1667
  }
1845
1668
  };
1846
- var moveChildren = function (dom, fromElm, toElm) {
1847
- var node;
1848
- var targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
1669
+ const moveChildren = (dom, fromElm, toElm) => {
1670
+ let node;
1671
+ const targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
1849
1672
  unwrapSingleBlockChild(dom, fromElm);
1850
- if (!isEmpty$1(dom, fromElm, true)) {
1673
+ if (!isEmpty$2(dom, fromElm, true)) {
1851
1674
  while (node = fromElm.firstChild) {
1852
1675
  targetElm.appendChild(node);
1853
1676
  }
1854
1677
  }
1855
1678
  };
1856
- var mergeLiElements = function (dom, fromElm, toElm) {
1857
- var listNode;
1858
- var ul = fromElm.parentNode;
1679
+ const mergeLiElements = (dom, fromElm, toElm) => {
1680
+ let listNode;
1681
+ const ul = fromElm.parentNode;
1859
1682
  if (!isChildOfBody(dom, fromElm) || !isChildOfBody(dom, toElm)) {
1860
1683
  return;
1861
1684
  }
@@ -1867,75 +1690,88 @@
1867
1690
  dom.remove(ul.previousSibling);
1868
1691
  }
1869
1692
  }
1870
- var node = toElm.lastChild;
1693
+ const node = toElm.lastChild;
1871
1694
  if (node && isBr(node) && fromElm.hasChildNodes()) {
1872
1695
  dom.remove(node);
1873
1696
  }
1874
- if (isEmpty$1(dom, toElm, true)) {
1875
- dom.$(toElm).empty();
1697
+ if (isEmpty$2(dom, toElm, true)) {
1698
+ empty(SugarElement.fromDom(toElm));
1876
1699
  }
1877
1700
  moveChildren(dom, fromElm, toElm);
1878
1701
  if (listNode) {
1879
1702
  toElm.appendChild(listNode);
1880
1703
  }
1881
- var contains = contains$1(SugarElement.fromDom(toElm), SugarElement.fromDom(fromElm));
1882
- var nestedLists = contains ? dom.getParents(fromElm, isListNode, toElm) : [];
1704
+ const contains$1 = contains(SugarElement.fromDom(toElm), SugarElement.fromDom(fromElm));
1705
+ const nestedLists = contains$1 ? dom.getParents(fromElm, isListNode, toElm) : [];
1883
1706
  dom.remove(fromElm);
1884
- each(nestedLists, function (list) {
1885
- if (isEmpty$1(dom, list) && list !== dom.getRoot()) {
1707
+ each$1(nestedLists, list => {
1708
+ if (isEmpty$2(dom, list) && list !== dom.getRoot()) {
1886
1709
  dom.remove(list);
1887
1710
  }
1888
1711
  });
1889
1712
  };
1890
- var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
1891
- editor.dom.$(toLi).empty();
1713
+ const mergeIntoEmptyLi = (editor, fromLi, toLi) => {
1714
+ empty(SugarElement.fromDom(toLi));
1892
1715
  mergeLiElements(editor.dom, fromLi, toLi);
1893
1716
  editor.selection.setCursorLocation(toLi, 0);
1894
1717
  };
1895
- var mergeForward = function (editor, rng, fromLi, toLi) {
1896
- var dom = editor.dom;
1718
+ const mergeForward = (editor, rng, fromLi, toLi) => {
1719
+ const dom = editor.dom;
1897
1720
  if (dom.isEmpty(toLi)) {
1898
1721
  mergeIntoEmptyLi(editor, fromLi, toLi);
1899
1722
  } else {
1900
- var bookmark = createBookmark(rng);
1723
+ const bookmark = createBookmark(rng);
1901
1724
  mergeLiElements(dom, fromLi, toLi);
1902
1725
  editor.selection.setRng(resolveBookmark(bookmark));
1903
1726
  }
1904
1727
  };
1905
- var mergeBackward = function (editor, rng, fromLi, toLi) {
1906
- var bookmark = createBookmark(rng);
1728
+ const mergeBackward = (editor, rng, fromLi, toLi) => {
1729
+ const bookmark = createBookmark(rng);
1907
1730
  mergeLiElements(editor.dom, fromLi, toLi);
1908
- var resolvedBookmark = resolveBookmark(bookmark);
1731
+ const resolvedBookmark = resolveBookmark(bookmark);
1909
1732
  editor.selection.setRng(resolvedBookmark);
1910
1733
  };
1911
- var backspaceDeleteFromListToListCaret = function (editor, isForward) {
1912
- var dom = editor.dom, selection = editor.selection;
1913
- var selectionStartElm = selection.getStart();
1914
- var root = getClosestListRootElm(editor, selectionStartElm);
1915
- var li = dom.getParent(selection.getStart(), 'LI', root);
1734
+ const backspaceDeleteFromListToListCaret = (editor, isForward) => {
1735
+ const dom = editor.dom, selection = editor.selection;
1736
+ const selectionStartElm = selection.getStart();
1737
+ const root = getClosestEditingHost(editor, selectionStartElm);
1738
+ const li = dom.getParent(selection.getStart(), 'LI', root);
1916
1739
  if (li) {
1917
- var ul = li.parentNode;
1918
- if (ul === editor.getBody() && isEmpty$1(dom, ul)) {
1740
+ const ul = li.parentElement;
1741
+ if (ul === editor.getBody() && isEmpty$2(dom, ul)) {
1919
1742
  return true;
1920
1743
  }
1921
- var rng_1 = normalizeRange(selection.getRng());
1922
- var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng_1, isForward, root), 'LI', root);
1923
- if (otherLi_1 && otherLi_1 !== li) {
1924
- editor.undoManager.transact(function () {
1744
+ const rng = normalizeRange(selection.getRng());
1745
+ const otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1746
+ const willMergeParentIntoChild = otherLi && (isForward ? dom.isChildOf(li, otherLi) : dom.isChildOf(otherLi, li));
1747
+ if (otherLi && otherLi !== li && !willMergeParentIntoChild) {
1748
+ editor.undoManager.transact(() => {
1925
1749
  if (isForward) {
1926
- mergeForward(editor, rng_1, otherLi_1, li);
1750
+ mergeForward(editor, rng, otherLi, li);
1927
1751
  } else {
1928
1752
  if (isFirstChild(li)) {
1929
1753
  outdentListSelection(editor);
1930
1754
  } else {
1931
- mergeBackward(editor, rng_1, li, otherLi_1);
1755
+ mergeBackward(editor, rng, li, otherLi);
1932
1756
  }
1933
1757
  }
1934
1758
  });
1935
1759
  return true;
1936
- } else if (!otherLi_1) {
1937
- if (!isForward && rng_1.startOffset === 0 && rng_1.endOffset === 0) {
1938
- editor.undoManager.transact(function () {
1760
+ } else if (willMergeParentIntoChild && !isForward && otherLi !== li) {
1761
+ editor.undoManager.transact(() => {
1762
+ if (rng.commonAncestorContainer.parentElement) {
1763
+ const bookmark = createBookmark(rng);
1764
+ const oldParentElRef = rng.commonAncestorContainer.parentElement;
1765
+ moveChildren(dom, rng.commonAncestorContainer.parentElement, otherLi);
1766
+ oldParentElRef.remove();
1767
+ const resolvedBookmark = resolveBookmark(bookmark);
1768
+ editor.selection.setRng(resolvedBookmark);
1769
+ }
1770
+ });
1771
+ return true;
1772
+ } else if (!otherLi) {
1773
+ if (!isForward && rng.startOffset === 0 && rng.endOffset === 0) {
1774
+ editor.undoManager.transact(() => {
1939
1775
  flattenListSelection(editor);
1940
1776
  });
1941
1777
  return true;
@@ -1944,26 +1780,38 @@
1944
1780
  }
1945
1781
  return false;
1946
1782
  };
1947
- var removeBlock = function (dom, block, root) {
1948
- var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
1783
+ const removeBlock = (dom, block, root) => {
1784
+ const parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
1949
1785
  dom.remove(block);
1950
1786
  if (parentBlock && dom.isEmpty(parentBlock)) {
1951
1787
  dom.remove(parentBlock);
1952
1788
  }
1953
1789
  };
1954
- var backspaceDeleteIntoListCaret = function (editor, isForward) {
1955
- var dom = editor.dom;
1956
- var selectionStartElm = editor.selection.getStart();
1957
- var root = getClosestListRootElm(editor, selectionStartElm);
1958
- var block = dom.getParent(selectionStartElm, dom.isBlock, root);
1790
+ const backspaceDeleteIntoListCaret = (editor, isForward) => {
1791
+ const dom = editor.dom;
1792
+ const selectionStartElm = editor.selection.getStart();
1793
+ const root = getClosestEditingHost(editor, selectionStartElm);
1794
+ const block = dom.getParent(selectionStartElm, dom.isBlock, root);
1959
1795
  if (block && dom.isEmpty(block)) {
1960
- var rng = normalizeRange(editor.selection.getRng());
1961
- var otherLi_2 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1962
- if (otherLi_2) {
1963
- editor.undoManager.transact(function () {
1796
+ const rng = normalizeRange(editor.selection.getRng());
1797
+ const otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1798
+ if (otherLi) {
1799
+ const findValidElement = element => contains$1([
1800
+ 'td',
1801
+ 'th',
1802
+ 'caption'
1803
+ ], name(element));
1804
+ const findRoot = node => node.dom === root;
1805
+ const otherLiCell = closest$2(SugarElement.fromDom(otherLi), findValidElement, findRoot);
1806
+ const caretCell = closest$2(SugarElement.fromDom(rng.startContainer), findValidElement, findRoot);
1807
+ if (!equals(otherLiCell, caretCell, eq)) {
1808
+ return false;
1809
+ }
1810
+ editor.undoManager.transact(() => {
1811
+ const parentNode = otherLi.parentNode;
1964
1812
  removeBlock(dom, block, root);
1965
- mergeWithAdjacentLists(dom, otherLi_2.parentNode);
1966
- editor.selection.select(otherLi_2, true);
1813
+ mergeWithAdjacentLists(dom, parentNode);
1814
+ editor.selection.select(otherLi, true);
1967
1815
  editor.selection.collapse(isForward);
1968
1816
  });
1969
1817
  return true;
@@ -1971,15 +1819,18 @@
1971
1819
  }
1972
1820
  return false;
1973
1821
  };
1974
- var backspaceDeleteCaret = function (editor, isForward) {
1822
+ const backspaceDeleteCaret = (editor, isForward) => {
1975
1823
  return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
1976
1824
  };
1977
- var backspaceDeleteRange = function (editor) {
1978
- var selectionStartElm = editor.selection.getStart();
1979
- var root = getClosestListRootElm(editor, selectionStartElm);
1980
- var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
1981
- if (startListParent || getSelectedListItems(editor).length > 0) {
1982
- editor.undoManager.transact(function () {
1825
+ const hasListSelection = editor => {
1826
+ const selectionStartElm = editor.selection.getStart();
1827
+ const root = getClosestEditingHost(editor, selectionStartElm);
1828
+ const startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
1829
+ return startListParent || getSelectedListItems(editor).length > 0;
1830
+ };
1831
+ const backspaceDeleteRange = editor => {
1832
+ if (hasListSelection(editor)) {
1833
+ editor.undoManager.transact(() => {
1983
1834
  editor.execCommand('Delete');
1984
1835
  normalizeLists(editor.dom, editor.getBody());
1985
1836
  });
@@ -1987,16 +1838,23 @@
1987
1838
  }
1988
1839
  return false;
1989
1840
  };
1990
- var backspaceDelete = function (editor, isForward) {
1991
- return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
1841
+ const backspaceDelete = (editor, isForward) => {
1842
+ const selection = editor.selection;
1843
+ return !isWithinNonEditableList(editor, selection.getNode()) && (selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor));
1992
1844
  };
1993
- var setup = function (editor) {
1994
- editor.on('keydown', function (e) {
1995
- if (e.keyCode === global$3.BACKSPACE) {
1845
+ const setup$2 = editor => {
1846
+ editor.on('ExecCommand', e => {
1847
+ const cmd = e.command.toLowerCase();
1848
+ if ((cmd === 'delete' || cmd === 'forwarddelete') && hasListSelection(editor)) {
1849
+ normalizeLists(editor.dom, editor.getBody());
1850
+ }
1851
+ });
1852
+ editor.on('keydown', e => {
1853
+ if (e.keyCode === global$4.BACKSPACE) {
1996
1854
  if (backspaceDelete(editor, false)) {
1997
1855
  e.preventDefault();
1998
1856
  }
1999
- } else if (e.keyCode === global$3.DELETE) {
1857
+ } else if (e.keyCode === global$4.DELETE) {
2000
1858
  if (backspaceDelete(editor, true)) {
2001
1859
  e.preventDefault();
2002
1860
  }
@@ -2004,78 +1862,69 @@
2004
1862
  });
2005
1863
  };
2006
1864
 
2007
- var get$1 = function (editor) {
2008
- return {
2009
- backspaceDelete: function (isForward) {
2010
- backspaceDelete(editor, isForward);
2011
- }
2012
- };
2013
- };
1865
+ const get = editor => ({
1866
+ backspaceDelete: isForward => {
1867
+ backspaceDelete(editor, isForward);
1868
+ }
1869
+ });
2014
1870
 
2015
- var updateList$1 = function (editor, update) {
2016
- var parentList = getParentList(editor);
2017
- editor.undoManager.transact(function () {
1871
+ const updateList = (editor, update) => {
1872
+ const parentList = getParentList(editor);
1873
+ if (parentList === null || isWithinNonEditableList(editor, parentList)) {
1874
+ return;
1875
+ }
1876
+ editor.undoManager.transact(() => {
2018
1877
  if (isObject(update.styles)) {
2019
1878
  editor.dom.setStyles(parentList, update.styles);
2020
1879
  }
2021
1880
  if (isObject(update.attrs)) {
2022
- each$1(update.attrs, function (v, k) {
2023
- return editor.dom.setAttrib(parentList, k, v);
2024
- });
1881
+ each(update.attrs, (v, k) => editor.dom.setAttrib(parentList, k, v));
2025
1882
  }
2026
1883
  });
2027
1884
  };
2028
1885
 
2029
- var parseAlphabeticBase26 = function (str) {
2030
- var chars = reverse(trim(str).split(''));
2031
- var values = map(chars, function (char, i) {
2032
- var charValue = char.toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 1;
1886
+ const parseAlphabeticBase26 = str => {
1887
+ const chars = reverse(trim(str).split(''));
1888
+ const values = map(chars, (char, i) => {
1889
+ const charValue = char.toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 1;
2033
1890
  return Math.pow(26, i) * charValue;
2034
1891
  });
2035
- return foldl(values, function (sum, v) {
2036
- return sum + v;
2037
- }, 0);
1892
+ return foldl(values, (sum, v) => sum + v, 0);
2038
1893
  };
2039
- var composeAlphabeticBase26 = function (value) {
1894
+ const composeAlphabeticBase26 = value => {
2040
1895
  value--;
2041
1896
  if (value < 0) {
2042
1897
  return '';
2043
1898
  } else {
2044
- var remainder = value % 26;
2045
- var quotient = Math.floor(value / 26);
2046
- var rest = composeAlphabeticBase26(quotient);
2047
- var char = String.fromCharCode('A'.charCodeAt(0) + remainder);
1899
+ const remainder = value % 26;
1900
+ const quotient = Math.floor(value / 26);
1901
+ const rest = composeAlphabeticBase26(quotient);
1902
+ const char = String.fromCharCode('A'.charCodeAt(0) + remainder);
2048
1903
  return rest + char;
2049
1904
  }
2050
1905
  };
2051
- var isUppercase = function (str) {
2052
- return /^[A-Z]+$/.test(str);
2053
- };
2054
- var isLowercase = function (str) {
2055
- return /^[a-z]+$/.test(str);
2056
- };
2057
- var isNumeric = function (str) {
2058
- return /^[0-9]+$/.test(str);
2059
- };
2060
- var deduceListType = function (start) {
1906
+ const isUppercase = str => /^[A-Z]+$/.test(str);
1907
+ const isLowercase = str => /^[a-z]+$/.test(str);
1908
+ const isNumeric = str => /^[0-9]+$/.test(str);
1909
+ const deduceListType = start => {
2061
1910
  if (isNumeric(start)) {
2062
1911
  return 2;
2063
1912
  } else if (isUppercase(start)) {
2064
1913
  return 0;
2065
1914
  } else if (isLowercase(start)) {
2066
1915
  return 1;
2067
- } else if (isEmpty(start)) {
1916
+ } else if (isEmpty$1(start)) {
2068
1917
  return 3;
2069
1918
  } else {
2070
1919
  return 4;
2071
1920
  }
2072
1921
  };
2073
- var parseStartValue = function (start) {
1922
+ const parseStartValue = start => {
2074
1923
  switch (deduceListType(start)) {
2075
1924
  case 2:
2076
1925
  return Optional.some({
2077
1926
  listStyleType: Optional.none(),
2078
- start: start
1927
+ start
2079
1928
  });
2080
1929
  case 0:
2081
1930
  return Optional.some({
@@ -2096,20 +1945,20 @@
2096
1945
  return Optional.none();
2097
1946
  }
2098
1947
  };
2099
- var parseDetail = function (detail) {
2100
- var start = parseInt(detail.start, 10);
2101
- if (detail.listStyleType.is('upper-alpha')) {
1948
+ const parseDetail = detail => {
1949
+ const start = parseInt(detail.start, 10);
1950
+ if (is$2(detail.listStyleType, 'upper-alpha')) {
2102
1951
  return composeAlphabeticBase26(start);
2103
- } else if (detail.listStyleType.is('lower-alpha')) {
1952
+ } else if (is$2(detail.listStyleType, 'lower-alpha')) {
2104
1953
  return composeAlphabeticBase26(start).toLowerCase();
2105
1954
  } else {
2106
1955
  return detail.start;
2107
1956
  }
2108
1957
  };
2109
1958
 
2110
- var open = function (editor) {
2111
- var currentList = getParentList(editor);
2112
- if (!isOlNode(currentList)) {
1959
+ const open = editor => {
1960
+ const currentList = getParentList(editor);
1961
+ if (!isOlNode(currentList) || isWithinNonEditableList(editor, currentList)) {
2113
1962
  return;
2114
1963
  }
2115
1964
  editor.windowManager.open({
@@ -2126,7 +1975,7 @@
2126
1975
  initialData: {
2127
1976
  start: parseDetail({
2128
1977
  start: editor.dom.getAttrib(currentList, 'start', '1'),
2129
- listStyleType: Optional.some(editor.dom.getStyle(currentList, 'list-style-type'))
1978
+ listStyleType: Optional.from(editor.dom.getStyle(currentList, 'list-style-type'))
2130
1979
  })
2131
1980
  },
2132
1981
  buttons: [
@@ -2142,9 +1991,9 @@
2142
1991
  primary: true
2143
1992
  }
2144
1993
  ],
2145
- onSubmit: function (api) {
2146
- var data = api.getData();
2147
- parseStartValue(data.start).each(function (detail) {
1994
+ onSubmit: api => {
1995
+ const data = api.getData();
1996
+ parseStartValue(data.start).each(detail => {
2148
1997
  editor.execCommand('mceListUpdate', false, {
2149
1998
  attrs: { start: detail.start === '1' ? '' : detail.start },
2150
1999
  styles: { 'list-style-type': detail.listStyleType.getOr('') }
@@ -2155,42 +2004,40 @@
2155
2004
  });
2156
2005
  };
2157
2006
 
2158
- var queryListCommandState = function (editor, listName) {
2159
- return function () {
2160
- var parentList = getParentList(editor);
2161
- return parentList && parentList.nodeName === listName;
2162
- };
2007
+ const queryListCommandState = (editor, listName) => () => {
2008
+ const parentList = getParentList(editor);
2009
+ return isNonNullable(parentList) && parentList.nodeName === listName;
2163
2010
  };
2164
- var registerDialog = function (editor) {
2165
- editor.addCommand('mceListProps', function () {
2011
+ const registerDialog = editor => {
2012
+ editor.addCommand('mceListProps', () => {
2166
2013
  open(editor);
2167
2014
  });
2168
2015
  };
2169
- var register = function (editor) {
2170
- editor.on('BeforeExecCommand', function (e) {
2171
- var cmd = e.command.toLowerCase();
2016
+ const register$2 = editor => {
2017
+ editor.on('BeforeExecCommand', e => {
2018
+ const cmd = e.command.toLowerCase();
2172
2019
  if (cmd === 'indent') {
2173
2020
  indentListSelection(editor);
2174
2021
  } else if (cmd === 'outdent') {
2175
2022
  outdentListSelection(editor);
2176
2023
  }
2177
2024
  });
2178
- editor.addCommand('InsertUnorderedList', function (ui, detail) {
2025
+ editor.addCommand('InsertUnorderedList', (ui, detail) => {
2179
2026
  toggleList(editor, 'UL', detail);
2180
2027
  });
2181
- editor.addCommand('InsertOrderedList', function (ui, detail) {
2028
+ editor.addCommand('InsertOrderedList', (ui, detail) => {
2182
2029
  toggleList(editor, 'OL', detail);
2183
2030
  });
2184
- editor.addCommand('InsertDefinitionList', function (ui, detail) {
2031
+ editor.addCommand('InsertDefinitionList', (ui, detail) => {
2185
2032
  toggleList(editor, 'DL', detail);
2186
2033
  });
2187
- editor.addCommand('RemoveList', function () {
2034
+ editor.addCommand('RemoveList', () => {
2188
2035
  flattenListSelection(editor);
2189
2036
  });
2190
2037
  registerDialog(editor);
2191
- editor.addCommand('mceListUpdate', function (ui, detail) {
2038
+ editor.addCommand('mceListUpdate', (ui, detail) => {
2192
2039
  if (isObject(detail)) {
2193
- updateList$1(editor, detail);
2040
+ updateList(editor, detail);
2194
2041
  }
2195
2042
  });
2196
2043
  editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
@@ -2198,89 +2045,128 @@
2198
2045
  editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
2199
2046
  };
2200
2047
 
2201
- var setupTabKey = function (editor) {
2202
- editor.on('keydown', function (e) {
2203
- if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) {
2048
+ var global = tinymce.util.Tools.resolve('tinymce.html.Node');
2049
+
2050
+ const isTextNode = node => node.type === 3;
2051
+ const isEmpty = nodeBuffer => nodeBuffer.length === 0;
2052
+ const wrapInvalidChildren = list => {
2053
+ const insertListItem = (buffer, refNode) => {
2054
+ const li = global.create('li');
2055
+ each$1(buffer, node => li.append(node));
2056
+ if (refNode) {
2057
+ list.insert(li, refNode, true);
2058
+ } else {
2059
+ list.append(li);
2060
+ }
2061
+ };
2062
+ const reducer = (buffer, node) => {
2063
+ if (isTextNode(node)) {
2064
+ return [
2065
+ ...buffer,
2066
+ node
2067
+ ];
2068
+ } else if (!isEmpty(buffer) && !isTextNode(node)) {
2069
+ insertListItem(buffer, node);
2070
+ return [];
2071
+ } else {
2072
+ return buffer;
2073
+ }
2074
+ };
2075
+ const restBuffer = foldl(list.children(), reducer, []);
2076
+ if (!isEmpty(restBuffer)) {
2077
+ insertListItem(restBuffer);
2078
+ }
2079
+ };
2080
+ const setup$1 = editor => {
2081
+ editor.on('PreInit', () => {
2082
+ const {parser} = editor;
2083
+ parser.addNodeFilter('ul,ol', nodes => each$1(nodes, wrapInvalidChildren));
2084
+ });
2085
+ };
2086
+
2087
+ const setupTabKey = editor => {
2088
+ editor.on('keydown', e => {
2089
+ if (e.keyCode !== global$4.TAB || global$4.metaKeyPressed(e)) {
2204
2090
  return;
2205
2091
  }
2206
- editor.undoManager.transact(function () {
2092
+ editor.undoManager.transact(() => {
2207
2093
  if (e.shiftKey ? outdentListSelection(editor) : indentListSelection(editor)) {
2208
2094
  e.preventDefault();
2209
2095
  }
2210
2096
  });
2211
2097
  });
2212
2098
  };
2213
- var setup$1 = function (editor) {
2099
+ const setup = editor => {
2214
2100
  if (shouldIndentOnTab(editor)) {
2215
2101
  setupTabKey(editor);
2216
2102
  }
2217
- setup(editor);
2103
+ setup$2(editor);
2218
2104
  };
2219
2105
 
2220
- var register$1 = function (editor) {
2221
- var exec = function (command) {
2222
- return function () {
2223
- return editor.execCommand(command);
2224
- };
2106
+ const setupToggleButtonHandler = (editor, listName) => api => {
2107
+ const toggleButtonHandler = e => {
2108
+ api.setActive(inList(e.parents, listName));
2109
+ api.setEnabled(!isWithinNonEditableList(editor, e.element) && editor.selection.isEditable());
2225
2110
  };
2111
+ api.setEnabled(editor.selection.isEditable());
2112
+ return setNodeChangeHandler(editor, toggleButtonHandler);
2113
+ };
2114
+ const register$1 = editor => {
2115
+ const exec = command => () => editor.execCommand(command);
2226
2116
  if (!editor.hasPlugin('advlist')) {
2227
2117
  editor.ui.registry.addToggleButton('numlist', {
2228
2118
  icon: 'ordered-list',
2229
2119
  active: false,
2230
2120
  tooltip: 'Numbered list',
2231
2121
  onAction: exec('InsertOrderedList'),
2232
- onSetup: function (api) {
2233
- return listState(editor, 'OL', api.setActive);
2234
- }
2122
+ onSetup: setupToggleButtonHandler(editor, 'OL')
2235
2123
  });
2236
2124
  editor.ui.registry.addToggleButton('bullist', {
2237
2125
  icon: 'unordered-list',
2238
2126
  active: false,
2239
2127
  tooltip: 'Bullet list',
2240
2128
  onAction: exec('InsertUnorderedList'),
2241
- onSetup: function (api) {
2242
- return listState(editor, 'UL', api.setActive);
2243
- }
2129
+ onSetup: setupToggleButtonHandler(editor, 'UL')
2244
2130
  });
2245
2131
  }
2246
2132
  };
2247
2133
 
2248
- var register$2 = function (editor) {
2249
- var listProperties = {
2134
+ const setupMenuButtonHandler = (editor, listName) => api => {
2135
+ const menuButtonHandler = e => api.setEnabled(inList(e.parents, listName) && !isWithinNonEditableList(editor, e.element));
2136
+ return setNodeChangeHandler(editor, menuButtonHandler);
2137
+ };
2138
+ const register = editor => {
2139
+ const listProperties = {
2250
2140
  text: 'List properties...',
2251
2141
  icon: 'ordered-list',
2252
- onAction: function () {
2253
- return editor.execCommand('mceListProps');
2254
- },
2255
- onSetup: function (api) {
2256
- return listState(editor, 'OL', function (active) {
2257
- return api.setDisabled(!active);
2258
- });
2259
- }
2142
+ onAction: () => editor.execCommand('mceListProps'),
2143
+ onSetup: setupMenuButtonHandler(editor, 'OL')
2260
2144
  };
2261
2145
  editor.ui.registry.addMenuItem('listprops', listProperties);
2262
2146
  editor.ui.registry.addContextMenu('lists', {
2263
- update: function (node) {
2264
- var parentList = getParentList(editor, node);
2147
+ update: node => {
2148
+ const parentList = getParentList(editor, node);
2265
2149
  return isOlNode(parentList) ? ['listprops'] : [];
2266
2150
  }
2267
2151
  });
2268
2152
  };
2269
2153
 
2270
- function Plugin () {
2271
- global.add('lists', function (editor) {
2272
- if (editor.hasPlugin('rtc', true) === false) {
2273
- setup$1(editor);
2274
- register(editor);
2154
+ var Plugin = () => {
2155
+ global$7.add('lists', editor => {
2156
+ register$3(editor);
2157
+ setup$1(editor);
2158
+ if (!editor.hasPlugin('rtc', true)) {
2159
+ setup(editor);
2160
+ register$2(editor);
2275
2161
  } else {
2276
2162
  registerDialog(editor);
2277
2163
  }
2278
2164
  register$1(editor);
2279
- register$2(editor);
2280
- return get$1(editor);
2165
+ register(editor);
2166
+ return get(editor);
2281
2167
  });
2282
- }
2168
+ };
2283
2169
 
2284
2170
  Plugin();
2285
2171
 
2286
- }());
2172
+ })();