argous 1.2.202 → 1.2.204

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 (426) hide show
  1. package/dist/components/ConfirmModal/ModalProvider.d.ts +1 -1
  2. package/dist/components/Editor/Events.d.ts +9 -7
  3. package/dist/components/Editor/Events.js +0 -7
  4. package/dist/components/Editor/ScriptLoader2.d.ts +10 -0
  5. package/dist/components/Editor/ScriptLoader2.js +146 -0
  6. package/dist/components/Editor/TinyMCE.d.ts +1 -8
  7. package/dist/components/Editor/TinyMCE.js +2 -10
  8. package/dist/components/Editor/Utils.d.ts +2 -7
  9. package/dist/components/Editor/Utils.js +29 -9
  10. package/dist/components/Editor/components/Editor.d.ts +17 -16
  11. package/dist/components/Editor/components/Editor.js +94 -51
  12. package/dist/components/Editor/components/EditorPropTypes.d.ts +1 -8
  13. package/dist/components/Editor/components/EditorPropTypes.js +19 -9
  14. package/dist/components/Editor/index.d.ts +2 -9
  15. package/dist/components/Editor/index.js +0 -7
  16. package/dist/components/Editor/skins/content/dark/content.d.ts +0 -0
  17. package/dist/components/Editor/skins/content/dark/content.js +3 -0
  18. package/dist/components/Editor/skins/content/default/content.d.ts +0 -0
  19. package/dist/components/Editor/skins/content/default/content.js +3 -0
  20. package/dist/components/Editor/skins/content/document/content.d.ts +0 -0
  21. package/dist/components/Editor/skins/content/document/content.js +3 -0
  22. package/dist/components/Editor/skins/content/tinymce-5/content.d.ts +0 -0
  23. package/dist/components/Editor/skins/content/tinymce-5/content.js +3 -0
  24. package/dist/components/Editor/skins/content/tinymce-5-dark/content.d.ts +0 -0
  25. package/dist/components/Editor/skins/content/tinymce-5-dark/content.js +3 -0
  26. package/dist/components/Editor/skins/content/writer/content.d.ts +0 -0
  27. package/dist/components/Editor/skins/content/writer/content.js +3 -0
  28. package/dist/components/Editor/skins/ui/oxide/content.d.ts +0 -0
  29. package/dist/components/Editor/skins/ui/oxide/content.inline.d.ts +0 -0
  30. package/dist/components/Editor/skins/ui/oxide/content.inline.js +3 -0
  31. package/dist/components/Editor/skins/ui/oxide/content.js +3 -0
  32. package/dist/components/Editor/skins/ui/oxide/skin.d.ts +0 -0
  33. package/dist/components/Editor/skins/ui/oxide/skin.js +3 -0
  34. package/dist/components/Editor/skins/ui/oxide/skin.shadowdom.d.ts +0 -0
  35. package/dist/components/Editor/skins/ui/oxide/skin.shadowdom.js +3 -0
  36. package/dist/components/Editor/skins/ui/oxide-dark/content.d.ts +0 -0
  37. package/dist/components/Editor/skins/ui/oxide-dark/content.inline.d.ts +0 -0
  38. package/dist/components/Editor/skins/ui/oxide-dark/content.inline.js +3 -0
  39. package/dist/components/Editor/skins/ui/oxide-dark/content.js +3 -0
  40. package/dist/components/Editor/skins/ui/oxide-dark/skin.d.ts +0 -0
  41. package/dist/components/Editor/skins/ui/oxide-dark/skin.js +3 -0
  42. package/dist/components/Editor/skins/ui/oxide-dark/skin.shadowdom.d.ts +0 -0
  43. package/dist/components/Editor/skins/ui/oxide-dark/skin.shadowdom.js +3 -0
  44. package/dist/components/Editor/skins/ui/tinymce-5/content.d.ts +0 -0
  45. package/dist/components/Editor/skins/ui/tinymce-5/content.inline.d.ts +0 -0
  46. package/dist/components/Editor/skins/ui/tinymce-5/content.inline.js +3 -0
  47. package/dist/components/Editor/skins/ui/tinymce-5/content.js +3 -0
  48. package/dist/components/Editor/skins/ui/tinymce-5/skin.d.ts +0 -0
  49. package/dist/components/Editor/skins/ui/tinymce-5/skin.js +3 -0
  50. package/dist/components/Editor/skins/ui/tinymce-5/skin.shadowdom.d.ts +0 -0
  51. package/dist/components/Editor/skins/ui/tinymce-5/skin.shadowdom.js +3 -0
  52. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.d.ts +0 -0
  53. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.inline.d.ts +0 -0
  54. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.inline.js +3 -0
  55. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.js +3 -0
  56. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.d.ts +0 -0
  57. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.js +3 -0
  58. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.d.ts +0 -0
  59. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.js +3 -0
  60. package/dist/components/Editor/tinymce/tinymce.d.ts +1722 -1447
  61. package/lib/components/Editor/Events.ts +9 -8
  62. package/lib/components/Editor/ScriptLoader2.ts +161 -0
  63. package/lib/components/Editor/TinyMCE.ts +2 -12
  64. package/lib/components/Editor/Utils.ts +25 -8
  65. package/lib/components/Editor/components/Editor.tsx +102 -79
  66. package/lib/components/Editor/components/EditorPropTypes.ts +21 -12
  67. package/lib/components/Editor/index.tsx +2 -10
  68. package/lib/components/Editor/skins/content/dark/content.js +2 -0
  69. package/lib/components/Editor/skins/content/dark/content.min.css +1 -8
  70. package/lib/components/Editor/skins/content/default/content.js +2 -0
  71. package/lib/components/Editor/skins/content/default/content.min.css +0 -7
  72. package/lib/components/Editor/skins/content/document/content.js +2 -0
  73. package/lib/components/Editor/skins/content/document/content.min.css +0 -7
  74. package/lib/components/Editor/skins/content/tinymce-5/content.js +2 -0
  75. package/lib/components/Editor/skins/content/tinymce-5/content.min.css +1 -0
  76. package/lib/components/Editor/skins/content/tinymce-5-dark/content.js +2 -0
  77. package/lib/components/Editor/skins/content/tinymce-5-dark/content.min.css +1 -0
  78. package/lib/components/Editor/skins/content/writer/content.js +2 -0
  79. package/lib/components/Editor/skins/content/writer/content.min.css +0 -7
  80. package/lib/components/Editor/skins/ui/oxide/content.inline.js +2 -0
  81. package/lib/components/Editor/skins/ui/oxide/content.inline.min.css +1 -0
  82. package/lib/components/Editor/skins/ui/oxide/content.js +2 -0
  83. package/lib/components/Editor/skins/ui/oxide/content.min.css +1 -0
  84. package/lib/components/Editor/skins/ui/oxide/skin.js +2 -0
  85. package/lib/components/Editor/skins/ui/oxide/skin.min.css +1 -0
  86. package/lib/components/Editor/skins/ui/oxide/skin.shadowdom.js +2 -0
  87. package/lib/components/Editor/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  88. package/lib/components/Editor/skins/ui/oxide-dark/content.inline.js +2 -0
  89. package/lib/components/Editor/skins/ui/oxide-dark/content.inline.min.css +1 -0
  90. package/lib/components/Editor/skins/ui/oxide-dark/content.js +2 -0
  91. package/lib/components/Editor/skins/ui/oxide-dark/content.min.css +1 -0
  92. package/lib/components/Editor/skins/ui/oxide-dark/skin.js +2 -0
  93. package/lib/components/Editor/skins/ui/oxide-dark/skin.min.css +1 -0
  94. package/lib/components/Editor/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  95. package/lib/components/Editor/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  96. package/lib/components/Editor/skins/ui/tinymce-5/content.inline.js +2 -0
  97. package/lib/components/Editor/skins/ui/tinymce-5/content.inline.min.css +1 -0
  98. package/lib/components/Editor/skins/ui/tinymce-5/content.js +2 -0
  99. package/lib/components/Editor/skins/ui/tinymce-5/content.min.css +1 -0
  100. package/lib/components/Editor/skins/ui/tinymce-5/skin.js +2 -0
  101. package/lib/components/Editor/skins/ui/tinymce-5/skin.min.css +1 -0
  102. package/lib/components/Editor/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
  103. package/lib/components/Editor/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  104. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.inline.js +2 -0
  105. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  106. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.js +2 -0
  107. package/lib/components/Editor/skins/ui/tinymce-5-dark/content.min.css +1 -0
  108. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.js +2 -0
  109. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  110. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
  111. package/lib/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  112. package/lib/components/Editor/tinymce/README.md +24 -14
  113. package/lib/components/Editor/tinymce/icons/default/icons.js +185 -163
  114. package/lib/components/Editor/tinymce/icons/default/icons.min.js +1 -1
  115. package/lib/components/Editor/tinymce/langs/README.md +1 -1
  116. package/lib/components/Editor/tinymce/license.txt +21 -504
  117. package/lib/components/Editor/tinymce/models/dom/model.js +8040 -0
  118. package/lib/components/Editor/tinymce/models/dom/model.min.js +4 -0
  119. package/lib/components/Editor/tinymce/plugins/accordion/plugin.js +1054 -0
  120. package/lib/components/Editor/tinymce/plugins/accordion/plugin.min.js +4 -0
  121. package/lib/components/Editor/tinymce/plugins/advlist/plugin.js +187 -208
  122. package/lib/components/Editor/tinymce/plugins/advlist/plugin.min.js +2 -7
  123. package/lib/components/Editor/tinymce/plugins/anchor/plugin.js +82 -84
  124. package/lib/components/Editor/tinymce/plugins/anchor/plugin.min.js +2 -7
  125. package/lib/components/Editor/tinymce/plugins/autolink/plugin.js +210 -167
  126. package/lib/components/Editor/tinymce/plugins/autolink/plugin.min.js +2 -7
  127. package/lib/components/Editor/tinymce/plugins/autoresize/plugin.js +118 -97
  128. package/lib/components/Editor/tinymce/plugins/autoresize/plugin.min.js +2 -7
  129. package/lib/components/Editor/tinymce/plugins/autosave/plugin.js +129 -108
  130. package/lib/components/Editor/tinymce/plugins/autosave/plugin.min.js +2 -7
  131. package/lib/components/Editor/tinymce/plugins/charmap/plugin.js +285 -333
  132. package/lib/components/Editor/tinymce/plugins/charmap/plugin.min.js +2 -7
  133. package/lib/components/Editor/tinymce/plugins/code/plugin.js +19 -26
  134. package/lib/components/Editor/tinymce/plugins/code/plugin.min.js +2 -7
  135. package/lib/components/Editor/tinymce/plugins/codesample/plugin.js +2225 -2094
  136. package/lib/components/Editor/tinymce/plugins/codesample/plugin.min.js +2 -7
  137. package/lib/components/Editor/tinymce/plugins/directionality/plugin.js +318 -243
  138. package/lib/components/Editor/tinymce/plugins/directionality/plugin.min.js +2 -7
  139. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojiimages.js +1 -9424
  140. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojiimages.min.js +1 -1
  141. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojis.js +1 -9423
  142. package/lib/components/Editor/tinymce/plugins/emoticons/js/emojis.min.js +1 -1
  143. package/lib/components/Editor/tinymce/plugins/emoticons/plugin.js +406 -416
  144. package/lib/components/Editor/tinymce/plugins/emoticons/plugin.min.js +2 -7
  145. package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.js +821 -604
  146. package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.min.js +2 -7
  147. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ar.js +90 -0
  148. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
  149. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ca.js +90 -0
  150. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/cs.js +90 -0
  151. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/da.js +90 -0
  152. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/de.js +90 -0
  153. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/el.js +90 -0
  154. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/en.js +90 -0
  155. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/es.js +90 -0
  156. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/eu.js +90 -0
  157. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/fa.js +90 -0
  158. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/fi.js +90 -0
  159. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
  160. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/he_IL.js +90 -0
  161. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/hi.js +90 -0
  162. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/hr.js +90 -0
  163. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
  164. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/id.js +90 -0
  165. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/it.js +90 -0
  166. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ja.js +90 -0
  167. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/kk.js +90 -0
  168. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
  169. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ms.js +90 -0
  170. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
  171. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/nl.js +90 -0
  172. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/pl.js +90 -0
  173. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
  174. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
  175. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ro.js +90 -0
  176. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/ru.js +90 -0
  177. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/sk.js +90 -0
  178. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
  179. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
  180. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/th_TH.js +90 -0
  181. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/tr.js +90 -0
  182. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/uk.js +90 -0
  183. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/vi.js +90 -0
  184. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
  185. package/lib/components/Editor/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
  186. package/lib/components/Editor/tinymce/plugins/help/plugin.js +428 -403
  187. package/lib/components/Editor/tinymce/plugins/help/plugin.min.js +2 -7
  188. package/lib/components/Editor/tinymce/plugins/image/plugin.js +887 -1043
  189. package/lib/components/Editor/tinymce/plugins/image/plugin.min.js +2 -7
  190. package/lib/components/Editor/tinymce/plugins/importcss/plugin.js +163 -162
  191. package/lib/components/Editor/tinymce/plugins/importcss/plugin.min.js +2 -7
  192. package/lib/components/Editor/tinymce/plugins/insertdatetime/plugin.js +101 -91
  193. package/lib/components/Editor/tinymce/plugins/insertdatetime/plugin.min.js +2 -7
  194. package/lib/components/Editor/tinymce/plugins/link/plugin.js +739 -784
  195. package/lib/components/Editor/tinymce/plugins/link/plugin.min.js +2 -7
  196. package/lib/components/Editor/tinymce/plugins/lists/plugin.js +1282 -1396
  197. package/lib/components/Editor/tinymce/plugins/lists/plugin.min.js +2 -7
  198. package/lib/components/Editor/tinymce/plugins/media/plugin.js +641 -806
  199. package/lib/components/Editor/tinymce/plugins/media/plugin.min.js +2 -7
  200. package/lib/components/Editor/tinymce/plugins/nonbreaking/plugin.js +76 -54
  201. package/lib/components/Editor/tinymce/plugins/nonbreaking/plugin.min.js +2 -7
  202. package/lib/components/Editor/tinymce/plugins/pagebreak/plugin.js +58 -46
  203. package/lib/components/Editor/tinymce/plugins/pagebreak/plugin.min.js +2 -7
  204. package/lib/components/Editor/tinymce/plugins/preview/plugin.js +39 -69
  205. package/lib/components/Editor/tinymce/plugins/preview/plugin.min.js +2 -7
  206. package/lib/components/Editor/tinymce/plugins/quickbars/plugin.js +307 -349
  207. package/lib/components/Editor/tinymce/plugins/quickbars/plugin.min.js +2 -7
  208. package/lib/components/Editor/tinymce/plugins/save/plugin.js +50 -51
  209. package/lib/components/Editor/tinymce/plugins/save/plugin.min.js +2 -7
  210. package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.js +517 -587
  211. package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.min.js +2 -7
  212. package/lib/components/Editor/tinymce/plugins/table/plugin.js +2666 -10142
  213. package/lib/components/Editor/tinymce/plugins/table/plugin.min.js +2 -7
  214. package/lib/components/Editor/tinymce/plugins/template/plugin.js +403 -413
  215. package/lib/components/Editor/tinymce/plugins/template/plugin.min.js +2 -7
  216. package/lib/components/Editor/tinymce/plugins/visualblocks/plugin.js +42 -48
  217. package/lib/components/Editor/tinymce/plugins/visualblocks/plugin.min.js +2 -7
  218. package/lib/components/Editor/tinymce/plugins/visualchars/plugin.js +352 -333
  219. package/lib/components/Editor/tinymce/plugins/visualchars/plugin.min.js +2 -7
  220. package/lib/components/Editor/tinymce/plugins/wordcount/plugin.js +184 -195
  221. package/lib/components/Editor/tinymce/plugins/wordcount/plugin.min.js +2 -7
  222. package/lib/components/Editor/tinymce/skins/content/dark/content.css +2 -8
  223. package/lib/components/Editor/tinymce/skins/content/dark/content.js +2 -0
  224. package/lib/components/Editor/tinymce/skins/content/dark/content.js.map +1 -0
  225. package/lib/components/Editor/tinymce/skins/content/dark/content.min.css +2 -8
  226. package/lib/components/Editor/tinymce/skins/content/dark/content.min.css.map +1 -1
  227. package/lib/components/Editor/tinymce/skins/content/default/content.css +0 -6
  228. package/lib/components/Editor/tinymce/skins/content/default/content.js +2 -0
  229. package/lib/components/Editor/tinymce/skins/content/default/content.js.map +1 -0
  230. package/lib/components/Editor/tinymce/skins/content/default/content.min.css +1 -7
  231. package/lib/components/Editor/tinymce/skins/content/default/content.min.css.map +1 -1
  232. package/lib/components/Editor/tinymce/skins/content/document/content.css +0 -6
  233. package/lib/components/Editor/tinymce/skins/content/document/content.js +2 -0
  234. package/lib/components/Editor/tinymce/skins/content/document/content.js.map +1 -0
  235. package/lib/components/Editor/tinymce/skins/content/document/content.min.css +0 -6
  236. package/lib/components/Editor/tinymce/skins/content/document/content.min.css.map +1 -1
  237. package/lib/components/Editor/{skins/content/default → tinymce/skins/content/tinymce-5}/content.css +0 -6
  238. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.js +2 -0
  239. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.js.map +1 -0
  240. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.min.css +2 -0
  241. package/lib/components/Editor/tinymce/skins/content/tinymce-5/content.min.css.map +1 -0
  242. package/lib/components/Editor/{skins/content/dark → tinymce/skins/content/tinymce-5-dark}/content.css +1 -7
  243. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.js +2 -0
  244. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.js.map +1 -0
  245. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.min.css +2 -0
  246. package/lib/components/Editor/tinymce/skins/content/tinymce-5-dark/content.min.css.map +1 -0
  247. package/lib/components/Editor/tinymce/skins/content/writer/content.css +0 -6
  248. package/lib/components/Editor/tinymce/skins/content/writer/content.js +2 -0
  249. package/lib/components/Editor/tinymce/skins/content/writer/content.js.map +1 -0
  250. package/lib/components/Editor/tinymce/skins/content/writer/content.min.css +0 -6
  251. package/lib/components/Editor/tinymce/skins/content/writer/content.min.css.map +1 -1
  252. package/lib/components/Editor/tinymce/skins/ui/oxide/content.css +74 -21
  253. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.css +74 -21
  254. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.js +2 -0
  255. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.js.map +1 -0
  256. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css +1 -7
  257. package/lib/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css.map +1 -1
  258. package/lib/components/Editor/tinymce/skins/ui/oxide/content.js +2 -0
  259. package/lib/components/Editor/tinymce/skins/ui/oxide/content.js.map +1 -0
  260. package/lib/components/Editor/tinymce/skins/ui/oxide/content.min.css +1 -7
  261. package/lib/components/Editor/tinymce/skins/ui/oxide/content.min.css.map +1 -1
  262. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.css +1131 -402
  263. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.js +2 -0
  264. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.js.map +1 -0
  265. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.min.css +1 -7
  266. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.min.css.map +1 -1
  267. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.css +8 -15
  268. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.js +2 -0
  269. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.js.map +1 -0
  270. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -7
  271. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css.map +1 -1
  272. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.css +72 -20
  273. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.css +74 -21
  274. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.js +2 -0
  275. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.js.map +1 -0
  276. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -7
  277. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css.map +1 -1
  278. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.js +2 -0
  279. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.js.map +1 -0
  280. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css +1 -7
  281. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css.map +1 -1
  282. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.css +1155 -423
  283. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.js +2 -0
  284. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.js.map +1 -0
  285. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css +1 -7
  286. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css.map +1 -1
  287. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +8 -15
  288. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  289. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.js.map +1 -0
  290. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -7
  291. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css.map +1 -1
  292. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/content.css +75 -22
  293. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/content.inline.css +75 -22
  294. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.js +2 -0
  295. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.js.map +1 -0
  296. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.min.css +2 -0
  297. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.min.css.map +1 -0
  298. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.js +2 -0
  299. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.js.map +1 -0
  300. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.min.css +2 -0
  301. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/content.min.css.map +1 -0
  302. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/skin.css +1261 -438
  303. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.js +2 -0
  304. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.js.map +1 -0
  305. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.min.css +2 -0
  306. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.min.css.map +1 -0
  307. package/lib/components/Editor/{skins/ui/default → tinymce/skins/ui/tinymce-5}/skin.shadowdom.css +8 -15
  308. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
  309. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.js.map +1 -0
  310. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +2 -0
  311. package/lib/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css.map +1 -0
  312. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/content.css +73 -21
  313. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/content.inline.css +75 -22
  314. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.js +2 -0
  315. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.js.map +1 -0
  316. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +2 -0
  317. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css.map +1 -0
  318. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.js +2 -0
  319. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.js.map +1 -0
  320. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.min.css +2 -0
  321. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.min.css.map +1 -0
  322. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/skin.css +1244 -421
  323. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.js +2 -0
  324. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.js.map +1 -0
  325. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css +2 -0
  326. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css.map +1 -0
  327. package/lib/components/Editor/{skins/ui/dark → tinymce/skins/ui/tinymce-5-dark}/skin.shadowdom.css +8 -15
  328. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
  329. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js.map +1 -0
  330. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +2 -0
  331. package/lib/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css.map +1 -0
  332. package/lib/components/Editor/tinymce/themes/silver/theme.js +23228 -24955
  333. package/lib/components/Editor/tinymce/themes/silver/theme.min.js +2 -7
  334. package/lib/components/Editor/tinymce/tinymce.d.ts +1722 -1447
  335. package/lib/components/Editor/tinymce/tinymce.js +23668 -22018
  336. package/lib/components/Editor/tinymce/tinymce.min.js +2 -30104
  337. package/package.json +1 -1
  338. package/lib/components/Editor/ScriptLoader.ts +0 -96
  339. package/lib/components/Editor/skins/content/dark/content.min.css.map +0 -1
  340. package/lib/components/Editor/skins/content/default/content.min.css.map +0 -1
  341. package/lib/components/Editor/skins/content/document/content.css +0 -72
  342. package/lib/components/Editor/skins/content/document/content.min.css.map +0 -1
  343. package/lib/components/Editor/skins/content/writer/content.css +0 -68
  344. package/lib/components/Editor/skins/content/writer/content.min.css.map +0 -1
  345. package/lib/components/Editor/skins/ui/dark/content.inline.min.css +0 -8
  346. package/lib/components/Editor/skins/ui/dark/content.inline.min.css.map +0 -1
  347. package/lib/components/Editor/skins/ui/dark/content.min.css +0 -8
  348. package/lib/components/Editor/skins/ui/dark/content.min.css.map +0 -1
  349. package/lib/components/Editor/skins/ui/dark/content.mobile.css +0 -29
  350. package/lib/components/Editor/skins/ui/dark/content.mobile.min.css +0 -8
  351. package/lib/components/Editor/skins/ui/dark/content.mobile.min.css.map +0 -1
  352. package/lib/components/Editor/skins/ui/dark/fonts/tinymce-mobile.woff +0 -0
  353. package/lib/components/Editor/skins/ui/dark/skin.min.css +0 -8
  354. package/lib/components/Editor/skins/ui/dark/skin.min.css.map +0 -1
  355. package/lib/components/Editor/skins/ui/dark/skin.mobile.css +0 -673
  356. package/lib/components/Editor/skins/ui/dark/skin.mobile.min.css +0 -8
  357. package/lib/components/Editor/skins/ui/dark/skin.mobile.min.css.map +0 -1
  358. package/lib/components/Editor/skins/ui/dark/skin.shadowdom.min.css +0 -8
  359. package/lib/components/Editor/skins/ui/dark/skin.shadowdom.min.css.map +0 -1
  360. package/lib/components/Editor/skins/ui/default/content.inline.min.css +0 -8
  361. package/lib/components/Editor/skins/ui/default/content.inline.min.css.map +0 -1
  362. package/lib/components/Editor/skins/ui/default/content.min.css +0 -8
  363. package/lib/components/Editor/skins/ui/default/content.min.css.map +0 -1
  364. package/lib/components/Editor/skins/ui/default/content.mobile.css +0 -29
  365. package/lib/components/Editor/skins/ui/default/content.mobile.min.css +0 -8
  366. package/lib/components/Editor/skins/ui/default/content.mobile.min.css.map +0 -1
  367. package/lib/components/Editor/skins/ui/default/fonts/tinymce-mobile.woff +0 -0
  368. package/lib/components/Editor/skins/ui/default/skin.min.css +0 -8
  369. package/lib/components/Editor/skins/ui/default/skin.min.css.map +0 -1
  370. package/lib/components/Editor/skins/ui/default/skin.mobile.css +0 -673
  371. package/lib/components/Editor/skins/ui/default/skin.mobile.min.css +0 -8
  372. package/lib/components/Editor/skins/ui/default/skin.mobile.min.css.map +0 -1
  373. package/lib/components/Editor/skins/ui/default/skin.shadowdom.min.css +0 -8
  374. package/lib/components/Editor/skins/ui/default/skin.shadowdom.min.css.map +0 -1
  375. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/fonts/tinymce-mobile.woff +0 -0
  376. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.css +0 -1641
  377. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.min.css +0 -8
  378. package/lib/components/Editor/skins/ui/plugin-tinycomments-tinymce4/plugin-tinycomments-tinymce4.min.css.map +0 -1
  379. package/lib/components/Editor/tinymce/jquery.tinymce.min.js +0 -92
  380. package/lib/components/Editor/tinymce/langs/pt_BR.js +0 -419
  381. package/lib/components/Editor/tinymce/plugins/bbcode/plugin.js +0 -99
  382. package/lib/components/Editor/tinymce/plugins/bbcode/plugin.min.js +0 -9
  383. package/lib/components/Editor/tinymce/plugins/colorpicker/plugin.js +0 -22
  384. package/lib/components/Editor/tinymce/plugins/colorpicker/plugin.min.js +0 -9
  385. package/lib/components/Editor/tinymce/plugins/contextmenu/plugin.js +0 -22
  386. package/lib/components/Editor/tinymce/plugins/contextmenu/plugin.min.js +0 -9
  387. package/lib/components/Editor/tinymce/plugins/fullpage/plugin.js +0 -544
  388. package/lib/components/Editor/tinymce/plugins/fullpage/plugin.min.js +0 -9
  389. package/lib/components/Editor/tinymce/plugins/hr/plugin.js +0 -46
  390. package/lib/components/Editor/tinymce/plugins/hr/plugin.min.js +0 -9
  391. package/lib/components/Editor/tinymce/plugins/imagetools/plugin.js +0 -1354
  392. package/lib/components/Editor/tinymce/plugins/imagetools/plugin.min.js +0 -9
  393. package/lib/components/Editor/tinymce/plugins/legacyoutput/plugin.js +0 -199
  394. package/lib/components/Editor/tinymce/plugins/legacyoutput/plugin.min.js +0 -9
  395. package/lib/components/Editor/tinymce/plugins/noneditable/plugin.js +0 -117
  396. package/lib/components/Editor/tinymce/plugins/noneditable/plugin.min.js +0 -9
  397. package/lib/components/Editor/tinymce/plugins/paste/plugin.js +0 -1764
  398. package/lib/components/Editor/tinymce/plugins/paste/plugin.min.js +0 -9
  399. package/lib/components/Editor/tinymce/plugins/print/plugin.js +0 -53
  400. package/lib/components/Editor/tinymce/plugins/print/plugin.min.js +0 -9
  401. package/lib/components/Editor/tinymce/plugins/spellchecker/plugin.js +0 -731
  402. package/lib/components/Editor/tinymce/plugins/spellchecker/plugin.min.js +0 -9
  403. package/lib/components/Editor/tinymce/plugins/tabfocus/plugin.js +0 -129
  404. package/lib/components/Editor/tinymce/plugins/tabfocus/plugin.min.js +0 -9
  405. package/lib/components/Editor/tinymce/plugins/textcolor/plugin.js +0 -22
  406. package/lib/components/Editor/tinymce/plugins/textcolor/plugin.min.js +0 -9
  407. package/lib/components/Editor/tinymce/plugins/textpattern/plugin.js +0 -1394
  408. package/lib/components/Editor/tinymce/plugins/textpattern/plugin.min.js +0 -9
  409. package/lib/components/Editor/tinymce/plugins/toc/plugin.js +0 -236
  410. package/lib/components/Editor/tinymce/plugins/toc/plugin.min.js +0 -9
  411. package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.css +0 -29
  412. package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.min.css +0 -8
  413. package/lib/components/Editor/tinymce/skins/ui/oxide/content.mobile.min.css.map +0 -1
  414. package/lib/components/Editor/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
  415. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.css +0 -673
  416. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.min.css +0 -8
  417. package/lib/components/Editor/tinymce/skins/ui/oxide/skin.mobile.min.css.map +0 -1
  418. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.css +0 -29
  419. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.min.css +0 -8
  420. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/content.mobile.min.css.map +0 -1
  421. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
  422. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.css +0 -673
  423. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +0 -8
  424. package/lib/components/Editor/tinymce/skins/ui/oxide-dark/skin.mobile.min.css.map +0 -1
  425. package/lib/components/Editor/tinymce/themes/mobile/theme.js +0 -13587
  426. package/lib/components/Editor/tinymce/themes/mobile/theme.min.js +0 -9
@@ -1,223 +1,185 @@
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$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');
13
9
 
14
- var __assign = function () {
15
- __assign = Object.assign || function __assign(t) {
16
- for (var s, i = 1, n = arguments.length; i < n; i++) {
17
- s = arguments[i];
18
- for (var p in s)
19
- if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
10
+ const getPrototypeOf = Object.getPrototypeOf;
11
+ const hasProto = (v, constructor, predicate) => {
12
+ var _a;
13
+ if (predicate(v, constructor.prototype)) {
14
+ return true;
15
+ } else {
16
+ return ((_a = v.constructor) === null || _a === void 0 ? void 0 : _a.name) === constructor.name;
17
+ }
25
18
  };
26
-
27
- var typeOf = function (x) {
28
- var t = typeof x;
19
+ const typeOf = x => {
20
+ const t = typeof x;
29
21
  if (x === null) {
30
22
  return 'null';
31
- } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
23
+ } else if (t === 'object' && Array.isArray(x)) {
32
24
  return 'array';
33
- } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
25
+ } else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
34
26
  return 'string';
35
27
  } else {
36
28
  return t;
37
29
  }
38
30
  };
39
- var isType = function (type) {
40
- return function (value) {
41
- return typeOf(value) === type;
42
- };
43
- };
44
- var isSimpleType = function (type) {
45
- return function (value) {
46
- return typeof value === type;
47
- };
48
- };
49
- var eq = function (t) {
50
- return function (a) {
51
- return t === a;
52
- };
53
- };
54
- var isString = isType('string');
55
- var isObject = isType('object');
56
- var isArray = isType('array');
57
- var isNull = eq(null);
58
- var isBoolean = isSimpleType('boolean');
59
- var isNullable = function (a) {
60
- return a === null || a === undefined;
61
- };
62
- var isNonNullable = function (a) {
63
- return !isNullable(a);
31
+ const isType = type => value => typeOf(value) === type;
32
+ const isSimpleType = type => value => typeof value === type;
33
+ const eq = t => a => t === a;
34
+ const is = (value, constructor) => isObject(value) && hasProto(value, constructor, (o, proto) => getPrototypeOf(o) === proto);
35
+ const isString = isType('string');
36
+ const isObject = isType('object');
37
+ const isPlainObject = value => is(value, Object);
38
+ const isArray = isType('array');
39
+ const isNull = eq(null);
40
+ const isBoolean = isSimpleType('boolean');
41
+ const isNullable = a => a === null || a === undefined;
42
+ const isNonNullable = a => !isNullable(a);
43
+ const isFunction = isSimpleType('function');
44
+ const isNumber = isSimpleType('number');
45
+ const isArrayOf = (value, pred) => {
46
+ if (isArray(value)) {
47
+ for (let i = 0, len = value.length; i < len; ++i) {
48
+ if (!pred(value[i])) {
49
+ return false;
50
+ }
51
+ }
52
+ return true;
53
+ }
54
+ return false;
64
55
  };
65
- var isNumber = isSimpleType('number');
66
56
 
67
- var noop = function () {
68
- };
69
- var constant = function (value) {
70
- return function () {
71
- return value;
72
- };
57
+ const noop = () => {
73
58
  };
74
- var never = constant(false);
75
- var always = constant(true);
76
59
 
77
- var none = function () {
78
- return NONE;
79
- };
80
- var NONE = function () {
81
- var eq = function (o) {
82
- return o.isNone();
83
- };
84
- var call = function (thunk) {
85
- return thunk();
86
- };
87
- var id = function (n) {
88
- return n;
89
- };
90
- var me = {
91
- fold: function (n, _s) {
92
- return n();
93
- },
94
- is: never,
95
- isSome: never,
96
- isNone: always,
97
- getOr: id,
98
- getOrThunk: call,
99
- getOrDie: function (msg) {
100
- throw new Error(msg || 'error: getOrDie called on none.');
101
- },
102
- getOrNull: constant(null),
103
- getOrUndefined: constant(undefined),
104
- or: id,
105
- orThunk: call,
106
- map: none,
107
- each: noop,
108
- bind: none,
109
- exists: never,
110
- forall: always,
111
- filter: none,
112
- equals: eq,
113
- equals_: eq,
114
- toArray: function () {
115
- return [];
116
- },
117
- toString: constant('none()')
118
- };
119
- return me;
120
- }();
121
- var some = function (a) {
122
- var constant_a = constant(a);
123
- var self = function () {
124
- return me;
125
- };
126
- var bind = function (f) {
127
- return f(a);
128
- };
129
- var me = {
130
- fold: function (n, s) {
131
- return s(a);
132
- },
133
- is: function (v) {
134
- return a === v;
135
- },
136
- isSome: always,
137
- isNone: never,
138
- getOr: constant_a,
139
- getOrThunk: constant_a,
140
- getOrDie: constant_a,
141
- getOrNull: constant_a,
142
- getOrUndefined: constant_a,
143
- or: self,
144
- orThunk: self,
145
- map: function (f) {
146
- return some(f(a));
147
- },
148
- each: function (f) {
149
- f(a);
150
- },
151
- bind: bind,
152
- exists: bind,
153
- forall: bind,
154
- filter: function (f) {
155
- return f(a) ? me : NONE;
156
- },
157
- toArray: function () {
158
- return [a];
159
- },
160
- toString: function () {
161
- return 'some(' + a + ')';
162
- },
163
- equals: function (o) {
164
- return o.is(a);
165
- },
166
- equals_: function (o, elementEq) {
167
- return o.fold(never, function (b) {
168
- return elementEq(a, b);
169
- });
60
+ class Optional {
61
+ constructor(tag, value) {
62
+ this.tag = tag;
63
+ this.value = value;
64
+ }
65
+ static some(value) {
66
+ return new Optional(true, value);
67
+ }
68
+ static none() {
69
+ return Optional.singletonNone;
70
+ }
71
+ fold(onNone, onSome) {
72
+ if (this.tag) {
73
+ return onSome(this.value);
74
+ } else {
75
+ return onNone();
170
76
  }
171
- };
172
- return me;
173
- };
174
- var from = function (value) {
175
- return value === null || value === undefined ? NONE : some(value);
176
- };
177
- var Optional = {
178
- some: some,
179
- none: none,
180
- from: from
181
- };
77
+ }
78
+ isSome() {
79
+ return this.tag;
80
+ }
81
+ isNone() {
82
+ return !this.tag;
83
+ }
84
+ map(mapper) {
85
+ if (this.tag) {
86
+ return Optional.some(mapper(this.value));
87
+ } else {
88
+ return Optional.none();
89
+ }
90
+ }
91
+ bind(binder) {
92
+ if (this.tag) {
93
+ return binder(this.value);
94
+ } else {
95
+ return Optional.none();
96
+ }
97
+ }
98
+ exists(predicate) {
99
+ return this.tag && predicate(this.value);
100
+ }
101
+ forall(predicate) {
102
+ return !this.tag || predicate(this.value);
103
+ }
104
+ filter(predicate) {
105
+ if (!this.tag || predicate(this.value)) {
106
+ return this;
107
+ } else {
108
+ return Optional.none();
109
+ }
110
+ }
111
+ getOr(replacement) {
112
+ return this.tag ? this.value : replacement;
113
+ }
114
+ or(replacement) {
115
+ return this.tag ? this : replacement;
116
+ }
117
+ getOrThunk(thunk) {
118
+ return this.tag ? this.value : thunk();
119
+ }
120
+ orThunk(thunk) {
121
+ return this.tag ? this : thunk();
122
+ }
123
+ getOrDie(message) {
124
+ if (!this.tag) {
125
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
126
+ } else {
127
+ return this.value;
128
+ }
129
+ }
130
+ static from(value) {
131
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
132
+ }
133
+ getOrNull() {
134
+ return this.tag ? this.value : null;
135
+ }
136
+ getOrUndefined() {
137
+ return this.value;
138
+ }
139
+ each(worker) {
140
+ if (this.tag) {
141
+ worker(this.value);
142
+ }
143
+ }
144
+ toArray() {
145
+ return this.tag ? [this.value] : [];
146
+ }
147
+ toString() {
148
+ return this.tag ? `some(${ this.value })` : 'none()';
149
+ }
150
+ }
151
+ Optional.singletonNone = new Optional(false);
182
152
 
183
- var keys = Object.keys;
184
- var hasOwnProperty = Object.hasOwnProperty;
185
- var each = function (obj, f) {
186
- var props = keys(obj);
187
- for (var k = 0, len = props.length; k < len; k++) {
188
- var i = props[k];
189
- var x = obj[i];
153
+ const keys = Object.keys;
154
+ const hasOwnProperty = Object.hasOwnProperty;
155
+ const each = (obj, f) => {
156
+ const props = keys(obj);
157
+ for (let k = 0, len = props.length; k < len; k++) {
158
+ const i = props[k];
159
+ const x = obj[i];
190
160
  f(x, i);
191
161
  }
192
162
  };
193
- var objAcc = function (r) {
194
- return function (x, i) {
195
- r[i] = x;
196
- };
163
+ const objAcc = r => (x, i) => {
164
+ r[i] = x;
197
165
  };
198
- var internalFilter = function (obj, pred, onTrue, onFalse) {
199
- var r = {};
200
- each(obj, function (x, i) {
166
+ const internalFilter = (obj, pred, onTrue, onFalse) => {
167
+ each(obj, (x, i) => {
201
168
  (pred(x, i) ? onTrue : onFalse)(x, i);
202
169
  });
203
- return r;
204
170
  };
205
- var filter = function (obj, pred) {
206
- var t = {};
171
+ const filter = (obj, pred) => {
172
+ const t = {};
207
173
  internalFilter(obj, pred, objAcc(t), noop);
208
174
  return t;
209
175
  };
210
- var has = function (obj, key) {
211
- return hasOwnProperty.call(obj, key);
212
- };
213
- var hasNonNullableKey = function (obj, key) {
214
- return has(obj, key) && obj[key] !== undefined && obj[key] !== null;
215
- };
176
+ const has = (obj, key) => hasOwnProperty.call(obj, key);
177
+ const hasNonNullableKey = (obj, key) => has(obj, key) && obj[key] !== undefined && obj[key] !== null;
216
178
 
217
- var nativePush = Array.prototype.push;
218
- var flatten = function (xs) {
219
- var r = [];
220
- for (var i = 0, len = xs.length; i < len; ++i) {
179
+ const nativePush = Array.prototype.push;
180
+ const flatten = xs => {
181
+ const r = [];
182
+ for (let i = 0, len = xs.length; i < len; ++i) {
221
183
  if (!isArray(xs[i])) {
222
184
  throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
223
185
  }
@@ -225,15 +187,11 @@
225
187
  }
226
188
  return r;
227
189
  };
228
- var get = function (xs, i) {
229
- return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
230
- };
231
- var head = function (xs) {
232
- return get(xs, 0);
233
- };
234
- var findMap = function (arr, f) {
235
- for (var i = 0; i < arr.length; i++) {
236
- var r = f(arr[i], i);
190
+ const get = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
191
+ const head = xs => get(xs, 0);
192
+ const findMap = (arr, f) => {
193
+ for (let i = 0; i < arr.length; i++) {
194
+ const r = f(arr[i], i);
237
195
  if (r.isSome()) {
238
196
  return r;
239
197
  }
@@ -241,9 +199,9 @@
241
199
  return Optional.none();
242
200
  };
243
201
 
244
- var Global = typeof window !== 'undefined' ? window : Function('return this;')();
202
+ typeof window !== 'undefined' ? window : Function('return this;')();
245
203
 
246
- var rawSet = function (dom, key, value) {
204
+ const rawSet = (dom, key, value) => {
247
205
  if (isString(value) || isBoolean(value) || isNumber(value)) {
248
206
  dom.setAttribute(key, value + '');
249
207
  } else {
@@ -251,144 +209,160 @@
251
209
  throw new Error('Attribute value was not simple');
252
210
  }
253
211
  };
254
- var set = function (element, key, value) {
212
+ const set = (element, key, value) => {
255
213
  rawSet(element.dom, key, value);
256
214
  };
257
- var remove = function (element, key) {
215
+ const remove = (element, key) => {
258
216
  element.dom.removeAttribute(key);
259
217
  };
260
218
 
261
- var fromHtml = function (html, scope) {
262
- var doc = scope || document;
263
- var div = doc.createElement('div');
219
+ const fromHtml = (html, scope) => {
220
+ const doc = scope || document;
221
+ const div = doc.createElement('div');
264
222
  div.innerHTML = html;
265
223
  if (!div.hasChildNodes() || div.childNodes.length > 1) {
266
- console.error('HTML does not have a single root node', html);
267
- throw new Error('HTML must have a single root node');
224
+ const message = 'HTML does not have a single root node';
225
+ console.error(message, html);
226
+ throw new Error(message);
268
227
  }
269
228
  return fromDom(div.childNodes[0]);
270
229
  };
271
- var fromTag = function (tag, scope) {
272
- var doc = scope || document;
273
- var node = doc.createElement(tag);
230
+ const fromTag = (tag, scope) => {
231
+ const doc = scope || document;
232
+ const node = doc.createElement(tag);
274
233
  return fromDom(node);
275
234
  };
276
- var fromText = function (text, scope) {
277
- var doc = scope || document;
278
- var node = doc.createTextNode(text);
235
+ const fromText = (text, scope) => {
236
+ const doc = scope || document;
237
+ const node = doc.createTextNode(text);
279
238
  return fromDom(node);
280
239
  };
281
- var fromDom = function (node) {
240
+ const fromDom = node => {
282
241
  if (node === null || node === undefined) {
283
242
  throw new Error('Node cannot be null or undefined');
284
243
  }
285
244
  return { dom: node };
286
245
  };
287
- var fromPoint = function (docElm, x, y) {
288
- return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
289
- };
290
- var SugarElement = {
291
- fromHtml: fromHtml,
292
- fromTag: fromTag,
293
- fromText: fromText,
294
- fromDom: fromDom,
295
- fromPoint: fromPoint
246
+ const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
247
+ const SugarElement = {
248
+ fromHtml,
249
+ fromTag,
250
+ fromText,
251
+ fromDom,
252
+ fromPoint
296
253
  };
297
254
 
298
- var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
255
+ var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
299
256
 
300
- var global$2 = tinymce.util.Tools.resolve('tinymce.util.Promise');
257
+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.URI');
301
258
 
302
- var global$3 = tinymce.util.Tools.resolve('tinymce.util.XHR');
259
+ const isNotEmpty = s => s.length > 0;
303
260
 
304
- var hasDimensions = function (editor) {
305
- return editor.getParam('image_dimensions', true, 'boolean');
306
- };
307
- var hasAdvTab = function (editor) {
308
- return editor.getParam('image_advtab', false, 'boolean');
309
- };
310
- var hasUploadTab = function (editor) {
311
- return editor.getParam('image_uploadtab', true, 'boolean');
312
- };
313
- var getPrependUrl = function (editor) {
314
- return editor.getParam('image_prepend_url', '', 'string');
315
- };
316
- var getClassList = function (editor) {
317
- return editor.getParam('image_class_list');
318
- };
319
- var hasDescription = function (editor) {
320
- return editor.getParam('image_description', true, 'boolean');
321
- };
322
- var hasImageTitle = function (editor) {
323
- return editor.getParam('image_title', false, 'boolean');
324
- };
325
- var hasImageCaption = function (editor) {
326
- return editor.getParam('image_caption', false, 'boolean');
327
- };
328
- var getImageList = function (editor) {
329
- return editor.getParam('image_list', false);
330
- };
331
- var hasUploadUrl = function (editor) {
332
- return isNonNullable(editor.getParam('images_upload_url'));
333
- };
334
- var hasUploadHandler = function (editor) {
335
- return isNonNullable(editor.getParam('images_upload_handler'));
336
- };
337
- var showAccessibilityOptions = function (editor) {
338
- return editor.getParam('a11y_advanced_options', false, 'boolean');
339
- };
340
- var isAutomaticUploadsEnabled = function (editor) {
341
- return editor.getParam('automatic_uploads', true, 'boolean');
342
- };
343
-
344
- var parseIntAndGetMax = function (val1, val2) {
345
- return Math.max(parseInt(val1, 10), parseInt(val2, 10));
346
- };
347
- var getImageSize = function (url) {
348
- return new global$2(function (callback) {
349
- var img = document.createElement('img');
350
- var done = function (dimensions) {
351
- if (img.parentNode) {
352
- img.parentNode.removeChild(img);
353
- }
354
- callback(dimensions);
355
- };
356
- img.onload = function () {
357
- var width = parseIntAndGetMax(img.width, img.clientWidth);
358
- var height = parseIntAndGetMax(img.height, img.clientHeight);
359
- var dimensions = {
360
- width: width,
361
- height: height
261
+ const option = name => editor => editor.options.get(name);
262
+ const register$2 = editor => {
263
+ const registerOption = editor.options.register;
264
+ registerOption('image_dimensions', {
265
+ processor: 'boolean',
266
+ default: true
267
+ });
268
+ registerOption('image_advtab', {
269
+ processor: 'boolean',
270
+ default: false
271
+ });
272
+ registerOption('image_uploadtab', {
273
+ processor: 'boolean',
274
+ default: true
275
+ });
276
+ registerOption('image_prepend_url', {
277
+ processor: 'string',
278
+ default: ''
279
+ });
280
+ registerOption('image_class_list', { processor: 'object[]' });
281
+ registerOption('image_description', {
282
+ processor: 'boolean',
283
+ default: true
284
+ });
285
+ registerOption('image_title', {
286
+ processor: 'boolean',
287
+ default: false
288
+ });
289
+ registerOption('image_caption', {
290
+ processor: 'boolean',
291
+ default: false
292
+ });
293
+ registerOption('image_list', {
294
+ processor: value => {
295
+ const valid = value === false || isString(value) || isArrayOf(value, isObject) || isFunction(value);
296
+ return valid ? {
297
+ value,
298
+ valid
299
+ } : {
300
+ valid: false,
301
+ message: 'Must be false, a string, an array or a function.'
362
302
  };
363
- done(global$2.resolve(dimensions));
364
- };
365
- img.onerror = function () {
366
- done(global$2.reject('Failed to get image dimensions for: ' + url));
367
- };
368
- var style = img.style;
369
- style.visibility = 'hidden';
370
- style.position = 'fixed';
371
- style.bottom = style.left = '0px';
372
- style.width = style.height = 'auto';
373
- document.body.appendChild(img);
374
- img.src = url;
303
+ },
304
+ default: false
375
305
  });
376
306
  };
377
- var removePixelSuffix = function (value) {
307
+ const hasDimensions = option('image_dimensions');
308
+ const hasAdvTab = option('image_advtab');
309
+ const hasUploadTab = option('image_uploadtab');
310
+ const getPrependUrl = option('image_prepend_url');
311
+ const getClassList = option('image_class_list');
312
+ const hasDescription = option('image_description');
313
+ const hasImageTitle = option('image_title');
314
+ const hasImageCaption = option('image_caption');
315
+ const getImageList = option('image_list');
316
+ const showAccessibilityOptions = option('a11y_advanced_options');
317
+ const isAutomaticUploadsEnabled = option('automatic_uploads');
318
+ const hasUploadUrl = editor => isNotEmpty(editor.options.get('images_upload_url'));
319
+ const hasUploadHandler = editor => isNonNullable(editor.options.get('images_upload_handler'));
320
+
321
+ const parseIntAndGetMax = (val1, val2) => Math.max(parseInt(val1, 10), parseInt(val2, 10));
322
+ const getImageSize = url => new Promise(callback => {
323
+ const img = document.createElement('img');
324
+ const done = dimensions => {
325
+ img.onload = img.onerror = null;
326
+ if (img.parentNode) {
327
+ img.parentNode.removeChild(img);
328
+ }
329
+ callback(dimensions);
330
+ };
331
+ img.onload = () => {
332
+ const width = parseIntAndGetMax(img.width, img.clientWidth);
333
+ const height = parseIntAndGetMax(img.height, img.clientHeight);
334
+ const dimensions = {
335
+ width,
336
+ height
337
+ };
338
+ done(Promise.resolve(dimensions));
339
+ };
340
+ img.onerror = () => {
341
+ done(Promise.reject(`Failed to get image dimensions for: ${ url }`));
342
+ };
343
+ const style = img.style;
344
+ style.visibility = 'hidden';
345
+ style.position = 'fixed';
346
+ style.bottom = style.left = '0px';
347
+ style.width = style.height = 'auto';
348
+ document.body.appendChild(img);
349
+ img.src = url;
350
+ });
351
+ const removePixelSuffix = value => {
378
352
  if (value) {
379
353
  value = value.replace(/px$/, '');
380
354
  }
381
355
  return value;
382
356
  };
383
- var addPixelSuffix = function (value) {
357
+ const addPixelSuffix = value => {
384
358
  if (value.length > 0 && /^[0-9]+$/.test(value)) {
385
359
  value += 'px';
386
360
  }
387
361
  return value;
388
362
  };
389
- var mergeMargins = function (css) {
363
+ const mergeMargins = css => {
390
364
  if (css.margin) {
391
- var splitMargin = String(css.margin).split(' ');
365
+ const splitMargin = String(css.margin).split(' ');
392
366
  switch (splitMargin.length) {
393
367
  case 1:
394
368
  css['margin-top'] = css['margin-top'] || splitMargin[0];
@@ -418,30 +392,29 @@
418
392
  }
419
393
  return css;
420
394
  };
421
- var createImageList = function (editor, callback) {
422
- var imageList = getImageList(editor);
423
- if (typeof imageList === 'string') {
424
- global$3.send({
425
- url: imageList,
426
- success: function (text) {
427
- callback(JSON.parse(text));
395
+ const createImageList = (editor, callback) => {
396
+ const imageList = getImageList(editor);
397
+ if (isString(imageList)) {
398
+ fetch(imageList).then(res => {
399
+ if (res.ok) {
400
+ res.json().then(callback);
428
401
  }
429
402
  });
430
- } else if (typeof imageList === 'function') {
403
+ } else if (isFunction(imageList)) {
431
404
  imageList(callback);
432
405
  } else {
433
406
  callback(imageList);
434
407
  }
435
408
  };
436
- var waitLoadImage = function (editor, data, imgElm) {
437
- var selectImage = function () {
409
+ const waitLoadImage = (editor, data, imgElm) => {
410
+ const selectImage = () => {
438
411
  imgElm.onload = imgElm.onerror = null;
439
412
  if (editor.selection) {
440
413
  editor.selection.select(imgElm);
441
414
  editor.nodeChanged();
442
415
  }
443
416
  };
444
- imgElm.onload = function () {
417
+ imgElm.onload = () => {
445
418
  if (!data.width && !data.height && hasDimensions(editor)) {
446
419
  editor.dom.setAttribs(imgElm, {
447
420
  width: String(imgElm.clientWidth),
@@ -452,86 +425,89 @@
452
425
  };
453
426
  imgElm.onerror = selectImage;
454
427
  };
455
- var blobToDataUri = function (blob) {
456
- return new global$2(function (resolve, reject) {
457
- var reader = new FileReader();
458
- reader.onload = function () {
459
- resolve(reader.result);
460
- };
461
- reader.onerror = function () {
462
- reject(reader.error.message);
463
- };
464
- reader.readAsDataURL(blob);
428
+ const blobToDataUri = blob => new Promise((resolve, reject) => {
429
+ const reader = new FileReader();
430
+ reader.onload = () => {
431
+ resolve(reader.result);
432
+ };
433
+ reader.onerror = () => {
434
+ var _a;
435
+ reject((_a = reader.error) === null || _a === void 0 ? void 0 : _a.message);
436
+ };
437
+ reader.readAsDataURL(blob);
438
+ });
439
+ const isPlaceholderImage = imgElm => imgElm.nodeName === 'IMG' && (imgElm.hasAttribute('data-mce-object') || imgElm.hasAttribute('data-mce-placeholder'));
440
+ const isSafeImageUrl = (editor, src) => {
441
+ const getOption = editor.options.get;
442
+ return global$2.isDomSafe(src, 'img', {
443
+ allow_html_data_urls: getOption('allow_html_data_urls'),
444
+ allow_script_urls: getOption('allow_script_urls'),
445
+ allow_svg_data_urls: getOption('allow_svg_data_urls')
465
446
  });
466
447
  };
467
- var isPlaceholderImage = function (imgElm) {
468
- return imgElm.nodeName === 'IMG' && (imgElm.hasAttribute('data-mce-object') || imgElm.hasAttribute('data-mce-placeholder'));
469
- };
470
448
 
471
- var DOM = global$1.DOM;
472
- var getHspace = function (image) {
449
+ const DOM = global$3.DOM;
450
+ const getHspace = image => {
473
451
  if (image.style.marginLeft && image.style.marginRight && image.style.marginLeft === image.style.marginRight) {
474
452
  return removePixelSuffix(image.style.marginLeft);
475
453
  } else {
476
454
  return '';
477
455
  }
478
456
  };
479
- var getVspace = function (image) {
457
+ const getVspace = image => {
480
458
  if (image.style.marginTop && image.style.marginBottom && image.style.marginTop === image.style.marginBottom) {
481
459
  return removePixelSuffix(image.style.marginTop);
482
460
  } else {
483
461
  return '';
484
462
  }
485
463
  };
486
- var getBorder = function (image) {
464
+ const getBorder = image => {
487
465
  if (image.style.borderWidth) {
488
466
  return removePixelSuffix(image.style.borderWidth);
489
467
  } else {
490
468
  return '';
491
469
  }
492
470
  };
493
- var getAttrib = function (image, name) {
471
+ const getAttrib = (image, name) => {
472
+ var _a;
494
473
  if (image.hasAttribute(name)) {
495
- return image.getAttribute(name);
474
+ return (_a = image.getAttribute(name)) !== null && _a !== void 0 ? _a : '';
496
475
  } else {
497
476
  return '';
498
477
  }
499
478
  };
500
- var getStyle = function (image, name) {
501
- return image.style[name] ? image.style[name] : '';
502
- };
503
- var hasCaption = function (image) {
504
- return image.parentNode !== null && image.parentNode.nodeName === 'FIGURE';
505
- };
506
- var updateAttrib = function (image, name, value) {
507
- if (value === '') {
479
+ const hasCaption = image => image.parentNode !== null && image.parentNode.nodeName === 'FIGURE';
480
+ const updateAttrib = (image, name, value) => {
481
+ if (value === '' || value === null) {
508
482
  image.removeAttribute(name);
509
483
  } else {
510
484
  image.setAttribute(name, value);
511
485
  }
512
486
  };
513
- var wrapInFigure = function (image) {
514
- var figureElm = DOM.create('figure', { class: 'image' });
487
+ const wrapInFigure = image => {
488
+ const figureElm = DOM.create('figure', { class: 'image' });
515
489
  DOM.insertAfter(figureElm, image);
516
490
  figureElm.appendChild(image);
517
491
  figureElm.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));
518
492
  figureElm.contentEditable = 'false';
519
493
  };
520
- var removeFigure = function (image) {
521
- var figureElm = image.parentNode;
522
- DOM.insertAfter(image, figureElm);
523
- DOM.remove(figureElm);
494
+ const removeFigure = image => {
495
+ const figureElm = image.parentNode;
496
+ if (isNonNullable(figureElm)) {
497
+ DOM.insertAfter(image, figureElm);
498
+ DOM.remove(figureElm);
499
+ }
524
500
  };
525
- var toggleCaption = function (image) {
501
+ const toggleCaption = image => {
526
502
  if (hasCaption(image)) {
527
503
  removeFigure(image);
528
504
  } else {
529
505
  wrapInFigure(image);
530
506
  }
531
507
  };
532
- var normalizeStyle = function (image, normalizeCss) {
533
- var attrValue = image.getAttribute('style');
534
- var value = normalizeCss(attrValue !== null ? attrValue : '');
508
+ const normalizeStyle = (image, normalizeCss) => {
509
+ const attrValue = image.getAttribute('style');
510
+ const value = normalizeCss(attrValue !== null ? attrValue : '');
535
511
  if (value.length > 0) {
536
512
  image.setAttribute('style', value);
537
513
  image.setAttribute('data-mce-style', value);
@@ -539,78 +515,71 @@
539
515
  image.removeAttribute('style');
540
516
  }
541
517
  };
542
- var setSize = function (name, normalizeCss) {
543
- return function (image, name, value) {
544
- if (image.style[name]) {
545
- image.style[name] = addPixelSuffix(value);
546
- normalizeStyle(image, normalizeCss);
547
- } else {
548
- updateAttrib(image, name, value);
549
- }
550
- };
518
+ const setSize = (name, normalizeCss) => (image, name, value) => {
519
+ const styles = image.style;
520
+ if (styles[name]) {
521
+ styles[name] = addPixelSuffix(value);
522
+ normalizeStyle(image, normalizeCss);
523
+ } else {
524
+ updateAttrib(image, name, value);
525
+ }
551
526
  };
552
- var getSize = function (image, name) {
527
+ const getSize = (image, name) => {
553
528
  if (image.style[name]) {
554
529
  return removePixelSuffix(image.style[name]);
555
530
  } else {
556
531
  return getAttrib(image, name);
557
532
  }
558
533
  };
559
- var setHspace = function (image, value) {
560
- var pxValue = addPixelSuffix(value);
534
+ const setHspace = (image, value) => {
535
+ const pxValue = addPixelSuffix(value);
561
536
  image.style.marginLeft = pxValue;
562
537
  image.style.marginRight = pxValue;
563
538
  };
564
- var setVspace = function (image, value) {
565
- var pxValue = addPixelSuffix(value);
539
+ const setVspace = (image, value) => {
540
+ const pxValue = addPixelSuffix(value);
566
541
  image.style.marginTop = pxValue;
567
542
  image.style.marginBottom = pxValue;
568
543
  };
569
- var setBorder = function (image, value) {
570
- var pxValue = addPixelSuffix(value);
544
+ const setBorder = (image, value) => {
545
+ const pxValue = addPixelSuffix(value);
571
546
  image.style.borderWidth = pxValue;
572
547
  };
573
- var setBorderStyle = function (image, value) {
548
+ const setBorderStyle = (image, value) => {
574
549
  image.style.borderStyle = value;
575
550
  };
576
- var getBorderStyle = function (image) {
577
- return getStyle(image, 'borderStyle');
578
- };
579
- var isFigure = function (elm) {
580
- return elm.nodeName === 'FIGURE';
581
- };
582
- var isImage = function (elm) {
583
- return elm.nodeName === 'IMG';
551
+ const getBorderStyle = image => {
552
+ var _a;
553
+ return (_a = image.style.borderStyle) !== null && _a !== void 0 ? _a : '';
584
554
  };
585
- var getIsDecorative = function (image) {
586
- return DOM.getAttrib(image, 'alt').length === 0 && DOM.getAttrib(image, 'role') === 'presentation';
587
- };
588
- var getAlt = function (image) {
555
+ const isFigure = elm => isNonNullable(elm) && elm.nodeName === 'FIGURE';
556
+ const isImage = elm => elm.nodeName === 'IMG';
557
+ const getIsDecorative = image => DOM.getAttrib(image, 'alt').length === 0 && DOM.getAttrib(image, 'role') === 'presentation';
558
+ const getAlt = image => {
589
559
  if (getIsDecorative(image)) {
590
560
  return '';
591
561
  } else {
592
562
  return getAttrib(image, 'alt');
593
563
  }
594
564
  };
595
- var defaultData = function () {
596
- return {
597
- src: '',
598
- alt: '',
599
- title: '',
600
- width: '',
601
- height: '',
602
- class: '',
603
- style: '',
604
- caption: false,
605
- hspace: '',
606
- vspace: '',
607
- border: '',
608
- borderStyle: '',
609
- isDecorative: false
610
- };
611
- };
612
- var getStyleValue = function (normalizeCss, data) {
613
- var image = document.createElement('img');
565
+ const defaultData = () => ({
566
+ src: '',
567
+ alt: '',
568
+ title: '',
569
+ width: '',
570
+ height: '',
571
+ class: '',
572
+ style: '',
573
+ caption: false,
574
+ hspace: '',
575
+ vspace: '',
576
+ border: '',
577
+ borderStyle: '',
578
+ isDecorative: false
579
+ });
580
+ const getStyleValue = (normalizeCss, data) => {
581
+ var _a;
582
+ const image = document.createElement('img');
614
583
  updateAttrib(image, 'style', data.style);
615
584
  if (getHspace(image) || data.hspace !== '') {
616
585
  setHspace(image, data.hspace);
@@ -624,14 +593,17 @@
624
593
  if (getBorderStyle(image) || data.borderStyle !== '') {
625
594
  setBorderStyle(image, data.borderStyle);
626
595
  }
627
- return normalizeCss(image.getAttribute('style'));
628
- };
629
- var create = function (normalizeCss, data) {
630
- var image = document.createElement('img');
631
- write(normalizeCss, __assign(__assign({}, data), { caption: false }), image);
596
+ return normalizeCss((_a = image.getAttribute('style')) !== null && _a !== void 0 ? _a : '');
597
+ };
598
+ const create = (normalizeCss, data) => {
599
+ const image = document.createElement('img');
600
+ write(normalizeCss, {
601
+ ...data,
602
+ caption: false
603
+ }, image);
632
604
  setAlt(image, data.alt, data.isDecorative);
633
605
  if (data.caption) {
634
- var figure = DOM.create('figure', { class: 'image' });
606
+ const figure = DOM.create('figure', { class: 'image' });
635
607
  figure.appendChild(image);
636
608
  figure.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));
637
609
  figure.contentEditable = 'false';
@@ -640,39 +612,37 @@
640
612
  return image;
641
613
  }
642
614
  };
643
- var read = function (normalizeCss, image) {
644
- return {
645
- src: getAttrib(image, 'src'),
646
- alt: getAlt(image),
647
- title: getAttrib(image, 'title'),
648
- width: getSize(image, 'width'),
649
- height: getSize(image, 'height'),
650
- class: getAttrib(image, 'class'),
651
- style: normalizeCss(getAttrib(image, 'style')),
652
- caption: hasCaption(image),
653
- hspace: getHspace(image),
654
- vspace: getVspace(image),
655
- border: getBorder(image),
656
- borderStyle: getStyle(image, 'borderStyle'),
657
- isDecorative: getIsDecorative(image)
658
- };
659
- };
660
- var updateProp = function (image, oldData, newData, name, set) {
615
+ const read = (normalizeCss, image) => ({
616
+ src: getAttrib(image, 'src'),
617
+ alt: getAlt(image),
618
+ title: getAttrib(image, 'title'),
619
+ width: getSize(image, 'width'),
620
+ height: getSize(image, 'height'),
621
+ class: getAttrib(image, 'class'),
622
+ style: normalizeCss(getAttrib(image, 'style')),
623
+ caption: hasCaption(image),
624
+ hspace: getHspace(image),
625
+ vspace: getVspace(image),
626
+ border: getBorder(image),
627
+ borderStyle: getBorderStyle(image),
628
+ isDecorative: getIsDecorative(image)
629
+ });
630
+ const updateProp = (image, oldData, newData, name, set) => {
661
631
  if (newData[name] !== oldData[name]) {
662
- set(image, name, newData[name]);
632
+ set(image, name, String(newData[name]));
663
633
  }
664
634
  };
665
- var setAlt = function (image, alt, isDecorative) {
635
+ const setAlt = (image, alt, isDecorative) => {
666
636
  if (isDecorative) {
667
637
  DOM.setAttrib(image, 'role', 'presentation');
668
- var sugarImage = SugarElement.fromDom(image);
638
+ const sugarImage = SugarElement.fromDom(image);
669
639
  set(sugarImage, 'alt', '');
670
640
  } else {
671
641
  if (isNull(alt)) {
672
- var sugarImage = SugarElement.fromDom(image);
642
+ const sugarImage = SugarElement.fromDom(image);
673
643
  remove(sugarImage, 'alt');
674
644
  } else {
675
- var sugarImage = SugarElement.fromDom(image);
645
+ const sugarImage = SugarElement.fromDom(image);
676
646
  set(sugarImage, 'alt', alt);
677
647
  }
678
648
  if (DOM.getAttrib(image, 'role') === 'presentation') {
@@ -680,30 +650,24 @@
680
650
  }
681
651
  }
682
652
  };
683
- var updateAlt = function (image, oldData, newData) {
653
+ const updateAlt = (image, oldData, newData) => {
684
654
  if (newData.alt !== oldData.alt || newData.isDecorative !== oldData.isDecorative) {
685
655
  setAlt(image, newData.alt, newData.isDecorative);
686
656
  }
687
657
  };
688
- var normalized = function (set, normalizeCss) {
689
- return function (image, name, value) {
690
- set(image, value);
691
- normalizeStyle(image, normalizeCss);
692
- };
658
+ const normalized = (set, normalizeCss) => (image, name, value) => {
659
+ set(image, value);
660
+ normalizeStyle(image, normalizeCss);
693
661
  };
694
- var write = function (normalizeCss, newData, image) {
695
- var oldData = read(normalizeCss, image);
696
- updateProp(image, oldData, newData, 'caption', function (image, _name, _value) {
697
- return toggleCaption(image);
698
- });
662
+ const write = (normalizeCss, newData, image) => {
663
+ const oldData = read(normalizeCss, image);
664
+ updateProp(image, oldData, newData, 'caption', (image, _name, _value) => toggleCaption(image));
699
665
  updateProp(image, oldData, newData, 'src', updateAttrib);
700
666
  updateProp(image, oldData, newData, 'title', updateAttrib);
701
667
  updateProp(image, oldData, newData, 'width', setSize('width', normalizeCss));
702
668
  updateProp(image, oldData, newData, 'height', setSize('height', normalizeCss));
703
669
  updateProp(image, oldData, newData, 'class', updateAttrib);
704
- updateProp(image, oldData, newData, 'style', normalized(function (image, value) {
705
- return updateAttrib(image, 'style', value);
706
- }, normalizeCss));
670
+ updateProp(image, oldData, newData, 'style', normalized((image, value) => updateAttrib(image, 'style', value), normalizeCss));
707
671
  updateProp(image, oldData, newData, 'hspace', normalized(setHspace, normalizeCss));
708
672
  updateProp(image, oldData, newData, 'vspace', normalized(setVspace, normalizeCss));
709
673
  updateProp(image, oldData, newData, 'border', normalized(setBorder, normalizeCss));
@@ -711,15 +675,15 @@
711
675
  updateAlt(image, oldData, newData);
712
676
  };
713
677
 
714
- var normalizeCss = function (editor, cssText) {
715
- var css = editor.dom.styles.parse(cssText);
716
- var mergedCss = mergeMargins(css);
717
- var compressed = editor.dom.styles.parse(editor.dom.styles.serialize(mergedCss));
678
+ const normalizeCss$1 = (editor, cssText) => {
679
+ const css = editor.dom.styles.parse(cssText);
680
+ const mergedCss = mergeMargins(css);
681
+ const compressed = editor.dom.styles.parse(editor.dom.styles.serialize(mergedCss));
718
682
  return editor.dom.styles.serialize(compressed);
719
683
  };
720
- var getSelectedImage = function (editor) {
721
- var imgElm = editor.selection.getNode();
722
- var figureElm = editor.dom.getParent(imgElm, 'figure.image');
684
+ const getSelectedImage = editor => {
685
+ const imgElm = editor.selection.getNode();
686
+ const figureElm = editor.dom.getParent(imgElm, 'figure.image');
723
687
  if (figureElm) {
724
688
  return editor.dom.select('img', figureElm)[0];
725
689
  }
@@ -728,48 +692,41 @@
728
692
  }
729
693
  return imgElm;
730
694
  };
731
- var splitTextBlock = function (editor, figure) {
732
- var dom = editor.dom;
733
- var textBlockElements = filter(editor.schema.getTextBlockElements(), function (_, parentElm) {
734
- return !editor.schema.isValidChild(parentElm, 'figure');
735
- });
736
- var textBlock = dom.getParent(figure.parentNode, function (node) {
737
- return hasNonNullableKey(textBlockElements, node.nodeName);
738
- }, editor.getBody());
695
+ const splitTextBlock = (editor, figure) => {
696
+ var _a;
697
+ const dom = editor.dom;
698
+ const textBlockElements = filter(editor.schema.getTextBlockElements(), (_, parentElm) => !editor.schema.isValidChild(parentElm, 'figure'));
699
+ const textBlock = dom.getParent(figure.parentNode, node => hasNonNullableKey(textBlockElements, node.nodeName), editor.getBody());
739
700
  if (textBlock) {
740
- return dom.split(textBlock, figure);
701
+ return (_a = dom.split(textBlock, figure)) !== null && _a !== void 0 ? _a : figure;
741
702
  } else {
742
703
  return figure;
743
704
  }
744
705
  };
745
- var readImageDataFromSelection = function (editor) {
746
- var image = getSelectedImage(editor);
747
- return image ? read(function (css) {
748
- return normalizeCss(editor, css);
749
- }, image) : defaultData();
706
+ const readImageDataFromSelection = editor => {
707
+ const image = getSelectedImage(editor);
708
+ return image ? read(css => normalizeCss$1(editor, css), image) : defaultData();
750
709
  };
751
- var insertImageAtCaret = function (editor, data) {
752
- var elm = create(function (css) {
753
- return normalizeCss(editor, css);
754
- }, data);
710
+ const insertImageAtCaret = (editor, data) => {
711
+ const elm = create(css => normalizeCss$1(editor, css), data);
755
712
  editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
756
713
  editor.focus();
757
714
  editor.selection.setContent(elm.outerHTML);
758
- var insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
715
+ const insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
759
716
  editor.dom.setAttrib(insertedElm, 'data-mce-id', null);
760
717
  if (isFigure(insertedElm)) {
761
- var figure = splitTextBlock(editor, insertedElm);
718
+ const figure = splitTextBlock(editor, insertedElm);
762
719
  editor.selection.select(figure);
763
720
  } else {
764
721
  editor.selection.select(insertedElm);
765
722
  }
766
723
  };
767
- var syncSrcAttr = function (editor, image) {
724
+ const syncSrcAttr = (editor, image) => {
768
725
  editor.dom.setAttrib(image, 'src', image.getAttribute('src'));
769
726
  };
770
- var deleteImage = function (editor, image) {
727
+ const deleteImage = (editor, image) => {
771
728
  if (image) {
772
- var elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
729
+ const elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
773
730
  editor.dom.remove(elm);
774
731
  editor.focus();
775
732
  editor.nodeChanged();
@@ -779,57 +736,64 @@
779
736
  }
780
737
  }
781
738
  };
782
- var writeImageDataToSelection = function (editor, data) {
783
- var image = getSelectedImage(editor);
784
- write(function (css) {
785
- return normalizeCss(editor, css);
786
- }, data, image);
787
- syncSrcAttr(editor, image);
788
- if (isFigure(image.parentNode)) {
789
- var figure = image.parentNode;
790
- splitTextBlock(editor, figure);
791
- editor.selection.select(image.parentNode);
792
- } else {
793
- editor.selection.select(image);
794
- waitLoadImage(editor, data, image);
739
+ const writeImageDataToSelection = (editor, data) => {
740
+ const image = getSelectedImage(editor);
741
+ if (image) {
742
+ write(css => normalizeCss$1(editor, css), data, image);
743
+ syncSrcAttr(editor, image);
744
+ if (isFigure(image.parentNode)) {
745
+ const figure = image.parentNode;
746
+ splitTextBlock(editor, figure);
747
+ editor.selection.select(image.parentNode);
748
+ } else {
749
+ editor.selection.select(image);
750
+ waitLoadImage(editor, data, image);
751
+ }
795
752
  }
796
753
  };
797
- var insertOrUpdateImage = function (editor, partialData) {
798
- var image = getSelectedImage(editor);
754
+ const sanitizeImageData = (editor, data) => {
755
+ const src = data.src;
756
+ return {
757
+ ...data,
758
+ src: isSafeImageUrl(editor, src) ? src : ''
759
+ };
760
+ };
761
+ const insertOrUpdateImage = (editor, partialData) => {
762
+ const image = getSelectedImage(editor);
799
763
  if (image) {
800
- var selectedImageData = read(function (css) {
801
- return normalizeCss(editor, css);
802
- }, image);
803
- var data = __assign(__assign({}, selectedImageData), partialData);
764
+ const selectedImageData = read(css => normalizeCss$1(editor, css), image);
765
+ const data = {
766
+ ...selectedImageData,
767
+ ...partialData
768
+ };
769
+ const sanitizedData = sanitizeImageData(editor, data);
804
770
  if (data.src) {
805
- writeImageDataToSelection(editor, data);
771
+ writeImageDataToSelection(editor, sanitizedData);
806
772
  } else {
807
773
  deleteImage(editor, image);
808
774
  }
809
775
  } else if (partialData.src) {
810
- insertImageAtCaret(editor, __assign(__assign({}, defaultData()), partialData));
776
+ insertImageAtCaret(editor, {
777
+ ...defaultData(),
778
+ ...partialData
779
+ });
811
780
  }
812
781
  };
813
782
 
814
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
815
- var deep = function (old, nu) {
816
- var bothObjects = isObject(old) && isObject(nu);
783
+ const deep = (old, nu) => {
784
+ const bothObjects = isPlainObject(old) && isPlainObject(nu);
817
785
  return bothObjects ? deepMerge(old, nu) : nu;
818
786
  };
819
- var baseMerge = function (merger) {
820
- return function () {
821
- var objects = [];
822
- for (var _i = 0; _i < arguments.length; _i++) {
823
- objects[_i] = arguments[_i];
824
- }
787
+ const baseMerge = merger => {
788
+ return (...objects) => {
825
789
  if (objects.length === 0) {
826
- throw new Error('Can\'t merge zero objects');
790
+ throw new Error(`Can't merge zero objects`);
827
791
  }
828
- var ret = {};
829
- for (var j = 0; j < objects.length; j++) {
830
- var curObject = objects[j];
831
- for (var key in curObject) {
832
- if (hasOwnProperty$1.call(curObject, key)) {
792
+ const ret = {};
793
+ for (let j = 0; j < objects.length; j++) {
794
+ const curObject = objects[j];
795
+ for (const key in curObject) {
796
+ if (has(curObject, key)) {
833
797
  ret[key] = merger(ret[key], curObject[key]);
834
798
  }
835
799
  }
@@ -837,20 +801,14 @@
837
801
  return ret;
838
802
  };
839
803
  };
840
- var deepMerge = baseMerge(deep);
804
+ const deepMerge = baseMerge(deep);
841
805
 
842
- var isNotEmpty = function (s) {
843
- return s.length > 0;
844
- };
806
+ var global$1 = tinymce.util.Tools.resolve('tinymce.util.ImageUploader');
845
807
 
846
- var global$4 = tinymce.util.Tools.resolve('tinymce.util.ImageUploader');
808
+ var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
847
809
 
848
- var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
849
-
850
- var getValue = function (item) {
851
- return isString(item.value) ? item.value : '';
852
- };
853
- var getText = function (item) {
810
+ const getValue = item => isString(item.value) ? item.value : '';
811
+ const getText = item => {
854
812
  if (isString(item.text)) {
855
813
  return item.text;
856
814
  } else if (isString(item.title)) {
@@ -859,241 +817,206 @@
859
817
  return '';
860
818
  }
861
819
  };
862
- var sanitizeList = function (list, extractValue) {
863
- var out = [];
864
- global$5.each(list, function (item) {
865
- var text = getText(item);
820
+ const sanitizeList = (list, extractValue) => {
821
+ const out = [];
822
+ global.each(list, item => {
823
+ const text = getText(item);
866
824
  if (item.menu !== undefined) {
867
- var items = sanitizeList(item.menu, extractValue);
825
+ const items = sanitizeList(item.menu, extractValue);
868
826
  out.push({
869
- text: text,
870
- items: items
827
+ text,
828
+ items
871
829
  });
872
830
  } else {
873
- var value = extractValue(item);
831
+ const value = extractValue(item);
874
832
  out.push({
875
- text: text,
876
- value: value
833
+ text,
834
+ value
877
835
  });
878
836
  }
879
837
  });
880
838
  return out;
881
839
  };
882
- var sanitizer = function (extracter) {
883
- if (extracter === void 0) {
884
- extracter = getValue;
840
+ const sanitizer = (extractor = getValue) => list => {
841
+ if (list) {
842
+ return Optional.from(list).map(list => sanitizeList(list, extractor));
843
+ } else {
844
+ return Optional.none();
885
845
  }
886
- return function (list) {
887
- if (list) {
888
- return Optional.from(list).map(function (list) {
889
- return sanitizeList(list, extracter);
890
- });
891
- } else {
892
- return Optional.none();
893
- }
894
- };
895
- };
896
- var sanitize = function (list) {
897
- return sanitizer(getValue)(list);
898
846
  };
899
- var isGroup = function (item) {
900
- return Object.prototype.hasOwnProperty.call(item, 'items');
901
- };
902
- var findEntryDelegate = function (list, value) {
903
- return findMap(list, function (item) {
904
- if (isGroup(item)) {
905
- return findEntryDelegate(item.items, value);
906
- } else if (item.value === value) {
907
- return Optional.some(item);
908
- } else {
909
- return Optional.none();
910
- }
911
- });
912
- };
913
- var findEntry = function (optList, value) {
914
- return optList.bind(function (list) {
915
- return findEntryDelegate(list, value);
916
- });
917
- };
918
- var ListUtils = {
919
- sanitizer: sanitizer,
920
- sanitize: sanitize,
921
- findEntry: findEntry
922
- };
923
-
924
- var makeTab = function (_info) {
925
- return {
926
- title: 'Advanced',
927
- name: 'advanced',
928
- items: [
929
- {
930
- type: 'input',
931
- label: 'Style',
932
- name: 'style'
933
- },
934
- {
935
- type: 'grid',
936
- columns: 2,
937
- items: [
938
- {
939
- type: 'input',
940
- label: 'Vertical space',
941
- name: 'vspace',
942
- inputMode: 'numeric'
943
- },
944
- {
945
- type: 'input',
946
- label: 'Horizontal space',
947
- name: 'hspace',
948
- inputMode: 'numeric'
949
- },
950
- {
951
- type: 'input',
952
- label: 'Border width',
953
- name: 'border',
954
- inputMode: 'numeric'
955
- },
956
- {
957
- type: 'listbox',
958
- name: 'borderstyle',
959
- label: 'Border style',
960
- items: [
961
- {
962
- text: 'Select...',
963
- value: ''
964
- },
965
- {
966
- text: 'Solid',
967
- value: 'solid'
968
- },
969
- {
970
- text: 'Dotted',
971
- value: 'dotted'
972
- },
973
- {
974
- text: 'Dashed',
975
- value: 'dashed'
976
- },
977
- {
978
- text: 'Double',
979
- value: 'double'
980
- },
981
- {
982
- text: 'Groove',
983
- value: 'groove'
984
- },
985
- {
986
- text: 'Ridge',
987
- value: 'ridge'
988
- },
989
- {
990
- text: 'Inset',
991
- value: 'inset'
992
- },
993
- {
994
- text: 'Outset',
995
- value: 'outset'
996
- },
997
- {
998
- text: 'None',
999
- value: 'none'
1000
- },
1001
- {
1002
- text: 'Hidden',
1003
- value: 'hidden'
1004
- }
1005
- ]
1006
- }
1007
- ]
1008
- }
1009
- ]
1010
- };
847
+ const sanitize = list => sanitizer(getValue)(list);
848
+ const isGroup = item => has(item, 'items');
849
+ const findEntryDelegate = (list, value) => findMap(list, item => {
850
+ if (isGroup(item)) {
851
+ return findEntryDelegate(item.items, value);
852
+ } else if (item.value === value) {
853
+ return Optional.some(item);
854
+ } else {
855
+ return Optional.none();
856
+ }
857
+ });
858
+ const findEntry = (optList, value) => optList.bind(list => findEntryDelegate(list, value));
859
+ const ListUtils = {
860
+ sanitizer,
861
+ sanitize,
862
+ findEntry
1011
863
  };
1012
- var AdvTab = { makeTab: makeTab };
1013
864
 
1014
- var collect = function (editor) {
1015
- var urlListSanitizer = ListUtils.sanitizer(function (item) {
1016
- return editor.convertURL(item.value || item.url, 'src');
1017
- });
1018
- var futureImageList = new global$2(function (completer) {
1019
- createImageList(editor, function (imageList) {
1020
- completer(urlListSanitizer(imageList).map(function (items) {
1021
- return flatten([
1022
- [{
1023
- text: 'None',
865
+ const makeTab$2 = _info => ({
866
+ title: 'Advanced',
867
+ name: 'advanced',
868
+ items: [{
869
+ type: 'grid',
870
+ columns: 2,
871
+ items: [
872
+ {
873
+ type: 'input',
874
+ label: 'Vertical space',
875
+ name: 'vspace',
876
+ inputMode: 'numeric'
877
+ },
878
+ {
879
+ type: 'input',
880
+ label: 'Horizontal space',
881
+ name: 'hspace',
882
+ inputMode: 'numeric'
883
+ },
884
+ {
885
+ type: 'input',
886
+ label: 'Border width',
887
+ name: 'border',
888
+ inputMode: 'numeric'
889
+ },
890
+ {
891
+ type: 'listbox',
892
+ name: 'borderstyle',
893
+ label: 'Border style',
894
+ items: [
895
+ {
896
+ text: 'Select...',
1024
897
  value: ''
1025
- }],
1026
- items
1027
- ]);
1028
- }));
898
+ },
899
+ {
900
+ text: 'Solid',
901
+ value: 'solid'
902
+ },
903
+ {
904
+ text: 'Dotted',
905
+ value: 'dotted'
906
+ },
907
+ {
908
+ text: 'Dashed',
909
+ value: 'dashed'
910
+ },
911
+ {
912
+ text: 'Double',
913
+ value: 'double'
914
+ },
915
+ {
916
+ text: 'Groove',
917
+ value: 'groove'
918
+ },
919
+ {
920
+ text: 'Ridge',
921
+ value: 'ridge'
922
+ },
923
+ {
924
+ text: 'Inset',
925
+ value: 'inset'
926
+ },
927
+ {
928
+ text: 'Outset',
929
+ value: 'outset'
930
+ },
931
+ {
932
+ text: 'None',
933
+ value: 'none'
934
+ },
935
+ {
936
+ text: 'Hidden',
937
+ value: 'hidden'
938
+ }
939
+ ]
940
+ }
941
+ ]
942
+ }]
943
+ });
944
+ const AdvTab = { makeTab: makeTab$2 };
945
+
946
+ const collect = editor => {
947
+ const urlListSanitizer = ListUtils.sanitizer(item => editor.convertURL(item.value || item.url || '', 'src'));
948
+ const futureImageList = new Promise(completer => {
949
+ createImageList(editor, imageList => {
950
+ completer(urlListSanitizer(imageList).map(items => flatten([
951
+ [{
952
+ text: 'None',
953
+ value: ''
954
+ }],
955
+ items
956
+ ])));
1029
957
  });
1030
958
  });
1031
- var classList = ListUtils.sanitize(getClassList(editor));
1032
- var hasAdvTab$1 = hasAdvTab(editor);
1033
- var hasUploadTab$1 = hasUploadTab(editor);
1034
- var hasUploadUrl$1 = hasUploadUrl(editor);
1035
- var hasUploadHandler$1 = hasUploadHandler(editor);
1036
- var image = readImageDataFromSelection(editor);
1037
- var hasDescription$1 = hasDescription(editor);
1038
- var hasImageTitle$1 = hasImageTitle(editor);
1039
- var hasDimensions$1 = hasDimensions(editor);
1040
- var hasImageCaption$1 = hasImageCaption(editor);
1041
- var hasAccessibilityOptions = showAccessibilityOptions(editor);
1042
- var automaticUploads = isAutomaticUploadsEnabled(editor);
1043
- var prependURL = Optional.some(getPrependUrl(editor)).filter(function (preUrl) {
1044
- return isString(preUrl) && preUrl.length > 0;
1045
- });
1046
- return futureImageList.then(function (imageList) {
1047
- return {
1048
- image: image,
1049
- imageList: imageList,
1050
- classList: classList,
1051
- hasAdvTab: hasAdvTab$1,
1052
- hasUploadTab: hasUploadTab$1,
1053
- hasUploadUrl: hasUploadUrl$1,
1054
- hasUploadHandler: hasUploadHandler$1,
1055
- hasDescription: hasDescription$1,
1056
- hasImageTitle: hasImageTitle$1,
1057
- hasDimensions: hasDimensions$1,
1058
- hasImageCaption: hasImageCaption$1,
1059
- prependURL: prependURL,
1060
- hasAccessibilityOptions: hasAccessibilityOptions,
1061
- automaticUploads: automaticUploads
1062
- };
1063
- });
959
+ const classList = ListUtils.sanitize(getClassList(editor));
960
+ const hasAdvTab$1 = hasAdvTab(editor);
961
+ const hasUploadTab$1 = hasUploadTab(editor);
962
+ const hasUploadUrl$1 = hasUploadUrl(editor);
963
+ const hasUploadHandler$1 = hasUploadHandler(editor);
964
+ const image = readImageDataFromSelection(editor);
965
+ const hasDescription$1 = hasDescription(editor);
966
+ const hasImageTitle$1 = hasImageTitle(editor);
967
+ const hasDimensions$1 = hasDimensions(editor);
968
+ const hasImageCaption$1 = hasImageCaption(editor);
969
+ const hasAccessibilityOptions = showAccessibilityOptions(editor);
970
+ const automaticUploads = isAutomaticUploadsEnabled(editor);
971
+ const prependURL = Optional.some(getPrependUrl(editor)).filter(preUrl => isString(preUrl) && preUrl.length > 0);
972
+ return futureImageList.then(imageList => ({
973
+ image,
974
+ imageList,
975
+ classList,
976
+ hasAdvTab: hasAdvTab$1,
977
+ hasUploadTab: hasUploadTab$1,
978
+ hasUploadUrl: hasUploadUrl$1,
979
+ hasUploadHandler: hasUploadHandler$1,
980
+ hasDescription: hasDescription$1,
981
+ hasImageTitle: hasImageTitle$1,
982
+ hasDimensions: hasDimensions$1,
983
+ hasImageCaption: hasImageCaption$1,
984
+ prependURL,
985
+ hasAccessibilityOptions,
986
+ automaticUploads
987
+ }));
1064
988
  };
1065
989
 
1066
- var makeItems = function (info) {
1067
- var imageUrl = {
990
+ const makeItems = info => {
991
+ const imageUrl = {
1068
992
  name: 'src',
1069
993
  type: 'urlinput',
1070
994
  filetype: 'image',
1071
- label: 'Source'
995
+ label: 'Source',
996
+ picker_text: 'Browse files'
1072
997
  };
1073
- var imageList = info.imageList.map(function (items) {
1074
- return {
1075
- name: 'images',
1076
- type: 'listbox',
1077
- label: 'Image list',
1078
- items: items
1079
- };
1080
- });
1081
- var imageDescription = {
998
+ const imageList = info.imageList.map(items => ({
999
+ name: 'images',
1000
+ type: 'listbox',
1001
+ label: 'Image list',
1002
+ items
1003
+ }));
1004
+ const imageDescription = {
1082
1005
  name: 'alt',
1083
1006
  type: 'input',
1084
1007
  label: 'Alternative description',
1085
- disabled: info.hasAccessibilityOptions && info.image.isDecorative
1008
+ enabled: !(info.hasAccessibilityOptions && info.image.isDecorative)
1086
1009
  };
1087
- var imageTitle = {
1010
+ const imageTitle = {
1088
1011
  name: 'title',
1089
1012
  type: 'input',
1090
1013
  label: 'Image title'
1091
1014
  };
1092
- var imageDimensions = {
1015
+ const imageDimensions = {
1093
1016
  name: 'dimensions',
1094
1017
  type: 'sizeinput'
1095
1018
  };
1096
- var isDecorative = {
1019
+ const isDecorative = {
1097
1020
  type: 'label',
1098
1021
  label: 'Accessibility',
1099
1022
  items: [{
@@ -1102,15 +1025,13 @@
1102
1025
  label: 'Image is decorative'
1103
1026
  }]
1104
1027
  };
1105
- var classList = info.classList.map(function (items) {
1106
- return {
1107
- name: 'classes',
1108
- type: 'listbox',
1109
- label: 'Class',
1110
- items: items
1111
- };
1112
- });
1113
- var caption = {
1028
+ const classList = info.classList.map(items => ({
1029
+ name: 'classes',
1030
+ type: 'listbox',
1031
+ label: 'Class',
1032
+ items
1033
+ }));
1034
+ const caption = {
1114
1035
  type: 'label',
1115
1036
  label: 'Caption',
1116
1037
  items: [{
@@ -1119,12 +1040,10 @@
1119
1040
  label: 'Show caption'
1120
1041
  }]
1121
1042
  };
1122
- var getDialogContainerType = function (useColumns) {
1123
- return useColumns ? {
1124
- type: 'grid',
1125
- columns: 2
1126
- } : { type: 'panel' };
1127
- };
1043
+ const getDialogContainerType = useColumns => useColumns ? {
1044
+ type: 'grid',
1045
+ columns: 2
1046
+ } : { type: 'panel' };
1128
1047
  return flatten([
1129
1048
  [imageUrl],
1130
1049
  imageList.toArray(),
@@ -1132,90 +1051,83 @@
1132
1051
  info.hasDescription ? [imageDescription] : [],
1133
1052
  info.hasImageTitle ? [imageTitle] : [],
1134
1053
  info.hasDimensions ? [imageDimensions] : [],
1135
- [__assign(__assign({}, getDialogContainerType(info.classList.isSome() && info.hasImageCaption)), {
1054
+ [{
1055
+ ...getDialogContainerType(info.classList.isSome() && info.hasImageCaption),
1136
1056
  items: flatten([
1137
1057
  classList.toArray(),
1138
1058
  info.hasImageCaption ? [caption] : []
1139
1059
  ])
1140
- })]
1060
+ }]
1141
1061
  ]);
1142
1062
  };
1143
- var makeTab$1 = function (info) {
1144
- return {
1145
- title: 'General',
1146
- name: 'general',
1147
- items: makeItems(info)
1148
- };
1149
- };
1150
- var MainTab = {
1063
+ const makeTab$1 = info => ({
1064
+ title: 'General',
1065
+ name: 'general',
1066
+ items: makeItems(info)
1067
+ });
1068
+ const MainTab = {
1151
1069
  makeTab: makeTab$1,
1152
- makeItems: makeItems
1070
+ makeItems
1153
1071
  };
1154
1072
 
1155
- var makeTab$2 = function (_info) {
1156
- var items = [{
1073
+ const makeTab = _info => {
1074
+ const items = [{
1157
1075
  type: 'dropzone',
1158
1076
  name: 'fileinput'
1159
1077
  }];
1160
1078
  return {
1161
1079
  title: 'Upload',
1162
1080
  name: 'upload',
1163
- items: items
1081
+ items
1164
1082
  };
1165
1083
  };
1166
- var UploadTab = { makeTab: makeTab$2 };
1084
+ const UploadTab = { makeTab };
1167
1085
 
1168
- var createState = function (info) {
1169
- return {
1170
- prevImage: ListUtils.findEntry(info.imageList, info.image.src),
1171
- prevAlt: info.image.alt,
1172
- open: true
1173
- };
1174
- };
1175
- var fromImageData = function (image) {
1176
- return {
1177
- src: {
1178
- value: image.src,
1179
- meta: {}
1180
- },
1181
- images: image.src,
1182
- alt: image.alt,
1183
- title: image.title,
1184
- dimensions: {
1185
- width: image.width,
1186
- height: image.height
1187
- },
1188
- classes: image.class,
1189
- caption: image.caption,
1190
- style: image.style,
1191
- vspace: image.vspace,
1192
- border: image.border,
1193
- hspace: image.hspace,
1194
- borderstyle: image.borderStyle,
1195
- fileinput: [],
1196
- isDecorative: image.isDecorative
1197
- };
1198
- };
1199
- var toImageData = function (data, removeEmptyAlt) {
1200
- return {
1201
- src: data.src.value,
1202
- alt: data.alt.length === 0 && removeEmptyAlt ? null : data.alt,
1203
- title: data.title,
1204
- width: data.dimensions.width,
1205
- height: data.dimensions.height,
1206
- class: data.classes,
1207
- style: data.style,
1208
- caption: data.caption,
1209
- hspace: data.hspace,
1210
- vspace: data.vspace,
1211
- border: data.border,
1212
- borderStyle: data.borderstyle,
1213
- isDecorative: data.isDecorative
1214
- };
1215
- };
1216
- var addPrependUrl2 = function (info, srcURL) {
1086
+ const createState = info => ({
1087
+ prevImage: ListUtils.findEntry(info.imageList, info.image.src),
1088
+ prevAlt: info.image.alt,
1089
+ open: true
1090
+ });
1091
+ const fromImageData = image => ({
1092
+ src: {
1093
+ value: image.src,
1094
+ meta: {}
1095
+ },
1096
+ images: image.src,
1097
+ alt: image.alt,
1098
+ title: image.title,
1099
+ dimensions: {
1100
+ width: image.width,
1101
+ height: image.height
1102
+ },
1103
+ classes: image.class,
1104
+ caption: image.caption,
1105
+ style: image.style,
1106
+ vspace: image.vspace,
1107
+ border: image.border,
1108
+ hspace: image.hspace,
1109
+ borderstyle: image.borderStyle,
1110
+ fileinput: [],
1111
+ isDecorative: image.isDecorative
1112
+ });
1113
+ const toImageData = (data, removeEmptyAlt) => ({
1114
+ src: data.src.value,
1115
+ alt: (data.alt === null || data.alt.length === 0) && removeEmptyAlt ? null : data.alt,
1116
+ title: data.title,
1117
+ width: data.dimensions.width,
1118
+ height: data.dimensions.height,
1119
+ class: data.classes,
1120
+ style: data.style,
1121
+ caption: data.caption,
1122
+ hspace: data.hspace,
1123
+ vspace: data.vspace,
1124
+ border: data.border,
1125
+ borderStyle: data.borderstyle,
1126
+ isDecorative: data.isDecorative
1127
+ });
1128
+ const addPrependUrl2 = (info, srcURL) => {
1217
1129
  if (!/^(?:[a-zA-Z]+:)?\/\//.test(srcURL)) {
1218
- return info.prependURL.bind(function (prependUrl) {
1130
+ return info.prependURL.bind(prependUrl => {
1219
1131
  if (srcURL.substring(0, prependUrl.length) !== prependUrl) {
1220
1132
  return Optional.some(prependUrl + srcURL);
1221
1133
  }
@@ -1224,9 +1136,9 @@
1224
1136
  }
1225
1137
  return Optional.none();
1226
1138
  };
1227
- var addPrependUrl = function (info, api) {
1228
- var data = api.getData();
1229
- addPrependUrl2(info, data.src.value).each(function (srcURL) {
1139
+ const addPrependUrl = (info, api) => {
1140
+ const data = api.getData();
1141
+ addPrependUrl2(info, data.src.value).each(srcURL => {
1230
1142
  api.setData({
1231
1143
  src: {
1232
1144
  value: srcURL,
@@ -1235,7 +1147,7 @@
1235
1147
  });
1236
1148
  });
1237
1149
  };
1238
- var formFillFromMeta2 = function (info, data, meta) {
1150
+ const formFillFromMeta2 = (info, data, meta) => {
1239
1151
  if (info.hasDescription && isString(meta.alt)) {
1240
1152
  data.alt = meta.alt;
1241
1153
  }
@@ -1254,7 +1166,7 @@
1254
1166
  }
1255
1167
  }
1256
1168
  if (isString(meta.class)) {
1257
- ListUtils.findEntry(info.classList, meta.class).each(function (entry) {
1169
+ ListUtils.findEntry(info.classList, meta.class).each(entry => {
1258
1170
  data.classes = entry.value;
1259
1171
  });
1260
1172
  }
@@ -1281,28 +1193,26 @@
1281
1193
  }
1282
1194
  }
1283
1195
  };
1284
- var formFillFromMeta = function (info, api) {
1285
- var data = api.getData();
1286
- var meta = data.src.meta;
1196
+ const formFillFromMeta = (info, api) => {
1197
+ const data = api.getData();
1198
+ const meta = data.src.meta;
1287
1199
  if (meta !== undefined) {
1288
- var newData = deepMerge({}, data);
1200
+ const newData = deepMerge({}, data);
1289
1201
  formFillFromMeta2(info, newData, meta);
1290
1202
  api.setData(newData);
1291
1203
  }
1292
1204
  };
1293
- var calculateImageSize = function (helpers, info, state, api) {
1294
- var data = api.getData();
1295
- var url = data.src.value;
1296
- var meta = data.src.meta || {};
1205
+ const calculateImageSize = (helpers, info, state, api) => {
1206
+ const data = api.getData();
1207
+ const url = data.src.value;
1208
+ const meta = data.src.meta || {};
1297
1209
  if (!meta.width && !meta.height && info.hasDimensions) {
1298
1210
  if (isNotEmpty(url)) {
1299
- helpers.imageSize(url).then(function (size) {
1211
+ helpers.imageSize(url).then(size => {
1300
1212
  if (state.open) {
1301
1213
  api.setData({ dimensions: size });
1302
1214
  }
1303
- }).catch(function (e) {
1304
- return console.error(e);
1305
- });
1215
+ }).catch(e => console.error(e));
1306
1216
  } else {
1307
1217
  api.setData({
1308
1218
  dimensions: {
@@ -1313,29 +1223,23 @@
1313
1223
  }
1314
1224
  }
1315
1225
  };
1316
- var updateImagesDropdown = function (info, state, api) {
1317
- var data = api.getData();
1318
- var image = ListUtils.findEntry(info.imageList, data.src.value);
1226
+ const updateImagesDropdown = (info, state, api) => {
1227
+ const data = api.getData();
1228
+ const image = ListUtils.findEntry(info.imageList, data.src.value);
1319
1229
  state.prevImage = image;
1320
- api.setData({
1321
- images: image.map(function (entry) {
1322
- return entry.value;
1323
- }).getOr('')
1324
- });
1230
+ api.setData({ images: image.map(entry => entry.value).getOr('') });
1325
1231
  };
1326
- var changeSrc = function (helpers, info, state, api) {
1232
+ const changeSrc = (helpers, info, state, api) => {
1327
1233
  addPrependUrl(info, api);
1328
1234
  formFillFromMeta(info, api);
1329
1235
  calculateImageSize(helpers, info, state, api);
1330
1236
  updateImagesDropdown(info, state, api);
1331
1237
  };
1332
- var changeImages = function (helpers, info, state, api) {
1333
- var data = api.getData();
1334
- var image = ListUtils.findEntry(info.imageList, data.images);
1335
- image.each(function (img) {
1336
- var updateAlt = data.alt === '' || state.prevImage.map(function (image) {
1337
- return image.text === data.alt;
1338
- }).getOr(false);
1238
+ const changeImages = (helpers, info, state, api) => {
1239
+ const data = api.getData();
1240
+ const image = ListUtils.findEntry(info.imageList, data.images);
1241
+ image.each(img => {
1242
+ const updateAlt = data.alt === '' || state.prevImage.map(image => image.text === data.alt).getOr(false);
1339
1243
  if (updateAlt) {
1340
1244
  if (img.value === '') {
1341
1245
  api.setData({
@@ -1355,55 +1259,18 @@
1355
1259
  state.prevImage = image;
1356
1260
  changeSrc(helpers, info, state, api);
1357
1261
  };
1358
- var calcVSpace = function (css) {
1359
- var matchingTopBottom = css['margin-top'] && css['margin-bottom'] && css['margin-top'] === css['margin-bottom'];
1360
- return matchingTopBottom ? removePixelSuffix(String(css['margin-top'])) : '';
1361
- };
1362
- var calcHSpace = function (css) {
1363
- var matchingLeftRight = css['margin-right'] && css['margin-left'] && css['margin-right'] === css['margin-left'];
1364
- return matchingLeftRight ? removePixelSuffix(String(css['margin-right'])) : '';
1365
- };
1366
- var calcBorderWidth = function (css) {
1367
- return css['border-width'] ? removePixelSuffix(String(css['border-width'])) : '';
1368
- };
1369
- var calcBorderStyle = function (css) {
1370
- return css['border-style'] ? String(css['border-style']) : '';
1371
- };
1372
- var calcStyle = function (parseStyle, serializeStyle, css) {
1373
- return serializeStyle(parseStyle(serializeStyle(css)));
1374
- };
1375
- var changeStyle2 = function (parseStyle, serializeStyle, data) {
1376
- var css = mergeMargins(parseStyle(data.style));
1377
- var dataCopy = deepMerge({}, data);
1378
- dataCopy.vspace = calcVSpace(css);
1379
- dataCopy.hspace = calcHSpace(css);
1380
- dataCopy.border = calcBorderWidth(css);
1381
- dataCopy.borderstyle = calcBorderStyle(css);
1382
- dataCopy.style = calcStyle(parseStyle, serializeStyle, css);
1383
- return dataCopy;
1384
- };
1385
- var changeStyle = function (helpers, api) {
1386
- var data = api.getData();
1387
- var newData = changeStyle2(helpers.parseStyle, helpers.serializeStyle, data);
1388
- api.setData(newData);
1389
- };
1390
- var changeAStyle = function (helpers, info, api) {
1391
- var data = deepMerge(fromImageData(info.image), api.getData());
1392
- var style = getStyleValue(helpers.normalizeCss, toImageData(data, false));
1393
- api.setData({ style: style });
1394
- };
1395
- var changeFileInput = function (helpers, info, state, api) {
1396
- var data = api.getData();
1262
+ const changeFileInput = (helpers, info, state, api) => {
1263
+ const data = api.getData();
1397
1264
  api.block('Uploading image');
1398
- head(data.fileinput).fold(function () {
1265
+ head(data.fileinput).fold(() => {
1399
1266
  api.unblock();
1400
- }, function (file) {
1401
- var blobUri = URL.createObjectURL(file);
1402
- var finalize = function () {
1267
+ }, file => {
1268
+ const blobUri = URL.createObjectURL(file);
1269
+ const finalize = () => {
1403
1270
  api.unblock();
1404
1271
  URL.revokeObjectURL(blobUri);
1405
1272
  };
1406
- var updateSrcAndSwitchTab = function (url) {
1273
+ const updateSrcAndSwitchTab = url => {
1407
1274
  api.setData({
1408
1275
  src: {
1409
1276
  value: url,
@@ -1413,13 +1280,13 @@
1413
1280
  api.showTab('general');
1414
1281
  changeSrc(helpers, info, state, api);
1415
1282
  };
1416
- blobToDataUri(file).then(function (dataUrl) {
1417
- var blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
1283
+ blobToDataUri(file).then(dataUrl => {
1284
+ const blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
1418
1285
  if (info.automaticUploads) {
1419
- helpers.uploadImage(blobInfo).then(function (result) {
1286
+ helpers.uploadImage(blobInfo).then(result => {
1420
1287
  updateSrcAndSwitchTab(result.url);
1421
1288
  finalize();
1422
- }).catch(function (err) {
1289
+ }).catch(err => {
1423
1290
  finalize();
1424
1291
  helpers.alertErr(err);
1425
1292
  });
@@ -1431,37 +1298,25 @@
1431
1298
  });
1432
1299
  });
1433
1300
  };
1434
- var changeHandler = function (helpers, info, state) {
1435
- return function (api, evt) {
1436
- if (evt.name === 'src') {
1437
- changeSrc(helpers, info, state, api);
1438
- } else if (evt.name === 'images') {
1439
- changeImages(helpers, info, state, api);
1440
- } else if (evt.name === 'alt') {
1441
- state.prevAlt = api.getData().alt;
1442
- } else if (evt.name === 'style') {
1443
- changeStyle(helpers, api);
1444
- } else if (evt.name === 'vspace' || evt.name === 'hspace' || evt.name === 'border' || evt.name === 'borderstyle') {
1445
- changeAStyle(helpers, info, api);
1446
- } else if (evt.name === 'fileinput') {
1447
- changeFileInput(helpers, info, state, api);
1448
- } else if (evt.name === 'isDecorative') {
1449
- if (api.getData().isDecorative) {
1450
- api.disable('alt');
1451
- } else {
1452
- api.enable('alt');
1453
- }
1454
- }
1455
- };
1301
+ const changeHandler = (helpers, info, state) => (api, evt) => {
1302
+ if (evt.name === 'src') {
1303
+ changeSrc(helpers, info, state, api);
1304
+ } else if (evt.name === 'images') {
1305
+ changeImages(helpers, info, state, api);
1306
+ } else if (evt.name === 'alt') {
1307
+ state.prevAlt = api.getData().alt;
1308
+ } else if (evt.name === 'fileinput') {
1309
+ changeFileInput(helpers, info, state, api);
1310
+ } else if (evt.name === 'isDecorative') {
1311
+ api.setEnabled('alt', !api.getData().isDecorative);
1312
+ }
1456
1313
  };
1457
- var closeHandler = function (state) {
1458
- return function () {
1459
- state.open = false;
1460
- };
1314
+ const closeHandler = state => () => {
1315
+ state.open = false;
1461
1316
  };
1462
- var makeDialogBody = function (info) {
1317
+ const makeDialogBody = info => {
1463
1318
  if (info.hasAdvTab || info.hasUploadUrl || info.hasUploadHandler) {
1464
- var tabPanel = {
1319
+ const tabPanel = {
1465
1320
  type: 'tabpanel',
1466
1321
  tabs: flatten([
1467
1322
  [MainTab.makeTab(info)],
@@ -1471,191 +1326,180 @@
1471
1326
  };
1472
1327
  return tabPanel;
1473
1328
  } else {
1474
- var panel = {
1329
+ const panel = {
1475
1330
  type: 'panel',
1476
1331
  items: MainTab.makeItems(info)
1477
1332
  };
1478
1333
  return panel;
1479
1334
  }
1480
1335
  };
1481
- var makeDialog = function (helpers) {
1482
- return function (info) {
1483
- var state = createState(info);
1484
- return {
1485
- title: 'Insert/Edit Image',
1486
- size: 'normal',
1487
- body: makeDialogBody(info),
1488
- buttons: [
1489
- {
1490
- type: 'cancel',
1491
- name: 'cancel',
1492
- text: 'Cancel'
1493
- },
1494
- {
1495
- type: 'submit',
1496
- name: 'save',
1497
- text: 'Save',
1498
- primary: true
1499
- }
1500
- ],
1501
- initialData: fromImageData(info.image),
1502
- onSubmit: helpers.onSubmit(info),
1503
- onChange: changeHandler(helpers, info, state),
1504
- onClose: closeHandler(state)
1505
- };
1506
- };
1507
- };
1508
- var submitHandler = function (editor) {
1509
- return function (info) {
1510
- return function (api) {
1511
- var data = deepMerge(fromImageData(info.image), api.getData());
1512
- editor.execCommand('mceUpdateImage', false, toImageData(data, info.hasAccessibilityOptions));
1513
- editor.editorUpload.uploadImagesAuto();
1514
- api.close();
1515
- };
1516
- };
1517
- };
1518
- var imageSize = function (editor) {
1519
- return function (url) {
1520
- return getImageSize(editor.documentBaseURI.toAbsolute(url)).then(function (dimensions) {
1521
- return {
1522
- width: String(dimensions.width),
1523
- height: String(dimensions.height)
1524
- };
1525
- });
1336
+ const submitHandler = (editor, info, helpers) => api => {
1337
+ const data = deepMerge(fromImageData(info.image), api.getData());
1338
+ const finalData = {
1339
+ ...data,
1340
+ style: getStyleValue(helpers.normalizeCss, toImageData(data, false))
1526
1341
  };
1527
- };
1528
- var createBlobCache = function (editor) {
1529
- return function (file, blobUri, dataUrl) {
1530
- return editor.editorUpload.blobCache.create({
1531
- blob: file,
1532
- blobUri: blobUri,
1533
- name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null,
1534
- filename: file.name,
1535
- base64: dataUrl.split(',')[1]
1342
+ editor.execCommand('mceUpdateImage', false, toImageData(finalData, info.hasAccessibilityOptions));
1343
+ editor.editorUpload.uploadImagesAuto();
1344
+ api.close();
1345
+ };
1346
+ const imageSize = editor => url => {
1347
+ if (!isSafeImageUrl(editor, url)) {
1348
+ return Promise.resolve({
1349
+ width: '',
1350
+ height: ''
1536
1351
  });
1537
- };
1538
- };
1539
- var addToBlobCache = function (editor) {
1540
- return function (blobInfo) {
1541
- editor.editorUpload.blobCache.add(blobInfo);
1542
- };
1543
- };
1544
- var alertErr = function (editor) {
1545
- return function (message) {
1546
- editor.windowManager.alert(message);
1547
- };
1548
- };
1549
- var normalizeCss$1 = function (editor) {
1550
- return function (cssText) {
1551
- return normalizeCss(editor, cssText);
1552
- };
1553
- };
1554
- var parseStyle = function (editor) {
1555
- return function (cssText) {
1556
- return editor.dom.parseStyle(cssText);
1557
- };
1558
- };
1559
- var serializeStyle = function (editor) {
1560
- return function (stylesArg, name) {
1561
- return editor.dom.serializeStyle(stylesArg, name);
1562
- };
1352
+ } else {
1353
+ return getImageSize(editor.documentBaseURI.toAbsolute(url)).then(dimensions => ({
1354
+ width: String(dimensions.width),
1355
+ height: String(dimensions.height)
1356
+ }));
1357
+ }
1563
1358
  };
1564
- var uploadImage = function (editor) {
1565
- return function (blobInfo) {
1566
- return global$4(editor).upload([blobInfo], false).then(function (results) {
1567
- if (results.length === 0) {
1568
- return global$2.reject('Failed to upload image');
1569
- } else if (results[0].status === false) {
1570
- return global$2.reject(results[0].error.message);
1571
- } else {
1572
- return results[0];
1573
- }
1574
- });
1575
- };
1359
+ const createBlobCache = editor => (file, blobUri, dataUrl) => {
1360
+ var _a;
1361
+ return editor.editorUpload.blobCache.create({
1362
+ blob: file,
1363
+ blobUri,
1364
+ name: (_a = file.name) === null || _a === void 0 ? void 0 : _a.replace(/\.[^\.]+$/, ''),
1365
+ filename: file.name,
1366
+ base64: dataUrl.split(',')[1]
1367
+ });
1576
1368
  };
1577
- var Dialog = function (editor) {
1578
- var helpers = {
1579
- onSubmit: submitHandler(editor),
1369
+ const addToBlobCache = editor => blobInfo => {
1370
+ editor.editorUpload.blobCache.add(blobInfo);
1371
+ };
1372
+ const alertErr = editor => message => {
1373
+ editor.windowManager.alert(message);
1374
+ };
1375
+ const normalizeCss = editor => cssText => normalizeCss$1(editor, cssText);
1376
+ const parseStyle = editor => cssText => editor.dom.parseStyle(cssText);
1377
+ const serializeStyle = editor => (stylesArg, name) => editor.dom.serializeStyle(stylesArg, name);
1378
+ const uploadImage = editor => blobInfo => global$1(editor).upload([blobInfo], false).then(results => {
1379
+ var _a;
1380
+ if (results.length === 0) {
1381
+ return Promise.reject('Failed to upload image');
1382
+ } else if (results[0].status === false) {
1383
+ return Promise.reject((_a = results[0].error) === null || _a === void 0 ? void 0 : _a.message);
1384
+ } else {
1385
+ return results[0];
1386
+ }
1387
+ });
1388
+ const Dialog = editor => {
1389
+ const helpers = {
1580
1390
  imageSize: imageSize(editor),
1581
1391
  addToBlobCache: addToBlobCache(editor),
1582
1392
  createBlobCache: createBlobCache(editor),
1583
1393
  alertErr: alertErr(editor),
1584
- normalizeCss: normalizeCss$1(editor),
1394
+ normalizeCss: normalizeCss(editor),
1585
1395
  parseStyle: parseStyle(editor),
1586
1396
  serializeStyle: serializeStyle(editor),
1587
1397
  uploadImage: uploadImage(editor)
1588
1398
  };
1589
- var open = function () {
1590
- collect(editor).then(makeDialog(helpers)).then(editor.windowManager.open);
1399
+ const open = () => {
1400
+ collect(editor).then(info => {
1401
+ const state = createState(info);
1402
+ return {
1403
+ title: 'Insert/Edit Image',
1404
+ size: 'normal',
1405
+ body: makeDialogBody(info),
1406
+ buttons: [
1407
+ {
1408
+ type: 'cancel',
1409
+ name: 'cancel',
1410
+ text: 'Cancel'
1411
+ },
1412
+ {
1413
+ type: 'submit',
1414
+ name: 'save',
1415
+ text: 'Save',
1416
+ primary: true
1417
+ }
1418
+ ],
1419
+ initialData: fromImageData(info.image),
1420
+ onSubmit: submitHandler(editor, info, helpers),
1421
+ onChange: changeHandler(helpers, info, state),
1422
+ onClose: closeHandler(state)
1423
+ };
1424
+ }).then(editor.windowManager.open);
1591
1425
  };
1592
- return { open: open };
1426
+ return { open };
1593
1427
  };
1594
1428
 
1595
- var register = function (editor) {
1429
+ const register$1 = editor => {
1596
1430
  editor.addCommand('mceImage', Dialog(editor).open);
1597
- editor.addCommand('mceUpdateImage', function (_ui, data) {
1598
- editor.undoManager.transact(function () {
1599
- return insertOrUpdateImage(editor, data);
1600
- });
1431
+ editor.addCommand('mceUpdateImage', (_ui, data) => {
1432
+ editor.undoManager.transact(() => insertOrUpdateImage(editor, data));
1601
1433
  });
1602
1434
  };
1603
1435
 
1604
- var hasImageClass = function (node) {
1605
- var className = node.attr('class');
1606
- return className && /\bimage\b/.test(className);
1607
- };
1608
- var toggleContentEditableState = function (state) {
1609
- return function (nodes) {
1610
- var i = nodes.length;
1611
- var toggleContentEditable = function (node) {
1612
- node.attr('contenteditable', state ? 'true' : null);
1613
- };
1614
- while (i--) {
1615
- var node = nodes[i];
1616
- if (hasImageClass(node)) {
1617
- node.attr('contenteditable', state ? 'false' : null);
1618
- global$5.each(node.getAll('figcaption'), toggleContentEditable);
1619
- }
1620
- }
1436
+ const hasImageClass = node => {
1437
+ const className = node.attr('class');
1438
+ return isNonNullable(className) && /\bimage\b/.test(className);
1439
+ };
1440
+ const toggleContentEditableState = state => nodes => {
1441
+ let i = nodes.length;
1442
+ const toggleContentEditable = node => {
1443
+ node.attr('contenteditable', state ? 'true' : null);
1621
1444
  };
1445
+ while (i--) {
1446
+ const node = nodes[i];
1447
+ if (hasImageClass(node)) {
1448
+ node.attr('contenteditable', state ? 'false' : null);
1449
+ global.each(node.getAll('figcaption'), toggleContentEditable);
1450
+ }
1451
+ }
1622
1452
  };
1623
- var setup = function (editor) {
1624
- editor.on('PreInit', function () {
1453
+ const setup = editor => {
1454
+ editor.on('PreInit', () => {
1625
1455
  editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
1626
1456
  editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
1627
1457
  });
1628
1458
  };
1629
1459
 
1630
- var register$1 = function (editor) {
1460
+ const onSetupEditable = editor => api => {
1461
+ const nodeChanged = () => {
1462
+ api.setEnabled(editor.selection.isEditable());
1463
+ };
1464
+ editor.on('NodeChange', nodeChanged);
1465
+ nodeChanged();
1466
+ return () => {
1467
+ editor.off('NodeChange', nodeChanged);
1468
+ };
1469
+ };
1470
+ const register = editor => {
1631
1471
  editor.ui.registry.addToggleButton('image', {
1632
1472
  icon: 'image',
1633
1473
  tooltip: 'Insert/edit image',
1634
1474
  onAction: Dialog(editor).open,
1635
- onSetup: function (buttonApi) {
1636
- return editor.selection.selectorChangedWithUnbind('img:not([data-mce-object],[data-mce-placeholder]),figure.image', buttonApi.setActive).unbind;
1475
+ onSetup: buttonApi => {
1476
+ buttonApi.setActive(isNonNullable(getSelectedImage(editor)));
1477
+ const unbindSelectorChanged = editor.selection.selectorChangedWithUnbind('img:not([data-mce-object]):not([data-mce-placeholder]),figure.image', buttonApi.setActive).unbind;
1478
+ const unbindEditable = onSetupEditable(editor)(buttonApi);
1479
+ return () => {
1480
+ unbindSelectorChanged();
1481
+ unbindEditable();
1482
+ };
1637
1483
  }
1638
1484
  });
1639
1485
  editor.ui.registry.addMenuItem('image', {
1640
1486
  icon: 'image',
1641
1487
  text: 'Image...',
1642
- onAction: Dialog(editor).open
1643
- });
1644
- editor.ui.registry.addContextMenu('image', {
1645
- update: function (element) {
1646
- return isFigure(element) || isImage(element) && !isPlaceholderImage(element) ? ['image'] : [];
1647
- }
1488
+ onAction: Dialog(editor).open,
1489
+ onSetup: onSetupEditable(editor)
1648
1490
  });
1491
+ editor.ui.registry.addContextMenu('image', { update: element => editor.selection.isEditable() && (isFigure(element) || isImage(element) && !isPlaceholderImage(element)) ? ['image'] : [] });
1649
1492
  };
1650
1493
 
1651
- function Plugin () {
1652
- global.add('image', function (editor) {
1494
+ var Plugin = () => {
1495
+ global$4.add('image', editor => {
1496
+ register$2(editor);
1653
1497
  setup(editor);
1654
- register$1(editor);
1655
1498
  register(editor);
1499
+ register$1(editor);
1656
1500
  });
1657
- }
1501
+ };
1658
1502
 
1659
1503
  Plugin();
1660
1504
 
1661
- }());
1505
+ })();