create-nextjs-cms 0.5.55 → 0.5.58

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 (341) hide show
  1. package/package.json +4 -4
  2. package/templates/default/CHANGELOG.md +140 -140
  3. package/templates/default/_gitignore +1 -0
  4. package/templates/default/app/(auth)/auth/login/LoginPage.tsx +14 -11
  5. package/templates/default/app/(rootLayout)/admins/page.tsx +7 -2
  6. package/templates/default/app/(rootLayout)/advanced/page.tsx +8 -2
  7. package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +17 -3
  8. package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +9 -1
  9. package/templates/default/app/(rootLayout)/dashboard-new/page.tsx +7 -0
  10. package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +11 -1
  11. package/templates/default/app/(rootLayout)/layout.tsx +8 -1
  12. package/templates/default/app/(rootLayout)/new/[section]/page.tsx +9 -1
  13. package/templates/default/app/(rootLayout)/section/[section]/page.tsx +10 -1
  14. package/templates/default/app/(rootLayout)/settings/page.tsx +7 -1
  15. package/templates/default/app/api/trpc/[trpc]/route.ts +1 -1
  16. package/templates/default/app/api/video/route.ts +1 -1
  17. package/templates/default/app/layout.tsx +5 -3
  18. package/templates/default/app/providers.tsx +10 -9
  19. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/LICENSE +191 -0
  20. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/README.md +118 -0
  21. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/install/build.js +38 -0
  22. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/install/check.js +14 -0
  23. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/channel.js +177 -0
  24. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/colour.js +195 -0
  25. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/composite.js +212 -0
  26. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/constructor.js +499 -0
  27. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/index.d.ts +1971 -0
  28. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/index.js +16 -0
  29. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/input.js +809 -0
  30. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/is.js +143 -0
  31. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/libvips.js +207 -0
  32. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/operation.js +1016 -0
  33. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/output.js +1666 -0
  34. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/resize.js +595 -0
  35. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/sharp.js +121 -0
  36. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/lib/utility.js +291 -0
  37. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/package.json +202 -0
  38. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/binding.gyp +298 -0
  39. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/common.cc +1130 -0
  40. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/common.h +402 -0
  41. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/metadata.cc +346 -0
  42. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/metadata.h +90 -0
  43. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/operations.cc +499 -0
  44. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/operations.h +137 -0
  45. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/pipeline.cc +1814 -0
  46. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/pipeline.h +408 -0
  47. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/sharp.cc +43 -0
  48. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/stats.cc +186 -0
  49. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/stats.h +62 -0
  50. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/utilities.cc +288 -0
  51. package/templates/default/apps/cms/node_modules/next/node_modules/_tmp_40516_de1b9f7e36eccb968b79dbd2b8c388ea/src/utilities.h +22 -0
  52. package/templates/default/components/BrowsePage.tsx +4 -4
  53. package/templates/default/components/DashboardNewPage.tsx +252 -0
  54. package/templates/default/components/Layout.tsx +2 -2
  55. package/templates/default/components/LogPage.tsx +2 -3
  56. package/templates/default/components/NavbarAlt.tsx +5 -5
  57. package/templates/default/components/SettingsPage.tsx +1 -1
  58. package/templates/default/components/Sidebar.tsx +7 -7
  59. package/templates/default/components/form/Form.tsx +5 -5
  60. package/templates/default/components/form/helpers/util.ts +5 -5
  61. package/templates/default/dynamic-schemas/schema.ts +381 -381
  62. package/templates/default/next-env.d.ts +1 -1
  63. package/templates/default/next.config.ts +24 -0
  64. package/templates/default/package.json +23 -17
  65. package/templates/default/{middleware.ts → proxy.ts} +3 -4
  66. package/templates/default/test/prize.section.ts +58 -0
  67. package/templates/default/tsconfig.json +6 -3
  68. package/templates/default/app/api/placeholder/route.ts +0 -7
  69. package/templates/default/components/form/helpers/_section-hot-reload.js +0 -11
  70. package/templates/default/public/tinymce/CHANGELOG.md +0 -3940
  71. package/templates/default/public/tinymce/README.md +0 -77
  72. package/templates/default/public/tinymce/bower.json +0 -27
  73. package/templates/default/public/tinymce/composer.json +0 -52
  74. package/templates/default/public/tinymce/icons/default/icons.js +0 -239
  75. package/templates/default/public/tinymce/icons/default/icons.min.js +0 -1
  76. package/templates/default/public/tinymce/icons/default/index.js +0 -7
  77. package/templates/default/public/tinymce/license.md +0 -9
  78. package/templates/default/public/tinymce/models/dom/index.js +0 -7
  79. package/templates/default/public/tinymce/models/dom/model.js +0 -8980
  80. package/templates/default/public/tinymce/models/dom/model.min.js +0 -1
  81. package/templates/default/public/tinymce/notices.txt +0 -21
  82. package/templates/default/public/tinymce/package.json +0 -32
  83. package/templates/default/public/tinymce/plugins/accordion/index.js +0 -7
  84. package/templates/default/public/tinymce/plugins/accordion/plugin.js +0 -1373
  85. package/templates/default/public/tinymce/plugins/accordion/plugin.min.js +0 -1
  86. package/templates/default/public/tinymce/plugins/advlist/index.js +0 -7
  87. package/templates/default/public/tinymce/plugins/advlist/plugin.js +0 -473
  88. package/templates/default/public/tinymce/plugins/advlist/plugin.min.js +0 -1
  89. package/templates/default/public/tinymce/plugins/anchor/index.js +0 -7
  90. package/templates/default/public/tinymce/plugins/anchor/plugin.js +0 -237
  91. package/templates/default/public/tinymce/plugins/anchor/plugin.min.js +0 -1
  92. package/templates/default/public/tinymce/plugins/autolink/index.js +0 -7
  93. package/templates/default/public/tinymce/plugins/autolink/plugin.js +0 -315
  94. package/templates/default/public/tinymce/plugins/autolink/plugin.min.js +0 -1
  95. package/templates/default/public/tinymce/plugins/autoresize/index.js +0 -7
  96. package/templates/default/public/tinymce/plugins/autoresize/plugin.js +0 -221
  97. package/templates/default/public/tinymce/plugins/autoresize/plugin.min.js +0 -1
  98. package/templates/default/public/tinymce/plugins/autosave/index.js +0 -7
  99. package/templates/default/public/tinymce/plugins/autosave/plugin.js +0 -249
  100. package/templates/default/public/tinymce/plugins/autosave/plugin.min.js +0 -1
  101. package/templates/default/public/tinymce/plugins/charmap/index.js +0 -7
  102. package/templates/default/public/tinymce/plugins/charmap/plugin.js +0 -997
  103. package/templates/default/public/tinymce/plugins/charmap/plugin.min.js +0 -1
  104. package/templates/default/public/tinymce/plugins/code/index.js +0 -7
  105. package/templates/default/public/tinymce/plugins/code/plugin.js +0 -98
  106. package/templates/default/public/tinymce/plugins/code/plugin.min.js +0 -1
  107. package/templates/default/public/tinymce/plugins/codesample/index.js +0 -7
  108. package/templates/default/public/tinymce/plugins/codesample/plugin.js +0 -3655
  109. package/templates/default/public/tinymce/plugins/codesample/plugin.min.js +0 -9
  110. package/templates/default/public/tinymce/plugins/directionality/index.js +0 -7
  111. package/templates/default/public/tinymce/plugins/directionality/plugin.js +0 -634
  112. package/templates/default/public/tinymce/plugins/directionality/plugin.min.js +0 -1
  113. package/templates/default/public/tinymce/plugins/emoticons/index.js +0 -7
  114. package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.js +0 -1
  115. package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.min.js +0 -1
  116. package/templates/default/public/tinymce/plugins/emoticons/js/emojis.js +0 -1
  117. package/templates/default/public/tinymce/plugins/emoticons/js/emojis.min.js +0 -1
  118. package/templates/default/public/tinymce/plugins/emoticons/plugin.js +0 -809
  119. package/templates/default/public/tinymce/plugins/emoticons/plugin.min.js +0 -1
  120. package/templates/default/public/tinymce/plugins/fullscreen/index.js +0 -7
  121. package/templates/default/public/tinymce/plugins/fullscreen/plugin.js +0 -1607
  122. package/templates/default/public/tinymce/plugins/fullscreen/plugin.min.js +0 -1
  123. package/templates/default/public/tinymce/plugins/help/index.js +0 -7
  124. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ar.js +0 -93
  125. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg-BG.js +0 -93
  126. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +0 -93
  127. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ca.js +0 -93
  128. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/cs.js +0 -93
  129. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/da.js +0 -93
  130. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/de.js +0 -93
  131. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/el.js +0 -93
  132. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/en.js +0 -93
  133. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/es.js +0 -93
  134. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/eu.js +0 -93
  135. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fa.js +0 -93
  136. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fi.js +0 -93
  137. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr-FR.js +0 -93
  138. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +0 -93
  139. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he-IL.js +0 -93
  140. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he_IL.js +0 -93
  141. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hi.js +0 -93
  142. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hr.js +0 -93
  143. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu-HU.js +0 -93
  144. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +0 -93
  145. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/id.js +0 -93
  146. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/it.js +0 -93
  147. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ja.js +0 -93
  148. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/kk.js +0 -93
  149. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko-KR.js +0 -93
  150. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +0 -93
  151. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ms.js +0 -93
  152. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb-NO.js +0 -93
  153. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +0 -93
  154. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nl.js +0 -93
  155. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pl.js +0 -93
  156. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-BR.js +0 -93
  157. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt-PT.js +0 -93
  158. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +0 -93
  159. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +0 -93
  160. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ro.js +0 -93
  161. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ru.js +0 -93
  162. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sk.js +0 -93
  163. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl-SI.js +0 -93
  164. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +0 -93
  165. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv-SE.js +0 -93
  166. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +0 -93
  167. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th-TH.js +0 -93
  168. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th_TH.js +0 -93
  169. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/tr.js +0 -93
  170. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/uk.js +0 -93
  171. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/vi.js +0 -93
  172. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-CN.js +0 -87
  173. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh-TW.js +0 -93
  174. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +0 -87
  175. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +0 -93
  176. package/templates/default/public/tinymce/plugins/help/plugin.js +0 -826
  177. package/templates/default/public/tinymce/plugins/help/plugin.min.js +0 -1
  178. package/templates/default/public/tinymce/plugins/image/index.js +0 -7
  179. package/templates/default/public/tinymce/plugins/image/plugin.js +0 -1691
  180. package/templates/default/public/tinymce/plugins/image/plugin.min.js +0 -1
  181. package/templates/default/public/tinymce/plugins/importcss/index.js +0 -7
  182. package/templates/default/public/tinymce/plugins/importcss/plugin.js +0 -401
  183. package/templates/default/public/tinymce/plugins/importcss/plugin.min.js +0 -1
  184. package/templates/default/public/tinymce/plugins/insertdatetime/index.js +0 -7
  185. package/templates/default/public/tinymce/plugins/insertdatetime/plugin.js +0 -187
  186. package/templates/default/public/tinymce/plugins/insertdatetime/plugin.min.js +0 -1
  187. package/templates/default/public/tinymce/plugins/link/index.js +0 -7
  188. package/templates/default/public/tinymce/plugins/link/plugin.js +0 -1709
  189. package/templates/default/public/tinymce/plugins/link/plugin.min.js +0 -1
  190. package/templates/default/public/tinymce/plugins/lists/index.js +0 -7
  191. package/templates/default/public/tinymce/plugins/lists/plugin.js +0 -602
  192. package/templates/default/public/tinymce/plugins/lists/plugin.min.js +0 -1
  193. package/templates/default/public/tinymce/plugins/media/index.js +0 -7
  194. package/templates/default/public/tinymce/plugins/media/plugin.js +0 -1442
  195. package/templates/default/public/tinymce/plugins/media/plugin.min.js +0 -1
  196. package/templates/default/public/tinymce/plugins/nonbreaking/index.js +0 -7
  197. package/templates/default/public/tinymce/plugins/nonbreaking/plugin.js +0 -128
  198. package/templates/default/public/tinymce/plugins/nonbreaking/plugin.min.js +0 -1
  199. package/templates/default/public/tinymce/plugins/pagebreak/index.js +0 -7
  200. package/templates/default/public/tinymce/plugins/pagebreak/plugin.js +0 -123
  201. package/templates/default/public/tinymce/plugins/pagebreak/plugin.min.js +0 -1
  202. package/templates/default/public/tinymce/plugins/preview/index.js +0 -7
  203. package/templates/default/public/tinymce/plugins/preview/plugin.js +0 -843
  204. package/templates/default/public/tinymce/plugins/preview/plugin.min.js +0 -1
  205. package/templates/default/public/tinymce/plugins/quickbars/index.js +0 -7
  206. package/templates/default/public/tinymce/plugins/quickbars/plugin.js +0 -654
  207. package/templates/default/public/tinymce/plugins/quickbars/plugin.min.js +0 -1
  208. package/templates/default/public/tinymce/plugins/save/index.js +0 -7
  209. package/templates/default/public/tinymce/plugins/save/plugin.js +0 -136
  210. package/templates/default/public/tinymce/plugins/save/plugin.min.js +0 -1
  211. package/templates/default/public/tinymce/plugins/searchreplace/index.js +0 -7
  212. package/templates/default/public/tinymce/plugins/searchreplace/plugin.js +0 -1367
  213. package/templates/default/public/tinymce/plugins/searchreplace/plugin.min.js +0 -1
  214. package/templates/default/public/tinymce/plugins/table/index.js +0 -7
  215. package/templates/default/public/tinymce/plugins/table/plugin.js +0 -4008
  216. package/templates/default/public/tinymce/plugins/table/plugin.min.js +0 -1
  217. package/templates/default/public/tinymce/plugins/visualblocks/index.js +0 -7
  218. package/templates/default/public/tinymce/plugins/visualblocks/plugin.js +0 -106
  219. package/templates/default/public/tinymce/plugins/visualblocks/plugin.min.js +0 -1
  220. package/templates/default/public/tinymce/plugins/visualchars/index.js +0 -7
  221. package/templates/default/public/tinymce/plugins/visualchars/plugin.js +0 -808
  222. package/templates/default/public/tinymce/plugins/visualchars/plugin.min.js +0 -1
  223. package/templates/default/public/tinymce/plugins/wordcount/index.js +0 -7
  224. package/templates/default/public/tinymce/plugins/wordcount/plugin.js +0 -480
  225. package/templates/default/public/tinymce/plugins/wordcount/plugin.min.js +0 -1
  226. package/templates/default/public/tinymce/skins/content/dark/content.css +0 -75
  227. package/templates/default/public/tinymce/skins/content/dark/content.js +0 -10
  228. package/templates/default/public/tinymce/skins/content/dark/content.min.css +0 -10
  229. package/templates/default/public/tinymce/skins/content/dark/content.min.ts +0 -3
  230. package/templates/default/public/tinymce/skins/content/dark/content.ts +0 -3
  231. package/templates/default/public/tinymce/skins/content/default/content.css +0 -70
  232. package/templates/default/public/tinymce/skins/content/default/content.js +0 -10
  233. package/templates/default/public/tinymce/skins/content/default/content.min.css +0 -10
  234. package/templates/default/public/tinymce/skins/content/default/content.min.ts +0 -3
  235. package/templates/default/public/tinymce/skins/content/default/content.ts +0 -3
  236. package/templates/default/public/tinymce/skins/content/document/content.css +0 -75
  237. package/templates/default/public/tinymce/skins/content/document/content.js +0 -10
  238. package/templates/default/public/tinymce/skins/content/document/content.min.css +0 -10
  239. package/templates/default/public/tinymce/skins/content/document/content.min.ts +0 -3
  240. package/templates/default/public/tinymce/skins/content/document/content.ts +0 -3
  241. package/templates/default/public/tinymce/skins/content/tinymce-5/content.css +0 -70
  242. package/templates/default/public/tinymce/skins/content/tinymce-5/content.js +0 -10
  243. package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.css +0 -10
  244. package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.ts +0 -3
  245. package/templates/default/public/tinymce/skins/content/tinymce-5/content.ts +0 -3
  246. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.css +0 -75
  247. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.js +0 -10
  248. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.css +0 -10
  249. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.ts +0 -3
  250. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.ts +0 -3
  251. package/templates/default/public/tinymce/skins/content/writer/content.css +0 -71
  252. package/templates/default/public/tinymce/skins/content/writer/content.js +0 -10
  253. package/templates/default/public/tinymce/skins/content/writer/content.min.css +0 -10
  254. package/templates/default/public/tinymce/skins/content/writer/content.min.ts +0 -3
  255. package/templates/default/public/tinymce/skins/content/writer/content.ts +0 -3
  256. package/templates/default/public/tinymce/skins/ui/oxide/content.css +0 -1037
  257. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.css +0 -1031
  258. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.js +0 -10
  259. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.css +0 -10
  260. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.ts +0 -116
  261. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.ts +0 -116
  262. package/templates/default/public/tinymce/skins/ui/oxide/content.js +0 -10
  263. package/templates/default/public/tinymce/skins/ui/oxide/content.min.css +0 -10
  264. package/templates/default/public/tinymce/skins/ui/oxide/content.min.ts +0 -116
  265. package/templates/default/public/tinymce/skins/ui/oxide/content.ts +0 -116
  266. package/templates/default/public/tinymce/skins/ui/oxide/skin.css +0 -5615
  267. package/templates/default/public/tinymce/skins/ui/oxide/skin.js +0 -1
  268. package/templates/default/public/tinymce/skins/ui/oxide/skin.min.css +0 -1
  269. package/templates/default/public/tinymce/skins/ui/oxide/skin.min.ts +0 -507
  270. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.css +0 -30
  271. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.js +0 -1
  272. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +0 -1
  273. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.ts +0 -9
  274. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.ts +0 -9
  275. package/templates/default/public/tinymce/skins/ui/oxide/skin.ts +0 -507
  276. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.css +0 -1025
  277. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.css +0 -1031
  278. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.js +0 -10
  279. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +0 -10
  280. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.ts +0 -116
  281. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.ts +0 -116
  282. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.js +0 -10
  283. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.css +0 -10
  284. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.ts +0 -116
  285. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.ts +0 -116
  286. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.css +0 -5618
  287. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.js +0 -1
  288. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.css +0 -1
  289. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.ts +0 -507
  290. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +0 -30
  291. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +0 -1
  292. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +0 -1
  293. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.ts +0 -9
  294. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.ts +0 -9
  295. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.ts +0 -507
  296. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.css +0 -1037
  297. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.css +0 -1031
  298. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.js +0 -10
  299. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +0 -10
  300. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.ts +0 -116
  301. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.ts +0 -116
  302. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.js +0 -10
  303. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.css +0 -10
  304. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.ts +0 -116
  305. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.ts +0 -116
  306. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.css +0 -5734
  307. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.js +0 -1
  308. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.css +0 -1
  309. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.ts +0 -508
  310. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +0 -30
  311. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +0 -1
  312. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +0 -1
  313. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.ts +0 -9
  314. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.ts +0 -9
  315. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.ts +0 -508
  316. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.css +0 -1025
  317. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.css +0 -1031
  318. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +0 -10
  319. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +0 -10
  320. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.ts +0 -116
  321. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.ts +0 -116
  322. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.js +0 -10
  323. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +0 -10
  324. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.ts +0 -116
  325. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.ts +0 -116
  326. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.css +0 -5734
  327. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.js +0 -1
  328. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +0 -1
  329. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.ts +0 -508
  330. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +0 -30
  331. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +0 -1
  332. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +0 -1
  333. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.ts +0 -9
  334. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.ts +0 -9
  335. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.ts +0 -508
  336. package/templates/default/public/tinymce/themes/silver/index.js +0 -7
  337. package/templates/default/public/tinymce/themes/silver/theme.js +0 -34748
  338. package/templates/default/public/tinymce/themes/silver/theme.min.js +0 -1
  339. package/templates/default/public/tinymce/tinymce.d.ts +0 -3413
  340. package/templates/default/public/tinymce/tinymce.js +0 -41518
  341. package/templates/default/public/tinymce/tinymce.min.js +0 -10
@@ -1,1367 +0,0 @@
1
- /**
2
- * TinyMCE version 8.3.1 (2025-12-17)
3
- */
4
-
5
- (function () {
6
- 'use strict';
7
-
8
- /* eslint-disable @typescript-eslint/no-wrapper-object-types */
9
- const hasProto = (v, constructor, predicate) => {
10
- if (predicate(v, constructor.prototype)) {
11
- return true;
12
- }
13
- else {
14
- // String-based fallback time
15
- return v.constructor?.name === constructor.name;
16
- }
17
- };
18
- const typeOf = (x) => {
19
- const t = typeof x;
20
- if (x === null) {
21
- return 'null';
22
- }
23
- else if (t === 'object' && Array.isArray(x)) {
24
- return 'array';
25
- }
26
- else if (t === 'object' && hasProto(x, String, (o, proto) => proto.isPrototypeOf(o))) {
27
- return 'string';
28
- }
29
- else {
30
- return t;
31
- }
32
- };
33
- const isType$1 = (type) => (value) => typeOf(value) === type;
34
- const isSimpleType = (type) => (value) => typeof value === type;
35
- const isString = isType$1('string');
36
- const isArray = isType$1('array');
37
- const isBoolean = isSimpleType('boolean');
38
- const isNullable = (a) => a === null || a === undefined;
39
- const isNonNullable = (a) => !isNullable(a);
40
- const isNumber = isSimpleType('number');
41
-
42
- const noop = () => { };
43
- const constant = (value) => {
44
- return () => {
45
- return value;
46
- };
47
- };
48
- const always = constant(true);
49
-
50
- /**
51
- * The `Optional` type represents a value (of any type) that potentially does
52
- * not exist. Any `Optional<T>` can either be a `Some<T>` (in which case the
53
- * value does exist) or a `None` (in which case the value does not exist). This
54
- * module defines a whole lot of FP-inspired utility functions for dealing with
55
- * `Optional` objects.
56
- *
57
- * Comparison with null or undefined:
58
- * - We don't get fancy null coalescing operators with `Optional`
59
- * - We do get fancy helper functions with `Optional`
60
- * - `Optional` support nesting, and allow for the type to still be nullable (or
61
- * another `Optional`)
62
- * - There is no option to turn off strict-optional-checks like there is for
63
- * strict-null-checks
64
- */
65
- class Optional {
66
- tag;
67
- value;
68
- // Sneaky optimisation: every instance of Optional.none is identical, so just
69
- // reuse the same object
70
- static singletonNone = new Optional(false);
71
- // The internal representation has a `tag` and a `value`, but both are
72
- // private: able to be console.logged, but not able to be accessed by code
73
- constructor(tag, value) {
74
- this.tag = tag;
75
- this.value = value;
76
- }
77
- // --- Identities ---
78
- /**
79
- * Creates a new `Optional<T>` that **does** contain a value.
80
- */
81
- static some(value) {
82
- return new Optional(true, value);
83
- }
84
- /**
85
- * Create a new `Optional<T>` that **does not** contain a value. `T` can be
86
- * any type because we don't actually have a `T`.
87
- */
88
- static none() {
89
- return Optional.singletonNone;
90
- }
91
- /**
92
- * Perform a transform on an `Optional` type. Regardless of whether this
93
- * `Optional` contains a value or not, `fold` will return a value of type `U`.
94
- * If this `Optional` does not contain a value, the `U` will be created by
95
- * calling `onNone`. If this `Optional` does contain a value, the `U` will be
96
- * created by calling `onSome`.
97
- *
98
- * For the FP enthusiasts in the room, this function:
99
- * 1. Could be used to implement all of the functions below
100
- * 2. Forms a catamorphism
101
- */
102
- fold(onNone, onSome) {
103
- if (this.tag) {
104
- return onSome(this.value);
105
- }
106
- else {
107
- return onNone();
108
- }
109
- }
110
- /**
111
- * Determine if this `Optional` object contains a value.
112
- */
113
- isSome() {
114
- return this.tag;
115
- }
116
- /**
117
- * Determine if this `Optional` object **does not** contain a value.
118
- */
119
- isNone() {
120
- return !this.tag;
121
- }
122
- // --- Functor (name stolen from Haskell / maths) ---
123
- /**
124
- * Perform a transform on an `Optional` object, **if** there is a value. If
125
- * you provide a function to turn a T into a U, this is the function you use
126
- * to turn an `Optional<T>` into an `Optional<U>`. If this **does** contain
127
- * a value then the output will also contain a value (that value being the
128
- * output of `mapper(this.value)`), and if this **does not** contain a value
129
- * then neither will the output.
130
- */
131
- map(mapper) {
132
- if (this.tag) {
133
- return Optional.some(mapper(this.value));
134
- }
135
- else {
136
- return Optional.none();
137
- }
138
- }
139
- // --- Monad (name stolen from Haskell / maths) ---
140
- /**
141
- * Perform a transform on an `Optional` object, **if** there is a value.
142
- * Unlike `map`, here the transform itself also returns an `Optional`.
143
- */
144
- bind(binder) {
145
- if (this.tag) {
146
- return binder(this.value);
147
- }
148
- else {
149
- return Optional.none();
150
- }
151
- }
152
- // --- Traversable (name stolen from Haskell / maths) ---
153
- /**
154
- * For a given predicate, this function finds out if there **exists** a value
155
- * inside this `Optional` object that meets the predicate. In practice, this
156
- * means that for `Optional`s that do not contain a value it returns false (as
157
- * no predicate-meeting value exists).
158
- */
159
- exists(predicate) {
160
- return this.tag && predicate(this.value);
161
- }
162
- /**
163
- * For a given predicate, this function finds out if **all** the values inside
164
- * this `Optional` object meet the predicate. In practice, this means that
165
- * for `Optional`s that do not contain a value it returns true (as all 0
166
- * objects do meet the predicate).
167
- */
168
- forall(predicate) {
169
- return !this.tag || predicate(this.value);
170
- }
171
- filter(predicate) {
172
- if (!this.tag || predicate(this.value)) {
173
- return this;
174
- }
175
- else {
176
- return Optional.none();
177
- }
178
- }
179
- // --- Getters ---
180
- /**
181
- * Get the value out of the inside of the `Optional` object, using a default
182
- * `replacement` value if the provided `Optional` object does not contain a
183
- * value.
184
- */
185
- getOr(replacement) {
186
- return this.tag ? this.value : replacement;
187
- }
188
- /**
189
- * Get the value out of the inside of the `Optional` object, using a default
190
- * `replacement` value if the provided `Optional` object does not contain a
191
- * value. Unlike `getOr`, in this method the `replacement` object is also
192
- * `Optional` - meaning that this method will always return an `Optional`.
193
- */
194
- or(replacement) {
195
- return this.tag ? this : replacement;
196
- }
197
- /**
198
- * Get the value out of the inside of the `Optional` object, using a default
199
- * `replacement` value if the provided `Optional` object does not contain a
200
- * value. Unlike `getOr`, in this method the `replacement` value is
201
- * "thunked" - that is to say that you don't pass a value to `getOrThunk`, you
202
- * pass a function which (if called) will **return** the `value` you want to
203
- * use.
204
- */
205
- getOrThunk(thunk) {
206
- return this.tag ? this.value : thunk();
207
- }
208
- /**
209
- * Get the value out of the inside of the `Optional` object, using a default
210
- * `replacement` value if the provided Optional object does not contain a
211
- * value.
212
- *
213
- * Unlike `or`, in this method the `replacement` value is "thunked" - that is
214
- * to say that you don't pass a value to `orThunk`, you pass a function which
215
- * (if called) will **return** the `value` you want to use.
216
- *
217
- * Unlike `getOrThunk`, in this method the `replacement` value is also
218
- * `Optional`, meaning that this method will always return an `Optional`.
219
- */
220
- orThunk(thunk) {
221
- return this.tag ? this : thunk();
222
- }
223
- /**
224
- * Get the value out of the inside of the `Optional` object, throwing an
225
- * exception if the provided `Optional` object does not contain a value.
226
- *
227
- * WARNING:
228
- * You should only be using this function if you know that the `Optional`
229
- * object **is not** empty (otherwise you're throwing exceptions in production
230
- * code, which is bad).
231
- *
232
- * In tests this is more acceptable.
233
- *
234
- * Prefer other methods to this, such as `.each`.
235
- */
236
- getOrDie(message) {
237
- if (!this.tag) {
238
- throw new Error(message ?? 'Called getOrDie on None');
239
- }
240
- else {
241
- return this.value;
242
- }
243
- }
244
- // --- Interop with null and undefined ---
245
- /**
246
- * Creates an `Optional` value from a nullable (or undefined-able) input.
247
- * Null, or undefined, is converted to `None`, and anything else is converted
248
- * to `Some`.
249
- */
250
- static from(value) {
251
- return isNonNullable(value) ? Optional.some(value) : Optional.none();
252
- }
253
- /**
254
- * Converts an `Optional` to a nullable type, by getting the value if it
255
- * exists, or returning `null` if it does not.
256
- */
257
- getOrNull() {
258
- return this.tag ? this.value : null;
259
- }
260
- /**
261
- * Converts an `Optional` to an undefined-able type, by getting the value if
262
- * it exists, or returning `undefined` if it does not.
263
- */
264
- getOrUndefined() {
265
- return this.value;
266
- }
267
- // --- Utilities ---
268
- /**
269
- * If the `Optional` contains a value, perform an action on that value.
270
- * Unlike the rest of the methods on this type, `.each` has side-effects. If
271
- * you want to transform an `Optional<T>` **into** something, then this is not
272
- * the method for you. If you want to use an `Optional<T>` to **do**
273
- * something, then this is the method for you - provided you're okay with not
274
- * doing anything in the case where the `Optional` doesn't have a value inside
275
- * it. If you're not sure whether your use-case fits into transforming
276
- * **into** something or **doing** something, check whether it has a return
277
- * value. If it does, you should be performing a transform.
278
- */
279
- each(worker) {
280
- if (this.tag) {
281
- worker(this.value);
282
- }
283
- }
284
- /**
285
- * Turn the `Optional` object into an array that contains all of the values
286
- * stored inside the `Optional`. In practice, this means the output will have
287
- * either 0 or 1 elements.
288
- */
289
- toArray() {
290
- return this.tag ? [this.value] : [];
291
- }
292
- /**
293
- * Turn the `Optional` object into a string for debugging or printing. Not
294
- * recommended for production code, but good for debugging. Also note that
295
- * these days an `Optional` object can be logged to the console directly, and
296
- * its inner value (if it exists) will be visible.
297
- */
298
- toString() {
299
- return this.tag ? `some(${this.value})` : 'none()';
300
- }
301
- }
302
-
303
- const nativeSlice = Array.prototype.slice;
304
- const nativePush = Array.prototype.push;
305
- const map = (xs, f) => {
306
- // pre-allocating array size when it's guaranteed to be known
307
- // http://jsperf.com/push-allocated-vs-dynamic/22
308
- const len = xs.length;
309
- const r = new Array(len);
310
- for (let i = 0; i < len; i++) {
311
- const x = xs[i];
312
- r[i] = f(x, i);
313
- }
314
- return r;
315
- };
316
- // Unwound implementing other functions in terms of each.
317
- // The code size is roughly the same, and it should allow for better optimisation.
318
- // const each = function<T, U>(xs: T[], f: (x: T, i?: number, xs?: T[]) => void): void {
319
- const each = (xs, f) => {
320
- for (let i = 0, len = xs.length; i < len; i++) {
321
- const x = xs[i];
322
- f(x, i);
323
- }
324
- };
325
- const eachr = (xs, f) => {
326
- for (let i = xs.length - 1; i >= 0; i--) {
327
- const x = xs[i];
328
- f(x, i);
329
- }
330
- };
331
- /*
332
- * Groups an array into contiguous arrays of like elements. Whether an element is like or not depends on f.
333
- *
334
- * f is a function that derives a value from an element - e.g. true or false, or a string.
335
- * Elements are like if this function generates the same value for them (according to ===).
336
- *
337
- *
338
- * Order of the elements is preserved. Arr.flatten() on the result will return the original list, as with Haskell groupBy function.
339
- * For a good explanation, see the group function (which is a special case of groupBy)
340
- * http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-List.html#v:group
341
- */
342
- const groupBy = (xs, f) => {
343
- if (xs.length === 0) {
344
- return [];
345
- }
346
- else {
347
- let wasType = f(xs[0]); // initial case for matching
348
- const r = [];
349
- let group = [];
350
- for (let i = 0, len = xs.length; i < len; i++) {
351
- const x = xs[i];
352
- const type = f(x);
353
- if (type !== wasType) {
354
- r.push(group);
355
- group = [];
356
- }
357
- wasType = type;
358
- group.push(x);
359
- }
360
- if (group.length !== 0) {
361
- r.push(group);
362
- }
363
- return r;
364
- }
365
- };
366
- const foldl = (xs, f, acc) => {
367
- each(xs, (x, i) => {
368
- acc = f(acc, x, i);
369
- });
370
- return acc;
371
- };
372
- const flatten = (xs) => {
373
- // Note, this is possible because push supports multiple arguments:
374
- // http://jsperf.com/concat-push/6
375
- // Note that in the past, concat() would silently work (very slowly) for array-like objects.
376
- // With this change it will throw an error.
377
- const r = [];
378
- for (let i = 0, len = xs.length; i < len; ++i) {
379
- // Ensure that each value is an array itself
380
- if (!isArray(xs[i])) {
381
- throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
382
- }
383
- nativePush.apply(r, xs[i]);
384
- }
385
- return r;
386
- };
387
- const bind = (xs, f) => flatten(map(xs, f));
388
- const sort = (xs, comparator) => {
389
- const copy = nativeSlice.call(xs, 0);
390
- copy.sort(comparator);
391
- return copy;
392
- };
393
-
394
- const hasOwnProperty = Object.hasOwnProperty;
395
- const has = (obj, key) => hasOwnProperty.call(obj, key);
396
-
397
- const Cell = (initial) => {
398
- let value = initial;
399
- const get = () => {
400
- return value;
401
- };
402
- const set = (v) => {
403
- value = v;
404
- };
405
- return {
406
- get,
407
- set
408
- };
409
- };
410
-
411
- const singleton = (doRevoke) => {
412
- const subject = Cell(Optional.none());
413
- const revoke = () => subject.get().each(doRevoke);
414
- const clear = () => {
415
- revoke();
416
- subject.set(Optional.none());
417
- };
418
- const isSet = () => subject.get().isSome();
419
- const get = () => subject.get();
420
- const set = (s) => {
421
- revoke();
422
- subject.set(Optional.some(s));
423
- };
424
- return {
425
- clear,
426
- isSet,
427
- get,
428
- set
429
- };
430
- };
431
- const value = () => {
432
- const subject = singleton(noop);
433
- const on = (f) => subject.get().each(f);
434
- return {
435
- ...subject,
436
- on
437
- };
438
- };
439
-
440
- var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
441
-
442
- /* eslint-disable max-len */
443
- const punctuationStr = `[~№|!-*+-\\/:;?@\\[-\`{}\u00A1\u00AB\u00B7\u00BB\u00BF;\u00B7\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1361-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u3008\u3009\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30\u2E31\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]`;
444
-
445
- const punctuation$1 = constant(punctuationStr);
446
-
447
- // tslint:disable-next-line:variable-name
448
- const Custom = (regex, prefix, suffix, flags) => {
449
- const term = () => {
450
- return new RegExp(regex, flags.getOr('g'));
451
- };
452
- return {
453
- term,
454
- prefix,
455
- suffix
456
- };
457
- };
458
-
459
- Custom;
460
- const punctuation = punctuation$1;
461
-
462
- var global$2 = tinymce.util.Tools.resolve('tinymce.Env');
463
-
464
- var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
465
-
466
- const fromHtml = (html, scope) => {
467
- const doc = scope || document;
468
- const div = doc.createElement('div');
469
- div.innerHTML = html;
470
- if (!div.hasChildNodes() || div.childNodes.length > 1) {
471
- const message = 'HTML does not have a single root node';
472
- // eslint-disable-next-line no-console
473
- console.error(message, html);
474
- throw new Error(message);
475
- }
476
- return fromDom(div.childNodes[0]);
477
- };
478
- const fromTag = (tag, scope) => {
479
- const doc = scope || document;
480
- const node = doc.createElement(tag);
481
- return fromDom(node);
482
- };
483
- const fromText = (text, scope) => {
484
- const doc = scope || document;
485
- const node = doc.createTextNode(text);
486
- return fromDom(node);
487
- };
488
- const fromDom = (node) => {
489
- // TODO: Consider removing this check, but left atm for safety
490
- if (node === null || node === undefined) {
491
- throw new Error('Node cannot be null or undefined');
492
- }
493
- return {
494
- dom: node
495
- };
496
- };
497
- const fromPoint = (docElm, x, y) => Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
498
- // tslint:disable-next-line:variable-name
499
- const SugarElement = {
500
- fromHtml,
501
- fromTag,
502
- fromText,
503
- fromDom,
504
- fromPoint
505
- };
506
-
507
- const DOCUMENT = 9;
508
- const DOCUMENT_FRAGMENT = 11;
509
- const ELEMENT = 1;
510
- const TEXT = 3;
511
-
512
- const bypassSelector = (dom) =>
513
- // Only elements, documents and shadow roots support querySelector
514
- // shadow root element type is DOCUMENT_FRAGMENT
515
- dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT ||
516
- // IE fix for complex queries on empty nodes: http://jsfiddle.net/spyder/fv9ptr5L/
517
- dom.childElementCount === 0;
518
- const all = (selector, scope) => {
519
- const base = scope === undefined ? document : scope.dom;
520
- return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);
521
- };
522
-
523
- /*
524
- * Most of sand doesn't alter the methods on the object.
525
- * We're making an exception for Node, because bitwise and is so easy to get wrong.
526
- *
527
- * Might be nice to ADT this at some point instead of having individual methods.
528
- */
529
- const compareDocumentPosition = (a, b, match) => {
530
- // Returns: 0 if e1 and e2 are the same node, or a bitmask comparing the positions
531
- // of nodes e1 and e2 in their documents. See the URL below for bitmask interpretation
532
- // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
533
- // eslint-disable-next-line no-bitwise
534
- return (a.compareDocumentPosition(b) & match) !== 0;
535
- };
536
- const documentPositionPreceding = (a, b) => {
537
- return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING);
538
- };
539
-
540
- const type = (element) => element.dom.nodeType;
541
- const isType = (t) => (element) => type(element) === t;
542
- const isText$1 = isType(TEXT);
543
-
544
- const parent = (element) => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
545
- const children = (element) => map(element.dom.childNodes, SugarElement.fromDom);
546
- const spot = (element, offset) => ({
547
- element,
548
- offset
549
- });
550
- const leaf = (element, offset) => {
551
- const cs = children(element);
552
- return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
553
- };
554
-
555
- const before = (marker, element) => {
556
- const parent$1 = parent(marker);
557
- parent$1.each((v) => {
558
- v.dom.insertBefore(element.dom, marker.dom);
559
- });
560
- };
561
- const append = (parent, element) => {
562
- parent.dom.appendChild(element.dom);
563
- };
564
- const wrap = (element, wrapper) => {
565
- before(element, wrapper);
566
- append(wrapper, element);
567
- };
568
-
569
- const rawSet = (dom, key, value) => {
570
- /*
571
- * JQuery coerced everything to a string, and silently did nothing on text node/null/undefined.
572
- *
573
- * We fail on those invalid cases, only allowing numbers and booleans.
574
- */
575
- if (isString(value) || isBoolean(value) || isNumber(value)) {
576
- dom.setAttribute(key, value + '');
577
- }
578
- else {
579
- // eslint-disable-next-line no-console
580
- console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
581
- throw new Error('Attribute value was not simple');
582
- }
583
- };
584
- const set = (element, key, value) => {
585
- rawSet(element.dom, key, value);
586
- };
587
-
588
- const NodeValue = (is, name) => {
589
- const get = (element) => {
590
- if (!is(element)) {
591
- throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
592
- }
593
- return getOption(element).getOr('');
594
- };
595
- const getOption = (element) => is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();
596
- const set = (element, value) => {
597
- if (!is(element)) {
598
- throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
599
- }
600
- element.dom.nodeValue = value;
601
- };
602
- return {
603
- get,
604
- getOption,
605
- set
606
- };
607
- };
608
-
609
- const api = NodeValue(isText$1, 'text');
610
- const get$1 = (element) => api.get(element);
611
-
612
- const descendants = (scope, selector) => all(selector, scope);
613
-
614
- var global = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
615
-
616
- const isSimpleBoundary = (dom, node) => dom.isBlock(node) || has(dom.schema.getVoidElements(), node.nodeName);
617
- const isContentEditableFalse = (dom, node) => !dom.isEditable(node);
618
- const isContentEditableTrueInCef = (dom, node) => dom.getContentEditable(node) === 'true' && node.parentNode && !dom.isEditable(node.parentNode);
619
- const isHidden = (dom, node) => !dom.isBlock(node) && has(dom.schema.getWhitespaceElements(), node.nodeName);
620
- const isBoundary = (dom, node) => isSimpleBoundary(dom, node) || isContentEditableFalse(dom, node) || isHidden(dom, node) || isContentEditableTrueInCef(dom, node);
621
- const isText = (node) => node.nodeType === 3;
622
- const nuSection = () => ({
623
- sOffset: 0,
624
- fOffset: 0,
625
- elements: []
626
- });
627
- const toLeaf = (node, offset) => leaf(SugarElement.fromDom(node), offset);
628
- const walk = (dom, walkerFn, startNode, callbacks, endNode, skipStart = true) => {
629
- let next = skipStart ? walkerFn(false) : startNode;
630
- while (next) {
631
- // Walk over content editable or hidden elements
632
- const isCefNode = isContentEditableFalse(dom, next);
633
- if (isCefNode || isHidden(dom, next)) {
634
- const stopWalking = isCefNode ? callbacks.cef(next) : callbacks.boundary(next);
635
- if (stopWalking) {
636
- break;
637
- }
638
- else {
639
- next = walkerFn(true);
640
- continue;
641
- }
642
- }
643
- else if (isSimpleBoundary(dom, next)) {
644
- if (callbacks.boundary(next)) {
645
- break;
646
- }
647
- }
648
- else if (isText(next)) {
649
- callbacks.text(next);
650
- }
651
- if (next === endNode) {
652
- break;
653
- }
654
- else {
655
- next = walkerFn(false);
656
- }
657
- }
658
- };
659
- const collectTextToBoundary = (dom, section, node, rootNode, forwards) => {
660
- // Don't bother collecting text nodes if we're already at a boundary
661
- if (isBoundary(dom, node)) {
662
- return;
663
- }
664
- const rootBlock = dom.getParent(rootNode, dom.isBlock) ?? dom.getRoot();
665
- const walker = new global(node, rootBlock);
666
- const walkerFn = forwards ? walker.next.bind(walker) : walker.prev.bind(walker);
667
- // Walk over and add text nodes to the section and increase the offsets
668
- // so we know to ignore the additional text when matching
669
- walk(dom, walkerFn, node, {
670
- boundary: always,
671
- cef: always,
672
- text: (next) => {
673
- if (forwards) {
674
- section.fOffset += next.length;
675
- }
676
- else {
677
- section.sOffset += next.length;
678
- }
679
- section.elements.push(SugarElement.fromDom(next));
680
- }
681
- });
682
- };
683
- const collect = (dom, rootNode, startNode, endNode, callbacks, skipStart = true) => {
684
- const walker = new global(startNode, rootNode);
685
- const sections = [];
686
- let current = nuSection();
687
- // Find any text between the start node and the closest boundary
688
- collectTextToBoundary(dom, current, startNode, rootNode, false);
689
- const finishSection = () => {
690
- if (current.elements.length > 0) {
691
- sections.push(current);
692
- current = nuSection();
693
- }
694
- return false;
695
- };
696
- // Collect all the text nodes in the specified range and create sections from the
697
- // boundaries within the range
698
- walk(dom, walker.next.bind(walker), startNode, {
699
- boundary: finishSection,
700
- cef: (node) => {
701
- finishSection();
702
- // Collect additional nested contenteditable true content
703
- if (callbacks) {
704
- sections.push(...callbacks.cef(node));
705
- }
706
- return false;
707
- },
708
- text: (next) => {
709
- current.elements.push(SugarElement.fromDom(next));
710
- if (callbacks) {
711
- callbacks.text(next, current);
712
- }
713
- }
714
- }, endNode, skipStart);
715
- // Find any text between the end node and the closest boundary, then finalise the section
716
- if (endNode) {
717
- collectTextToBoundary(dom, current, endNode, rootNode, true);
718
- }
719
- finishSection();
720
- return sections;
721
- };
722
- const collectRangeSections = (dom, rng) => {
723
- const start = toLeaf(rng.startContainer, rng.startOffset);
724
- const startNode = start.element.dom;
725
- const end = toLeaf(rng.endContainer, rng.endOffset);
726
- const endNode = end.element.dom;
727
- return collect(dom, rng.commonAncestorContainer, startNode, endNode, {
728
- text: (node, section) => {
729
- // Set the start/end offset of the section
730
- if (node === endNode) {
731
- section.fOffset += node.length - end.offset;
732
- }
733
- else if (node === startNode) {
734
- section.sOffset += start.offset;
735
- }
736
- },
737
- cef: (node) => {
738
- // Collect the sections and then order them appropriately, as nested sections maybe out of order
739
- // TODO: See if we can improve this to avoid the sort overhead
740
- const sections = bind(descendants(SugarElement.fromDom(node), '*[contenteditable=true]'), (e) => {
741
- const ceTrueNode = e.dom;
742
- return collect(dom, ceTrueNode, ceTrueNode);
743
- });
744
- return sort(sections, (a, b) => (documentPositionPreceding(a.elements[0].dom, b.elements[0].dom)) ? 1 : -1);
745
- }
746
- }, false);
747
- };
748
- const fromRng = (dom, rng) => rng.collapsed ? [] : collectRangeSections(dom, rng);
749
- const fromNode = (dom, node) => {
750
- const rng = dom.createRng();
751
- rng.selectNode(node);
752
- return fromRng(dom, rng);
753
- };
754
- const fromNodes = (dom, nodes) => bind(nodes, (node) => fromNode(dom, node));
755
-
756
- const find$2 = (text, pattern, start = 0, finish = text.length) => {
757
- const regex = pattern.regex;
758
- regex.lastIndex = start;
759
- const results = [];
760
- let match;
761
- while ((match = regex.exec(text))) {
762
- const matchedText = match[pattern.matchIndex];
763
- const matchStart = match.index + match[0].indexOf(matchedText);
764
- const matchFinish = matchStart + matchedText.length;
765
- // Stop finding matches if we've hit the finish mark
766
- if (matchFinish > finish) {
767
- break;
768
- }
769
- results.push({
770
- start: matchStart,
771
- finish: matchFinish
772
- });
773
- regex.lastIndex = matchFinish;
774
- }
775
- return results;
776
- };
777
- const extract = (elements, matches) => {
778
- // Walk over each text node and compare with the matches
779
- const nodePositions = foldl(elements, (acc, element) => {
780
- const content = get$1(element);
781
- const start = acc.last;
782
- const finish = start + content.length;
783
- // Find positions for any matches in the current text node
784
- const positions = bind(matches, (match, matchIdx) => {
785
- // Check to see if the match overlaps with the text position
786
- if (match.start < finish && match.finish > start) {
787
- return [{
788
- element,
789
- start: Math.max(start, match.start) - start,
790
- finish: Math.min(finish, match.finish) - start,
791
- matchId: matchIdx
792
- }];
793
- }
794
- else {
795
- return [];
796
- }
797
- });
798
- return {
799
- results: acc.results.concat(positions),
800
- last: finish
801
- };
802
- }, { results: [], last: 0 }).results;
803
- // Group the positions by the match id
804
- return groupBy(nodePositions, (position) => position.matchId);
805
- };
806
-
807
- const find$1 = (pattern, sections) => bind(sections, (section) => {
808
- const elements = section.elements;
809
- const content = map(elements, get$1).join('');
810
- const positions = find$2(content, pattern, section.sOffset, content.length - section.fOffset);
811
- return extract(elements, positions);
812
- });
813
- const mark = (matches, replacementNode) => {
814
- // Walk backwards and mark the positions
815
- // Note: We need to walk backwards so the position indexes don't change
816
- eachr(matches, (match, idx) => {
817
- eachr(match, (pos) => {
818
- const wrapper = SugarElement.fromDom(replacementNode.cloneNode(false));
819
- set(wrapper, 'data-mce-index', idx);
820
- const textNode = pos.element.dom;
821
- if (textNode.length === pos.finish && pos.start === 0) {
822
- wrap(pos.element, wrapper);
823
- }
824
- else {
825
- if (textNode.length !== pos.finish) {
826
- textNode.splitText(pos.finish);
827
- }
828
- const matchNode = textNode.splitText(pos.start);
829
- wrap(SugarElement.fromDom(matchNode), wrapper);
830
- }
831
- });
832
- });
833
- };
834
- const findAndMark = (dom, pattern, node, replacementNode) => {
835
- const textSections = fromNode(dom, node);
836
- const matches = find$1(pattern, textSections);
837
- mark(matches, replacementNode);
838
- return matches.length;
839
- };
840
- const findAndMarkInSelection = (dom, pattern, selection, replacementNode) => {
841
- const bookmark = selection.getBookmark();
842
- // Handle table cell selection as the table plugin enables
843
- // you to fake select table cells and perform actions on them
844
- const nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');
845
- const textSections = nodes.length > 0 ? fromNodes(dom, nodes) : fromRng(dom, selection.getRng());
846
- // Find and mark matches
847
- const matches = find$1(pattern, textSections);
848
- mark(matches, replacementNode);
849
- // Restore the selection
850
- selection.moveToBookmark(bookmark);
851
- return matches.length;
852
- };
853
-
854
- const getElmIndex = (elm) => {
855
- return elm.getAttribute('data-mce-index');
856
- };
857
- const markAllMatches = (editor, currentSearchState, pattern, inSelection) => {
858
- const marker = editor.dom.create('span', {
859
- 'data-mce-bogus': 1
860
- });
861
- marker.className = 'mce-match-marker';
862
- const node = editor.getBody();
863
- done(editor, currentSearchState, false);
864
- if (inSelection) {
865
- return findAndMarkInSelection(editor.dom, pattern, editor.selection, marker);
866
- }
867
- else {
868
- return findAndMark(editor.dom, pattern, node, marker);
869
- }
870
- };
871
- const unwrap = (node) => {
872
- const parentNode = node.parentNode;
873
- if (node.firstChild) {
874
- parentNode.insertBefore(node.firstChild, node);
875
- }
876
- node.parentNode?.removeChild(node);
877
- };
878
- const findSpansByIndex = (editor, index) => {
879
- const spans = [];
880
- const nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
881
- if (nodes.length) {
882
- for (let i = 0; i < nodes.length; i++) {
883
- const nodeIndex = getElmIndex(nodes[i]);
884
- if (nodeIndex === null || !nodeIndex.length) {
885
- continue;
886
- }
887
- if (nodeIndex === index.toString()) {
888
- spans.push(nodes[i]);
889
- }
890
- }
891
- }
892
- return spans;
893
- };
894
- const moveSelection = (editor, currentSearchState, forward) => {
895
- const searchState = currentSearchState.get();
896
- let testIndex = searchState.index;
897
- const dom = editor.dom;
898
- if (forward) {
899
- if (testIndex + 1 === searchState.count) {
900
- testIndex = 0;
901
- }
902
- else {
903
- testIndex++;
904
- }
905
- }
906
- else {
907
- if (testIndex - 1 === -1) {
908
- testIndex = searchState.count - 1;
909
- }
910
- else {
911
- testIndex--;
912
- }
913
- }
914
- dom.removeClass(findSpansByIndex(editor, searchState.index), 'mce-match-marker-selected');
915
- const spans = findSpansByIndex(editor, testIndex);
916
- if (spans.length) {
917
- dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');
918
- editor.selection.scrollIntoView(spans[0]);
919
- return testIndex;
920
- }
921
- return -1;
922
- };
923
- const removeNode = (dom, node) => {
924
- const parent = node.parentNode;
925
- dom.remove(node);
926
- if (parent && dom.isEmpty(parent)) {
927
- dom.remove(parent);
928
- }
929
- };
930
- const escapeSearchText = (text, wholeWord) => {
931
- const escapedText = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&').replace(/\s/g, '[^\\S\\r\\n\\uFEFF]');
932
- const wordRegex = '(' + escapedText + ')';
933
- return wholeWord ? `(?:^|\\s|${punctuation()})` + wordRegex + `(?=$|\\s|${punctuation()})` : wordRegex;
934
- };
935
- const find = (editor, currentSearchState, text, matchCase, wholeWord, inSelection) => {
936
- const selection = editor.selection;
937
- const escapedText = escapeSearchText(text, wholeWord);
938
- const isForwardSelection = selection.isForward();
939
- const pattern = {
940
- regex: new RegExp(escapedText, matchCase ? 'g' : 'gi'),
941
- matchIndex: 1
942
- };
943
- const count = markAllMatches(editor, currentSearchState, pattern, inSelection);
944
- // Safari has a bug whereby splitting text nodes breaks the selection (which is done when marking matches).
945
- // As such we need to manually reset it after doing a find action. See https://bugs.webkit.org/show_bug.cgi?id=230594
946
- if (global$2.browser.isSafari()) {
947
- selection.setRng(selection.getRng(), isForwardSelection);
948
- }
949
- if (count) {
950
- const newIndex = moveSelection(editor, currentSearchState, true);
951
- currentSearchState.set({
952
- index: newIndex,
953
- count,
954
- text,
955
- matchCase,
956
- wholeWord,
957
- inSelection
958
- });
959
- }
960
- return count;
961
- };
962
- const next = (editor, currentSearchState) => {
963
- const index = moveSelection(editor, currentSearchState, true);
964
- currentSearchState.set({ ...currentSearchState.get(), index });
965
- };
966
- const prev = (editor, currentSearchState) => {
967
- const index = moveSelection(editor, currentSearchState, false);
968
- currentSearchState.set({ ...currentSearchState.get(), index });
969
- };
970
- const isMatchSpan = (node) => {
971
- const matchIndex = getElmIndex(node);
972
- return matchIndex !== null && matchIndex.length > 0;
973
- };
974
- const replace = (editor, currentSearchState, text, forward, all) => {
975
- const searchState = currentSearchState.get();
976
- const currentIndex = searchState.index;
977
- let currentMatchIndex, nextIndex = currentIndex;
978
- forward = forward !== false;
979
- const node = editor.getBody();
980
- const nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);
981
- for (let i = 0; i < nodes.length; i++) {
982
- const nodeIndex = getElmIndex(nodes[i]);
983
- let matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
984
- if (all || matchIndex === searchState.index) {
985
- if (text.length) {
986
- nodes[i].innerText = text;
987
- unwrap(nodes[i]);
988
- }
989
- else {
990
- removeNode(editor.dom, nodes[i]);
991
- }
992
- while (nodes[++i]) {
993
- matchIndex = parseInt(getElmIndex(nodes[i]), 10);
994
- if (matchIndex === currentMatchIndex) {
995
- removeNode(editor.dom, nodes[i]);
996
- }
997
- else {
998
- i--;
999
- break;
1000
- }
1001
- }
1002
- if (forward) {
1003
- nextIndex--;
1004
- }
1005
- }
1006
- else if (currentMatchIndex > currentIndex) {
1007
- nodes[i].setAttribute('data-mce-index', String(currentMatchIndex - 1));
1008
- }
1009
- }
1010
- currentSearchState.set({
1011
- ...searchState,
1012
- count: all ? 0 : searchState.count - 1,
1013
- index: nextIndex
1014
- });
1015
- if (forward) {
1016
- next(editor, currentSearchState);
1017
- }
1018
- else {
1019
- prev(editor, currentSearchState);
1020
- }
1021
- return !all && currentSearchState.get().count > 0;
1022
- };
1023
- const done = (editor, currentSearchState, keepEditorSelection) => {
1024
- let startContainer;
1025
- let endContainer;
1026
- const searchState = currentSearchState.get();
1027
- const nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));
1028
- for (let i = 0; i < nodes.length; i++) {
1029
- const nodeIndex = getElmIndex(nodes[i]);
1030
- if (nodeIndex !== null && nodeIndex.length) {
1031
- if (nodeIndex === searchState.index.toString()) {
1032
- // Note: The first child of the span node will be the highlighted text node
1033
- if (!startContainer) {
1034
- startContainer = nodes[i].firstChild;
1035
- }
1036
- endContainer = nodes[i].firstChild;
1037
- }
1038
- unwrap(nodes[i]);
1039
- }
1040
- }
1041
- // Reset the search state
1042
- currentSearchState.set({
1043
- ...searchState,
1044
- index: -1,
1045
- count: 0,
1046
- text: ''
1047
- });
1048
- if (startContainer && endContainer) {
1049
- const rng = editor.dom.createRng();
1050
- rng.setStart(startContainer, 0);
1051
- rng.setEnd(endContainer, endContainer.data.length);
1052
- if (keepEditorSelection !== false) {
1053
- editor.selection.setRng(rng);
1054
- }
1055
- return rng;
1056
- }
1057
- else {
1058
- return undefined;
1059
- }
1060
- };
1061
- const hasNext = (editor, currentSearchState) => currentSearchState.get().count > 1;
1062
- const hasPrev = (editor, currentSearchState) => currentSearchState.get().count > 1;
1063
-
1064
- const get = (editor, currentState) => {
1065
- const done$1 = (keepEditorSelection) => {
1066
- return done(editor, currentState, keepEditorSelection);
1067
- };
1068
- const find$1 = (text, matchCase, wholeWord, inSelection = false) => {
1069
- return find(editor, currentState, text, matchCase, wholeWord, inSelection);
1070
- };
1071
- const next$1 = () => {
1072
- return next(editor, currentState);
1073
- };
1074
- const prev$1 = () => {
1075
- return prev(editor, currentState);
1076
- };
1077
- const replace$1 = (text, forward, all) => {
1078
- return replace(editor, currentState, text, forward, all);
1079
- };
1080
- return {
1081
- done: done$1,
1082
- find: find$1,
1083
- next: next$1,
1084
- prev: prev$1,
1085
- replace: replace$1
1086
- };
1087
- };
1088
-
1089
- const open = (editor, currentSearchState) => {
1090
- const dialogApi = value();
1091
- editor.undoManager.add();
1092
- const selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));
1093
- const updateButtonStates = (api) => {
1094
- api.setEnabled('next', hasNext(editor, currentSearchState));
1095
- api.setEnabled('prev', hasPrev(editor, currentSearchState));
1096
- };
1097
- const updateSearchState = (api) => {
1098
- const data = api.getData();
1099
- const current = currentSearchState.get();
1100
- currentSearchState.set({
1101
- ...current,
1102
- matchCase: data.matchcase,
1103
- wholeWord: data.wholewords,
1104
- inSelection: data.inselection
1105
- });
1106
- };
1107
- const disableAll = (api, disable) => {
1108
- const buttons = ['replace', 'replaceall', 'prev', 'next'];
1109
- const toggle = (name) => api.setEnabled(name, !disable);
1110
- each(buttons, toggle);
1111
- };
1112
- const toggleNotFoundAlert = (isVisible, api) => {
1113
- api.redial(getDialogSpec(isVisible, api.getData()));
1114
- };
1115
- // Temporarily workaround for iOS/iPadOS dialog placement to hide the keyboard
1116
- // TODO: Remove in 5.2 once iOS fixed positioning is fixed. See TINY-4441
1117
- const focusButtonIfRequired = (api, name) => {
1118
- if (global$2.browser.isSafari() && global$2.deviceType.isTouch() && (name === 'find' || name === 'replace' || name === 'replaceall')) {
1119
- api.focus(name);
1120
- }
1121
- };
1122
- const reset = (api) => {
1123
- // Clean up the markers if required
1124
- done(editor, currentSearchState, false);
1125
- // Disable the buttons
1126
- disableAll(api, true);
1127
- updateButtonStates(api);
1128
- };
1129
- const doFind = (api) => {
1130
- const data = api.getData();
1131
- const last = currentSearchState.get();
1132
- if (!data.findtext.length) {
1133
- reset(api);
1134
- return;
1135
- }
1136
- // Same search text, so treat the find as a next click instead
1137
- if (last.text === data.findtext && last.matchCase === data.matchcase && last.wholeWord === data.wholewords) {
1138
- next(editor, currentSearchState);
1139
- }
1140
- else {
1141
- // Find new matches
1142
- const count = find(editor, currentSearchState, data.findtext, data.matchcase, data.wholewords, data.inselection);
1143
- if (count <= 0) {
1144
- toggleNotFoundAlert(true, api);
1145
- }
1146
- disableAll(api, count === 0);
1147
- }
1148
- updateButtonStates(api);
1149
- };
1150
- const initialState = currentSearchState.get();
1151
- const initialData = {
1152
- findtext: selectedText,
1153
- replacetext: '',
1154
- wholewords: initialState.wholeWord,
1155
- matchcase: initialState.matchCase,
1156
- inselection: initialState.inSelection
1157
- };
1158
- const getPanelItems = (error) => {
1159
- const items = [
1160
- {
1161
- type: 'label',
1162
- label: 'Find',
1163
- for: 'findtext',
1164
- items: [
1165
- {
1166
- type: 'bar',
1167
- items: [
1168
- {
1169
- type: 'input',
1170
- name: 'findtext',
1171
- maximized: true,
1172
- inputMode: 'search'
1173
- },
1174
- {
1175
- type: 'button',
1176
- name: 'prev',
1177
- text: 'Previous',
1178
- icon: 'action-prev',
1179
- enabled: false,
1180
- borderless: true
1181
- },
1182
- {
1183
- type: 'button',
1184
- name: 'next',
1185
- text: 'Next',
1186
- icon: 'action-next',
1187
- enabled: false,
1188
- borderless: true
1189
- }
1190
- ]
1191
- }
1192
- ]
1193
- },
1194
- {
1195
- type: 'input',
1196
- name: 'replacetext',
1197
- label: 'Replace with',
1198
- inputMode: 'search'
1199
- },
1200
- ];
1201
- if (error) {
1202
- items.push({
1203
- type: 'alertbanner',
1204
- level: 'error',
1205
- text: 'Could not find the specified string.',
1206
- icon: 'warning',
1207
- });
1208
- }
1209
- return items;
1210
- };
1211
- const getDialogSpec = (showNoMatchesAlertBanner, initialData) => ({
1212
- title: 'Find and Replace',
1213
- size: 'normal',
1214
- body: {
1215
- type: 'panel',
1216
- items: getPanelItems(showNoMatchesAlertBanner)
1217
- },
1218
- buttons: [
1219
- {
1220
- type: 'menu',
1221
- name: 'options',
1222
- icon: 'preferences',
1223
- tooltip: 'Preferences',
1224
- align: 'start',
1225
- items: [
1226
- {
1227
- type: 'togglemenuitem',
1228
- name: 'matchcase',
1229
- text: 'Match case'
1230
- }, {
1231
- type: 'togglemenuitem',
1232
- name: 'wholewords',
1233
- text: 'Find whole words only'
1234
- },
1235
- {
1236
- type: 'togglemenuitem',
1237
- name: 'inselection',
1238
- text: 'Find in selection'
1239
- }
1240
- ]
1241
- },
1242
- {
1243
- type: 'custom',
1244
- name: 'find',
1245
- text: 'Find',
1246
- primary: true
1247
- },
1248
- {
1249
- type: 'custom',
1250
- name: 'replace',
1251
- text: 'Replace',
1252
- enabled: false
1253
- },
1254
- {
1255
- type: 'custom',
1256
- name: 'replaceall',
1257
- text: 'Replace all',
1258
- enabled: false,
1259
- }
1260
- ],
1261
- initialData,
1262
- onChange: (api, details) => {
1263
- if (showNoMatchesAlertBanner) {
1264
- toggleNotFoundAlert(false, api);
1265
- }
1266
- if (details.name === 'findtext' && currentSearchState.get().count > 0) {
1267
- reset(api);
1268
- }
1269
- },
1270
- onAction: (api, details) => {
1271
- const data = api.getData();
1272
- switch (details.name) {
1273
- case 'find':
1274
- doFind(api);
1275
- break;
1276
- case 'replace':
1277
- if (!replace(editor, currentSearchState, data.replacetext)) {
1278
- reset(api);
1279
- }
1280
- else {
1281
- updateButtonStates(api);
1282
- }
1283
- break;
1284
- case 'replaceall':
1285
- replace(editor, currentSearchState, data.replacetext, true, true);
1286
- reset(api);
1287
- break;
1288
- case 'prev':
1289
- prev(editor, currentSearchState);
1290
- updateButtonStates(api);
1291
- break;
1292
- case 'next':
1293
- next(editor, currentSearchState);
1294
- updateButtonStates(api);
1295
- break;
1296
- case 'matchcase':
1297
- case 'wholewords':
1298
- case 'inselection':
1299
- toggleNotFoundAlert(false, api);
1300
- updateSearchState(api);
1301
- reset(api);
1302
- break;
1303
- }
1304
- focusButtonIfRequired(api, details.name);
1305
- },
1306
- onSubmit: (api) => {
1307
- doFind(api);
1308
- focusButtonIfRequired(api, 'find');
1309
- },
1310
- onClose: () => {
1311
- editor.focus();
1312
- done(editor, currentSearchState);
1313
- editor.undoManager.add();
1314
- }
1315
- });
1316
- dialogApi.set(editor.windowManager.open(getDialogSpec(false, initialData), { inline: 'toolbar' }));
1317
- };
1318
-
1319
- const register$1 = (editor, currentSearchState) => {
1320
- editor.addCommand('SearchReplace', () => {
1321
- open(editor, currentSearchState);
1322
- });
1323
- };
1324
-
1325
- const showDialog = (editor, currentSearchState) => () => {
1326
- open(editor, currentSearchState);
1327
- };
1328
- const register = (editor, currentSearchState) => {
1329
- editor.ui.registry.addMenuItem('searchreplace', {
1330
- text: 'Find and replace...',
1331
- shortcut: 'Meta+F',
1332
- onAction: showDialog(editor, currentSearchState),
1333
- icon: 'search'
1334
- });
1335
- editor.ui.registry.addButton('searchreplace', {
1336
- tooltip: 'Find and replace',
1337
- onAction: showDialog(editor, currentSearchState),
1338
- icon: 'search',
1339
- shortcut: 'Meta+F'
1340
- });
1341
- editor.shortcuts.add('Meta+F', '', showDialog(editor, currentSearchState));
1342
- };
1343
-
1344
- var Plugin = () => {
1345
- global$3.add('searchreplace', (editor) => {
1346
- const currentSearchState = Cell({
1347
- index: -1,
1348
- count: 0,
1349
- text: '',
1350
- matchCase: false,
1351
- wholeWord: false,
1352
- inSelection: false
1353
- });
1354
- register$1(editor, currentSearchState);
1355
- register(editor, currentSearchState);
1356
- return get(editor, currentSearchState);
1357
- });
1358
- };
1359
-
1360
- Plugin();
1361
- /** *****
1362
- * DO NOT EXPORT ANYTHING
1363
- *
1364
- * IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
1365
- *******/
1366
-
1367
- })();