@vc-shell/framework 1.1.89 → 1.1.91-0

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 (338) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/core/api/platform.ts +9883 -9883
  3. package/core/composables/useNotifications/index.ts +32 -1
  4. package/core/composables/useUser/index.ts +74 -171
  5. package/core/composables/useUserManagement/index.ts +67 -25
  6. package/core/interceptors/index.ts +19 -56
  7. package/core/plugins/signalR/index.ts +27 -1
  8. package/core/providers/README.md +176 -0
  9. package/core/providers/auth-provider-manager.ts +74 -0
  10. package/core/providers/auth-provider-utils.ts +26 -0
  11. package/core/providers/example-custom-auth-provider.ts +161 -0
  12. package/core/providers/index.ts +3 -0
  13. package/core/providers/platform-auth-provider.ts +205 -0
  14. package/core/types/auth-provider.ts +45 -0
  15. package/core/types/index.ts +2 -0
  16. package/dist/core/api/platform.d.ts +1 -1
  17. package/dist/core/api/platform.d.ts.map +1 -1
  18. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  19. package/dist/core/composables/useUser/index.d.ts +18 -9
  20. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  21. package/dist/core/composables/useUserManagement/index.d.ts +7 -7
  22. package/dist/core/composables/useUserManagement/index.d.ts.map +1 -1
  23. package/dist/core/interceptors/index.d.ts +2 -1
  24. package/dist/core/interceptors/index.d.ts.map +1 -1
  25. package/dist/core/plugins/signalR/index.d.ts +2 -0
  26. package/dist/core/plugins/signalR/index.d.ts.map +1 -1
  27. package/dist/core/providers/auth-provider-manager.d.ts +34 -0
  28. package/dist/core/providers/auth-provider-manager.d.ts.map +1 -0
  29. package/dist/core/providers/auth-provider-utils.d.ts +17 -0
  30. package/dist/core/providers/auth-provider-utils.d.ts.map +1 -0
  31. package/dist/core/providers/example-custom-auth-provider.d.ts +45 -0
  32. package/dist/core/providers/example-custom-auth-provider.d.ts.map +1 -0
  33. package/dist/core/providers/index.d.ts +3 -0
  34. package/dist/core/providers/index.d.ts.map +1 -0
  35. package/dist/core/providers/platform-auth-provider.d.ts +34 -0
  36. package/dist/core/providers/platform-auth-provider.d.ts.map +1 -0
  37. package/dist/core/types/auth-provider.d.ts +27 -0
  38. package/dist/core/types/auth-provider.d.ts.map +1 -0
  39. package/dist/core/types/index.d.ts +1 -1
  40. package/dist/core/types/index.d.ts.map +1 -1
  41. package/dist/index.d.ts +8 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/injection-keys.d.ts +2 -1
  44. package/dist/injection-keys.d.ts.map +1 -1
  45. package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
  46. package/dist/shared/components/multilanguage-selector/multilanguage-selector.vue.d.ts +1 -1
  47. package/dist/shared/components/notifications/components/notification-container/index.d.ts +10 -10
  48. package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
  49. package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +2 -2
  50. package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
  51. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  52. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +2 -2
  53. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts +1 -1
  54. package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
  55. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts +1 -1
  56. package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
  57. package/dist/tsconfig.tsbuildinfo +1 -1
  58. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +1 -1
  59. package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
  60. package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts +2 -2
  61. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +1 -1
  62. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  63. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +1 -1
  64. package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
  65. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +1 -1
  66. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +2 -2
  67. package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
  68. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
  69. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  70. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +1 -1
  71. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +1 -1
  72. package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
  73. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +1 -1
  74. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
  75. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  76. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts +1 -1
  77. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +1 -1
  78. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
  79. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts +1 -1
  80. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts.map +1 -1
  81. package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts +3 -3
  82. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
  83. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  84. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  85. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +1 -1
  86. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
  87. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +5 -5
  88. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
  89. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +1 -1
  90. package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
  91. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +1 -1
  92. package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
  93. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts +2 -2
  94. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts +2 -2
  95. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts +3 -3
  96. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +1 -1
  97. package/package.json +7 -5
  98. package/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +2 -2
  99. package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +15 -1
  100. package/shared/modules/dynamic/helpers/nodeBuilder.ts +11 -3
  101. package/ui/components/organisms/vc-app/vc-app.vue +20 -2
  102. package/dist/assets/042c75b764bc78a7.svg +0 -1
  103. package/dist/assets/0ba156439a339f2a.svg +0 -1
  104. package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
  105. package/dist/assets/0f590f8a94577092.svg +0 -1
  106. package/dist/assets/0fc5820f8be53a1b.svg +0 -1
  107. package/dist/assets/105efd028edc1dfe.woff +0 -0
  108. package/dist/assets/10768e2cc79fc60b.svg +0 -1
  109. package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
  110. package/dist/assets/154365acf3010d96.woff2 +0 -0
  111. package/dist/assets/157b8721e0600ea8.svg +0 -1
  112. package/dist/assets/15e91cdd649cde9a.svg +0 -1
  113. package/dist/assets/19275e398ae57130.woff2 +0 -0
  114. package/dist/assets/1a3e84b2457f709a.woff +0 -0
  115. package/dist/assets/1de63eb118636cce.svg +0 -1
  116. package/dist/assets/1ea01de36eb5491b.svg +0 -1
  117. package/dist/assets/204eaf512fde2023.svg +0 -1
  118. package/dist/assets/2088983edf42e153.svg +0 -1
  119. package/dist/assets/208f810a9321a327.svg +0 -1
  120. package/dist/assets/21220a9d10e6c558.svg +0 -1
  121. package/dist/assets/220db345a102045d.woff2 +0 -0
  122. package/dist/assets/225da11d23968333.svg +0 -1
  123. package/dist/assets/226f862dd81bdc13.woff2 +0 -0
  124. package/dist/assets/23a2d53395ddb14f.woff +0 -0
  125. package/dist/assets/259e6ad461a52ad7.svg +0 -1
  126. package/dist/assets/261e6dec4d53b9ac.woff +0 -0
  127. package/dist/assets/262f46a0b6d94bb6.svg +0 -1
  128. package/dist/assets/2857c513073467da.svg +0 -1
  129. package/dist/assets/2b3be7889467d98f.woff +0 -0
  130. package/dist/assets/2d4e6190eec72737.svg +0 -1
  131. package/dist/assets/2eba973185078bc8.woff +0 -0
  132. package/dist/assets/334d3f6bc766c516.woff +0 -0
  133. package/dist/assets/34ff7dd0c2285956.svg +0 -1
  134. package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
  135. package/dist/assets/3d892965ab4f1cbb.woff2 +0 -0
  136. package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
  137. package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
  138. package/dist/assets/41275bcb979cb650.svg +0 -1
  139. package/dist/assets/434f7982590e462f.woff +0 -0
  140. package/dist/assets/475937116ee3314a.woff2 +0 -0
  141. package/dist/assets/489710fb710e73f0.woff +0 -0
  142. package/dist/assets/49791943b3872376.woff2 +0 -0
  143. package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
  144. package/dist/assets/4d7a77b0e5373992.svg +0 -1
  145. package/dist/assets/4e43c74354534fb3.svg +0 -1
  146. package/dist/assets/4fe75f5117100705.svg +0 -1
  147. package/dist/assets/52e261a005074e1b.woff +0 -0
  148. package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
  149. package/dist/assets/54cda5482c6c9218.woff +0 -0
  150. package/dist/assets/550f52072e8ccafe.woff2 +0 -0
  151. package/dist/assets/572bb1bb4156a9c1.svg +0 -1
  152. package/dist/assets/6075995d7e74da46.woff2 +0 -0
  153. package/dist/assets/617c4736236e199e.woff +0 -0
  154. package/dist/assets/67230f05dc94a265.svg +0 -1
  155. package/dist/assets/6798e4dd4add9b48.svg +0 -1
  156. package/dist/assets/686d4077c1e26876.woff2 +0 -0
  157. package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
  158. package/dist/assets/6a3e73faf406cf33.svg +0 -1
  159. package/dist/assets/72de3a63bc0b70dd.svg +0 -1
  160. package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
  161. package/dist/assets/74ed5f8a78e71106.svg +0 -1
  162. package/dist/assets/7a5aa5abd625137f.ttf +0 -0
  163. package/dist/assets/7ce0c166fd6a1204.woff +0 -0
  164. package/dist/assets/7d55399c2a7bc985.svg +0 -1
  165. package/dist/assets/7d970675c69fca1d.woff +0 -0
  166. package/dist/assets/7eda727273fd98d3.svg +0 -1
  167. package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
  168. package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
  169. package/dist/assets/861e6b7192b3b6c7.woff +0 -0
  170. package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
  171. package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
  172. package/dist/assets/910b0d99b9e26568.svg +0 -1
  173. package/dist/assets/91fe94e424323d61.woff +0 -0
  174. package/dist/assets/92508f8707159b51.svg +0 -1
  175. package/dist/assets/9392bf1d591e1abb.svg +0 -1
  176. package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
  177. package/dist/assets/9cb83236f6bb7ab1.svg +0 -1
  178. package/dist/assets/9d37314695c0b68d.woff +0 -0
  179. package/dist/assets/a03cdcd8da5bb987.woff +0 -0
  180. package/dist/assets/a18404194e3f9047.svg +0 -1
  181. package/dist/assets/a2017fe7f0a26510.svg +0 -1
  182. package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
  183. package/dist/assets/abf88f301a0730f4.svg +0 -1
  184. package/dist/assets/ac1a99b3d05d8232.woff +0 -0
  185. package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
  186. package/dist/assets/b1a596e31ad1185a.svg +0 -1
  187. package/dist/assets/b27767411c8427be.woff +0 -0
  188. package/dist/assets/b325adcae33bbe7a.svg +0 -1
  189. package/dist/assets/b372390551ca2fa1.svg +0 -1
  190. package/dist/assets/b5bb1e8fc975decd.svg +0 -1
  191. package/dist/assets/b645a4a2181b9dc1.svg +0 -1
  192. package/dist/assets/b6499ddce0a4ef7d.svg +0 -1
  193. package/dist/assets/b94421fadd23b0f2.svg +0 -1
  194. package/dist/assets/bb28fb0f27f1c11b.svg +0 -1
  195. package/dist/assets/c9191b638a10f67b.woff2 +0 -0
  196. package/dist/assets/ca791c5ca5848a03.svg +0 -1
  197. package/dist/assets/cb32840ce330103f.woff +0 -0
  198. package/dist/assets/ccc878931d74181b.woff2 +0 -0
  199. package/dist/assets/d084bda16abe8a56.svg +0 -1
  200. package/dist/assets/d32b129cae2fffd6.svg +0 -1
  201. package/dist/assets/d35a4c7113315758.woff2 +0 -0
  202. package/dist/assets/d3f792f54ae4c307.svg +0 -1
  203. package/dist/assets/d5a5b8630120073d.svg +0 -1
  204. package/dist/assets/d5f9664ebbfb104b.svg +0 -1
  205. package/dist/assets/d84247b59449dd88.woff2 +0 -0
  206. package/dist/assets/dceaf3b39091e6a4.woff +0 -0
  207. package/dist/assets/dd05d43ff0df2fc7.svg +0 -1
  208. package/dist/assets/e2ad5b3428289141.woff +0 -0
  209. package/dist/assets/e38acaa1757232e0.svg +0 -1
  210. package/dist/assets/e4a8550f1c7ffe36.svg +0 -1
  211. package/dist/assets/e5adb5ae3a3698f6.svg +0 -1
  212. package/dist/assets/e61a1889bac955f4.woff2 +0 -0
  213. package/dist/assets/e72bb11356af94c7.svg +0 -1
  214. package/dist/assets/e98196a9f8dcb2f0.svg +0 -1
  215. package/dist/assets/ebec912a42ad49ff.woff +0 -0
  216. package/dist/assets/ee6983981ffcbb41.woff2 +0 -0
  217. package/dist/assets/f09d89268e4c0317.svg +0 -1
  218. package/dist/assets/f239394367fcf005.woff2 +0 -0
  219. package/dist/assets/f5722262b6e7214e.woff2 +0 -0
  220. package/dist/assets/f7fc8bf46089d8b2.svg +0 -1
  221. package/dist/assets/fc829e3f399b70e0.woff2 +0 -0
  222. package/dist/assets/fe141d99763f5d2b.woff +0 -0
  223. package/dist/assets/fed13b0d59903483.svg +0 -1
  224. package/dist/assets/fed757d2c2344ead.woff2 +0 -0
  225. package/dist/assets/ffc438f20e79ce73.woff +0 -0
  226. package/dist/framework.js +0 -24766
  227. package/dist/index.css +0 -9
  228. package/dist/vendor-boolbase-A_-Pp38P.js +0 -23
  229. package/dist/vendor-cheerio-C46iBpCu.js +0 -1053
  230. package/dist/vendor-cheerio-select-C8emRZsx.js +0 -191
  231. package/dist/vendor-core-js-azBmvlGv.js +0 -1206
  232. package/dist/vendor-css-select-DR9bp36p.js +0 -622
  233. package/dist/vendor-css-what-CZZaquJM.js +0 -267
  234. package/dist/vendor-cypress-signalr-mock-DjBxJHA6.js +0 -769
  235. package/dist/vendor-date-fns-sZ1zMzTH.js +0 -3008
  236. package/dist/vendor-dom-serializer-Sk3xHhQk.js +0 -213
  237. package/dist/vendor-domelementtype-B3sFIGaC.js +0 -21
  238. package/dist/vendor-domhandler-CL40eeX9.js +0 -311
  239. package/dist/vendor-dompurify-C-JbJ3KX.js +0 -536
  240. package/dist/vendor-domutils-BiVCXO8c.js +0 -386
  241. package/dist/vendor-entities-CCReaWqU.js +0 -364
  242. package/dist/vendor-floating-ui-core-Cl9nBI4j.js +0 -349
  243. package/dist/vendor-floating-ui-dom-3z44E4mf.js +0 -395
  244. package/dist/vendor-floating-ui-utils-D2sT7feD.js +0 -259
  245. package/dist/vendor-floating-ui-vue-ClrgkeO5.js +0 -107
  246. package/dist/vendor-headlessui-vue-D7tzx4PC.js +0 -961
  247. package/dist/vendor-htmlparser2-CpQu33io.js +0 -735
  248. package/dist/vendor-intlify-core-base-Da62SG4M.js +0 -1130
  249. package/dist/vendor-intlify-message-compiler-CHvGSH2u.js +0 -952
  250. package/dist/vendor-intlify-shared-jWBPd9WB.js +0 -144
  251. package/dist/vendor-iso-639-1-BJO6WZAt.js +0 -781
  252. package/dist/vendor-linkify-it-LzoUhj6C.js +0 -199
  253. package/dist/vendor-linkifyjs-dCH9UYes.js +0 -701
  254. package/dist/vendor-lodash-es-BqkGj3Jl.js +0 -4816
  255. package/dist/vendor-lucide-vue-next-m0L4DzUL.js +0 -29780
  256. package/dist/vendor-markdown-it-Czg9qJTh.js +0 -2263
  257. package/dist/vendor-markdown-it-task-lists-BxLwscWK.js +0 -69
  258. package/dist/vendor-mdurl-DZFDNdqC.js +0 -192
  259. package/dist/vendor-microsoft-applicationinsights-analytics-js-BNSkz9ia.js +0 -1105
  260. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-Dp8OU6ZE.js +0 -261
  261. package/dist/vendor-microsoft-applicationinsights-channel-js-Bc73N-5y.js +0 -1809
  262. package/dist/vendor-microsoft-applicationinsights-common-DcnOqpgL.js +0 -1921
  263. package/dist/vendor-microsoft-applicationinsights-core-js-CX4NA2hM.js +0 -4127
  264. package/dist/vendor-microsoft-applicationinsights-dependencies-js-C_DhEOae.js +0 -1399
  265. package/dist/vendor-microsoft-applicationinsights-properties-js-COczDd7b.js +0 -572
  266. package/dist/vendor-microsoft-applicationinsights-shims-CxtPYiwp.js +0 -43
  267. package/dist/vendor-microsoft-applicationinsights-web-DtOQojwf.js +0 -487
  268. package/dist/vendor-microsoft-dynamicproto-js-DSkQkH3T.js +0 -147
  269. package/dist/vendor-microsoft-signalr-Bgpbb4fW.js +0 -1761
  270. package/dist/vendor-moment-DMLRxgRE.js +0 -2589
  271. package/dist/vendor-nevware21-ts-async-DFUnZ_sN.js +0 -260
  272. package/dist/vendor-nevware21-ts-utils-Dy41wRhA.js +0 -853
  273. package/dist/vendor-nth-check-CS1D-zr5.js +0 -45
  274. package/dist/vendor-orderedmap-B3SOk52B.js +0 -103
  275. package/dist/vendor-parse5-htmlparser2-tree-adapter-BWywtwol.js +0 -143
  276. package/dist/vendor-parse5-zq5Hn0y9.js +0 -5749
  277. package/dist/vendor-prettier-cZc5sCiS.js +0 -4875
  278. package/dist/vendor-prosemirror-commands-DlSOsoOz.js +0 -385
  279. package/dist/vendor-prosemirror-dropcursor-CqLA3EZY.js +0 -86
  280. package/dist/vendor-prosemirror-gapcursor-3PaVPyUV.js +0 -200
  281. package/dist/vendor-prosemirror-history-DzP74u0n.js +0 -248
  282. package/dist/vendor-prosemirror-keymap-CN6Hkrq2.js +0 -62
  283. package/dist/vendor-prosemirror-markdown-BBPyARPh.js +0 -650
  284. package/dist/vendor-prosemirror-model-CiCy9gkA.js +0 -2722
  285. package/dist/vendor-prosemirror-schema-list-asS28-n3.js +0 -87
  286. package/dist/vendor-prosemirror-state-DUZYoLys.js +0 -821
  287. package/dist/vendor-prosemirror-tables-CezTPhzU.js +0 -1711
  288. package/dist/vendor-prosemirror-transform-BOkRqJ32.js +0 -1508
  289. package/dist/vendor-prosemirror-view-CzsD5m3e.js +0 -3750
  290. package/dist/vendor-punycode-js-CgGegfA_.js +0 -133
  291. package/dist/vendor-rope-sequence-BWC2FSrq.js +0 -100
  292. package/dist/vendor-semver-B87_S22g.js +0 -1021
  293. package/dist/vendor-swiper-1bp0oJwt.js +0 -3387
  294. package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +0 -1
  295. package/dist/vendor-tanstack-vue-virtual-CD9yLWd7.js +0 -1
  296. package/dist/vendor-tiptap-core-rgc3Sj5Y.js +0 -3104
  297. package/dist/vendor-tiptap-extension-blockquote-DgzMeNpc.js +0 -41
  298. package/dist/vendor-tiptap-extension-bold-DZbX5Qiw.js +0 -71
  299. package/dist/vendor-tiptap-extension-code-BcakHaXe.js +0 -49
  300. package/dist/vendor-tiptap-extension-code-block-B0U7g1XA.js +0 -192
  301. package/dist/vendor-tiptap-extension-document-BBhadLNS.js +0 -9
  302. package/dist/vendor-tiptap-extension-hard-break-eyl10A9U.js +0 -53
  303. package/dist/vendor-tiptap-extension-heading-BmX_Abvh.js +0 -57
  304. package/dist/vendor-tiptap-extension-horizontal-rule-DyYIWV6W.js +0 -53
  305. package/dist/vendor-tiptap-extension-image-C06iDyEi.js +0 -70
  306. package/dist/vendor-tiptap-extension-italic-B2YDHBEe.js +0 -70
  307. package/dist/vendor-tiptap-extension-link-Bw8_3Rr4.js +0 -287
  308. package/dist/vendor-tiptap-extension-list-qHzpj6eq.js +0 -420
  309. package/dist/vendor-tiptap-extension-paragraph-BnCRfXCL.js +0 -31
  310. package/dist/vendor-tiptap-extension-placeholder-BVZ1jBA2.js +0 -1
  311. package/dist/vendor-tiptap-extension-strike-Naksm43m.js +0 -61
  312. package/dist/vendor-tiptap-extension-table-Cguez3tu.js +0 -302
  313. package/dist/vendor-tiptap-extension-table-cell-lniviH1T.js +0 -1
  314. package/dist/vendor-tiptap-extension-table-header-lniviH1T.js +0 -1
  315. package/dist/vendor-tiptap-extension-table-row-lniviH1T.js +0 -1
  316. package/dist/vendor-tiptap-extension-text-CixjyWfN.js +0 -8
  317. package/dist/vendor-tiptap-extension-text-style-CVsjuWJ4.js +0 -230
  318. package/dist/vendor-tiptap-extension-underline-Rwkvga0F.js +0 -40
  319. package/dist/vendor-tiptap-extensions-F9A02hii.js +0 -289
  320. package/dist/vendor-tiptap-markdown-BSUpswXr.js +0 -826
  321. package/dist/vendor-tiptap-pm-BUxx7nt1.js +0 -1
  322. package/dist/vendor-tiptap-starter-kit-BUgq7S1_.js +0 -28
  323. package/dist/vendor-tiptap-vue-3-UHrHfZLG.js +0 -157
  324. package/dist/vendor-truncate-html-DYC0Lj9o.js +0 -145
  325. package/dist/vendor-uc-micro-4lbSaZOs.js +0 -17
  326. package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +0 -93
  327. package/dist/vendor-vee-validate-rules-4oWUZPpG.js +0 -316
  328. package/dist/vendor-vue-currency-input-BqaYAdhD.js +0 -317
  329. package/dist/vendor-vue-demi-CD9yLWd7.js +0 -1
  330. package/dist/vendor-vue-devtools-api-aVYGocXp.js +0 -93
  331. package/dist/vendor-vue-i18n-CO5LWKE0.js +0 -1370
  332. package/dist/vendor-vue3-application-insights-CE6eo4vj.js +0 -69
  333. package/dist/vendor-vue3-touch-events-DqysuuWh.js +0 -169
  334. package/dist/vendor-vuepic-vue-datepicker-Chx5s5I-.js +0 -5116
  335. package/dist/vendor-vueuse-components-B0zqjNRW.js +0 -542
  336. package/dist/vendor-vueuse-core-CYgwn-B2.js +0 -5130
  337. package/dist/vendor-vueuse-shared-B_uDJJ6V.js +0 -1169
  338. package/dist/vendor-w3c-keyname-CLxH8j-f.js +0 -92
@@ -1,3104 +0,0 @@
1
- import { N as G, E as se, S as D, T as A, P, a as B, A as ie } from "./vendor-prosemirror-state-DUZYoLys.js";
2
- import { E as ae } from "./vendor-prosemirror-view-CzsD5m3e.js";
3
- import { a as ce } from "./vendor-prosemirror-keymap-CN6Hkrq2.js";
4
- import { f as le, c as ct, T as de, e as ue, l as fe, j as Tt, a as U, b as pe, R as me } from "./vendor-prosemirror-transform-BOkRqJ32.js";
5
- import { D as he, a as Ct, F as N, b as ge, d as nt, S as ve } from "./vendor-prosemirror-model-CiCy9gkA.js";
6
- import { c as ye, d as be, e as ke, j as we, a as Me, b as Se, f as Ee, g as xe, h as Te, l as Ce, i as Ae, n as Pe, s as $e, k as Ie, m as Ne, o as Oe, p as Be, q as yt, w as je } from "./vendor-prosemirror-commands-DlSOsoOz.js";
7
- import { l as Re, s as De, w as Fe } from "./vendor-prosemirror-schema-list-asS28-n3.js";
8
- var _e = Object.defineProperty, At = (e, t) => {
9
- for (var n in t)
10
- _e(e, n, { get: t[n], enumerable: !0 });
11
- };
12
- function X(e) {
13
- const { state: t, transaction: n } = e;
14
- let { selection: r } = n, { doc: o } = n, { storedMarks: s } = n;
15
- return {
16
- ...t,
17
- apply: t.apply.bind(t),
18
- applyTransaction: t.applyTransaction.bind(t),
19
- plugins: t.plugins,
20
- schema: t.schema,
21
- reconfigure: t.reconfigure.bind(t),
22
- toJSON: t.toJSON.bind(t),
23
- get storedMarks() {
24
- return s;
25
- },
26
- get selection() {
27
- return r;
28
- },
29
- get doc() {
30
- return o;
31
- },
32
- get tr() {
33
- return r = n.selection, o = n.doc, s = n.storedMarks, n;
34
- }
35
- };
36
- }
37
- var Y = class {
38
- constructor(e) {
39
- this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
40
- }
41
- get hasCustomState() {
42
- return !!this.customState;
43
- }
44
- get state() {
45
- return this.customState || this.editor.state;
46
- }
47
- get commands() {
48
- const { rawCommands: e, editor: t, state: n } = this, { view: r } = t, { tr: o } = n, s = this.buildProps(o);
49
- return Object.fromEntries(
50
- Object.entries(e).map(([i, a]) => [i, (...l) => {
51
- const d = a(...l)(s);
52
- return !o.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(o), d;
53
- }])
54
- );
55
- }
56
- get chain() {
57
- return () => this.createChain();
58
- }
59
- get can() {
60
- return () => this.createCan();
61
- }
62
- createChain(e, t = !0) {
63
- const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = [], a = !!e, c = e || o.tr, l = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(c), i.every((u) => u === !0)), d = {
64
- ...Object.fromEntries(
65
- Object.entries(n).map(([u, p]) => [u, (...g) => {
66
- const m = this.buildProps(c, t), h = p(...g)(m);
67
- return i.push(h), d;
68
- }])
69
- ),
70
- run: l
71
- };
72
- return d;
73
- }
74
- createCan(e) {
75
- const { rawCommands: t, state: n } = this, r = !1, o = e || n.tr, s = this.buildProps(o, r);
76
- return {
77
- ...Object.fromEntries(
78
- Object.entries(t).map(([a, c]) => [a, (...l) => c(...l)({ ...s, dispatch: void 0 })])
79
- ),
80
- chain: () => this.createChain(o, r)
81
- };
82
- }
83
- buildProps(e, t = !0) {
84
- const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = {
85
- tr: e,
86
- editor: r,
87
- view: s,
88
- state: X({
89
- state: o,
90
- transaction: e
91
- }),
92
- dispatch: t ? () => {
93
- } : void 0,
94
- chain: () => this.createChain(e, t),
95
- can: () => this.createCan(e),
96
- get commands() {
97
- return Object.fromEntries(
98
- Object.entries(n).map(([a, c]) => [a, (...l) => c(...l)(i)])
99
- );
100
- }
101
- };
102
- return i;
103
- }
104
- }, Le = class {
105
- constructor() {
106
- this.callbacks = {};
107
- }
108
- on(e, t) {
109
- return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
110
- }
111
- emit(e, ...t) {
112
- const n = this.callbacks[e];
113
- return n && n.forEach((r) => r.apply(this, t)), this;
114
- }
115
- off(e, t) {
116
- const n = this.callbacks[e];
117
- return n && (t ? this.callbacks[e] = n.filter((r) => r !== t) : delete this.callbacks[e]), this;
118
- }
119
- once(e, t) {
120
- const n = (...r) => {
121
- this.off(e, n), t.apply(this, r);
122
- };
123
- return this.on(e, n);
124
- }
125
- removeAllListeners() {
126
- this.callbacks = {};
127
- }
128
- };
129
- function ze(e, t) {
130
- const n = new de(e);
131
- return t.forEach((r) => {
132
- r.steps.forEach((o) => {
133
- n.step(o);
134
- });
135
- }), n;
136
- }
137
- var Pt = (e) => {
138
- const t = e.childNodes;
139
- for (let n = t.length - 1; n >= 0; n -= 1) {
140
- const r = t[n];
141
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Pt(r);
142
- }
143
- return e;
144
- };
145
- function z(e) {
146
- if (typeof window > "u")
147
- throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
148
- const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
149
- return Pt(n);
150
- }
151
- function F(e, t, n) {
152
- if (e instanceof ge || e instanceof N)
153
- return e;
154
- n = {
155
- slice: !0,
156
- parseOptions: {},
157
- ...n
158
- };
159
- const r = typeof e == "object" && e !== null, o = typeof e == "string";
160
- if (r)
161
- try {
162
- if (Array.isArray(e) && e.length > 0)
163
- return N.fromArray(e.map((a) => t.nodeFromJSON(a)));
164
- const i = t.nodeFromJSON(e);
165
- return n.errorOnInvalidContent && i.check(), i;
166
- } catch (s) {
167
- if (n.errorOnInvalidContent)
168
- throw new Error("[tiptap error]: Invalid JSON content", { cause: s });
169
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", s), F("", t, n);
170
- }
171
- if (o) {
172
- if (n.errorOnInvalidContent) {
173
- let i = !1, a = "";
174
- const c = new Ct({
175
- topNode: t.spec.topNode,
176
- marks: t.spec.marks,
177
- // Prosemirror's schemas are executed such that: the last to execute, matches last
178
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
179
- nodes: t.spec.nodes.append({
180
- __tiptap__private__unknown__catch__all__node: {
181
- content: "inline*",
182
- group: "block",
183
- parseDOM: [
184
- {
185
- tag: "*",
186
- getAttrs: (l) => (i = !0, a = typeof l == "string" ? l : l.outerHTML, null)
187
- }
188
- ]
189
- }
190
- })
191
- });
192
- if (n.slice ? nt.fromSchema(c).parseSlice(z(e), n.parseOptions) : nt.fromSchema(c).parse(z(e), n.parseOptions), n.errorOnInvalidContent && i)
193
- throw new Error("[tiptap error]: Invalid HTML content", {
194
- cause: new Error(`Invalid element found: ${a}`)
195
- });
196
- }
197
- const s = nt.fromSchema(t);
198
- return n.slice ? s.parseSlice(z(e), n.parseOptions).content : s.parse(z(e), n.parseOptions);
199
- }
200
- return F("", t, n);
201
- }
202
- function it(e, t, n = {}, r = {}) {
203
- return F(e, t, {
204
- slice: !1,
205
- parseOptions: n,
206
- errorOnInvalidContent: r.errorOnInvalidContent
207
- });
208
- }
209
- function Ve(e) {
210
- for (let t = 0; t < e.edgeCount; t += 1) {
211
- const { type: n } = e.edge(t);
212
- if (n.isTextblock && !n.hasRequiredAttrs())
213
- return n;
214
- }
215
- return null;
216
- }
217
- function jr(e, t, n) {
218
- const r = [];
219
- return e.nodesBetween(t.from, t.to, (o, s) => {
220
- n(o) && r.push({
221
- node: o,
222
- pos: s
223
- });
224
- }), r;
225
- }
226
- function He(e, t) {
227
- for (let n = e.depth; n > 0; n -= 1) {
228
- const r = e.node(n);
229
- if (t(r))
230
- return {
231
- pos: n > 0 ? e.before(n) : 0,
232
- start: e.start(n),
233
- depth: n,
234
- node: r
235
- };
236
- }
237
- }
238
- function Q(e) {
239
- return (t) => He(t.$from, e);
240
- }
241
- function y(e, t, n) {
242
- return e.config[t] === void 0 && e.parent ? y(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
243
- ...n,
244
- parent: e.parent ? y(e.parent, t, n) : null
245
- }) : e.config[t];
246
- }
247
- function lt(e) {
248
- return e.map((t) => {
249
- const n = {
250
- name: t.name,
251
- options: t.options,
252
- storage: t.storage
253
- }, r = y(t, "addExtensions", n);
254
- return r ? [t, ...lt(r())] : t;
255
- }).flat(10);
256
- }
257
- function dt(e, t) {
258
- const n = he.fromSchema(t).serializeFragment(e), o = document.implementation.createHTMLDocument().createElement("div");
259
- return o.appendChild(n), o.innerHTML;
260
- }
261
- function $t(e) {
262
- return typeof e == "function";
263
- }
264
- function w(e, t = void 0, ...n) {
265
- return $t(e) ? t ? e.bind(t)(...n) : e(...n) : e;
266
- }
267
- function We(e = {}) {
268
- return Object.keys(e).length === 0 && e.constructor === Object;
269
- }
270
- function _(e) {
271
- const t = e.filter((o) => o.type === "extension"), n = e.filter((o) => o.type === "node"), r = e.filter((o) => o.type === "mark");
272
- return {
273
- baseExtensions: t,
274
- nodeExtensions: n,
275
- markExtensions: r
276
- };
277
- }
278
- function It(e) {
279
- const t = [], { nodeExtensions: n, markExtensions: r } = _(e), o = [...n, ...r], s = {
280
- default: null,
281
- validate: void 0,
282
- rendered: !0,
283
- renderHTML: null,
284
- parseHTML: null,
285
- keepOnSplit: !0,
286
- isRequired: !1
287
- };
288
- return e.forEach((i) => {
289
- const a = {
290
- name: i.name,
291
- options: i.options,
292
- storage: i.storage,
293
- extensions: o
294
- }, c = y(
295
- i,
296
- "addGlobalAttributes",
297
- a
298
- );
299
- if (!c)
300
- return;
301
- c().forEach((d) => {
302
- d.types.forEach((u) => {
303
- Object.entries(d.attributes).forEach(([p, f]) => {
304
- t.push({
305
- type: u,
306
- name: p,
307
- attribute: {
308
- ...s,
309
- ...f
310
- }
311
- });
312
- });
313
- });
314
- });
315
- }), o.forEach((i) => {
316
- const a = {
317
- name: i.name,
318
- options: i.options,
319
- storage: i.storage
320
- }, c = y(
321
- i,
322
- "addAttributes",
323
- a
324
- );
325
- if (!c)
326
- return;
327
- const l = c();
328
- Object.entries(l).forEach(([d, u]) => {
329
- const p = {
330
- ...s,
331
- ...u
332
- };
333
- typeof p?.default == "function" && (p.default = p.default()), p?.isRequired && p?.default === void 0 && delete p.default, t.push({
334
- type: i.name,
335
- name: d,
336
- attribute: p
337
- });
338
- });
339
- }), t;
340
- }
341
- function Ue(...e) {
342
- return e.filter((t) => !!t).reduce((t, n) => {
343
- const r = { ...t };
344
- return Object.entries(n).forEach(([o, s]) => {
345
- if (!r[o]) {
346
- r[o] = s;
347
- return;
348
- }
349
- if (o === "class") {
350
- const a = s ? String(s).split(" ") : [], c = r[o] ? r[o].split(" ") : [], l = a.filter((d) => !c.includes(d));
351
- r[o] = [...c, ...l].join(" ");
352
- } else if (o === "style") {
353
- const a = s ? s.split(";").map((d) => d.trim()).filter(Boolean) : [], c = r[o] ? r[o].split(";").map((d) => d.trim()).filter(Boolean) : [], l = /* @__PURE__ */ new Map();
354
- c.forEach((d) => {
355
- const [u, p] = d.split(":").map((f) => f.trim());
356
- l.set(u, p);
357
- }), a.forEach((d) => {
358
- const [u, p] = d.split(":").map((f) => f.trim());
359
- l.set(u, p);
360
- }), r[o] = Array.from(l.entries()).map(([d, u]) => `${d}: ${u}`).join("; ");
361
- } else
362
- r[o] = s;
363
- }), r;
364
- }, {});
365
- }
366
- function K(e, t) {
367
- return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
368
- [n.name]: e.attrs[n.name]
369
- }).reduce((n, r) => Ue(n, r), {});
370
- }
371
- function qe(e) {
372
- return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
373
- }
374
- function bt(e, t) {
375
- return "style" in e ? e : {
376
- ...e,
377
- getAttrs: (n) => {
378
- const r = e.getAttrs ? e.getAttrs(n) : e.attrs;
379
- if (r === !1)
380
- return !1;
381
- const o = t.reduce((s, i) => {
382
- const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : qe(n.getAttribute(i.name));
383
- return a == null ? s : {
384
- ...s,
385
- [i.name]: a
386
- };
387
- }, {});
388
- return { ...r, ...o };
389
- }
390
- };
391
- }
392
- function kt(e) {
393
- return Object.fromEntries(
394
- // @ts-ignore
395
- Object.entries(e).filter(([t, n]) => t === "attrs" && We(n) ? !1 : n != null)
396
- );
397
- }
398
- function Ke(e, t) {
399
- var n;
400
- const r = It(e), { nodeExtensions: o, markExtensions: s } = _(e), i = (n = o.find((l) => y(l, "topNode"))) == null ? void 0 : n.name, a = Object.fromEntries(
401
- o.map((l) => {
402
- const d = r.filter((v) => v.type === l.name), u = {
403
- name: l.name,
404
- options: l.options,
405
- storage: l.storage,
406
- editor: t
407
- }, p = e.reduce((v, b) => {
408
- const k = y(b, "extendNodeSchema", u);
409
- return {
410
- ...v,
411
- ...k ? k(l) : {}
412
- };
413
- }, {}), f = kt({
414
- ...p,
415
- content: w(y(l, "content", u)),
416
- marks: w(y(l, "marks", u)),
417
- group: w(y(l, "group", u)),
418
- inline: w(y(l, "inline", u)),
419
- atom: w(y(l, "atom", u)),
420
- selectable: w(y(l, "selectable", u)),
421
- draggable: w(y(l, "draggable", u)),
422
- code: w(y(l, "code", u)),
423
- whitespace: w(y(l, "whitespace", u)),
424
- linebreakReplacement: w(
425
- y(l, "linebreakReplacement", u)
426
- ),
427
- defining: w(y(l, "defining", u)),
428
- isolating: w(y(l, "isolating", u)),
429
- attrs: Object.fromEntries(
430
- d.map((v) => {
431
- var b, k;
432
- return [
433
- v.name,
434
- { default: (b = v?.attribute) == null ? void 0 : b.default, validate: (k = v?.attribute) == null ? void 0 : k.validate }
435
- ];
436
- })
437
- )
438
- }), g = w(y(l, "parseHTML", u));
439
- g && (f.parseDOM = g.map(
440
- (v) => bt(v, d)
441
- ));
442
- const m = y(l, "renderHTML", u);
443
- m && (f.toDOM = (v) => m({
444
- node: v,
445
- HTMLAttributes: K(v, d)
446
- }));
447
- const h = y(l, "renderText", u);
448
- return h && (f.toText = h), [l.name, f];
449
- })
450
- ), c = Object.fromEntries(
451
- s.map((l) => {
452
- const d = r.filter((h) => h.type === l.name), u = {
453
- name: l.name,
454
- options: l.options,
455
- storage: l.storage,
456
- editor: t
457
- }, p = e.reduce((h, v) => {
458
- const b = y(v, "extendMarkSchema", u);
459
- return {
460
- ...h,
461
- ...b ? b(l) : {}
462
- };
463
- }, {}), f = kt({
464
- ...p,
465
- inclusive: w(y(l, "inclusive", u)),
466
- excludes: w(y(l, "excludes", u)),
467
- group: w(y(l, "group", u)),
468
- spanning: w(y(l, "spanning", u)),
469
- code: w(y(l, "code", u)),
470
- attrs: Object.fromEntries(
471
- d.map((h) => {
472
- var v, b;
473
- return [
474
- h.name,
475
- { default: (v = h?.attribute) == null ? void 0 : v.default, validate: (b = h?.attribute) == null ? void 0 : b.validate }
476
- ];
477
- })
478
- )
479
- }), g = w(y(l, "parseHTML", u));
480
- g && (f.parseDOM = g.map(
481
- (h) => bt(h, d)
482
- ));
483
- const m = y(l, "renderHTML", u);
484
- return m && (f.toDOM = (h) => m({
485
- mark: h,
486
- HTMLAttributes: K(h, d)
487
- })), [l.name, f];
488
- })
489
- );
490
- return new Ct({
491
- topNode: i,
492
- nodes: a,
493
- marks: c
494
- });
495
- }
496
- function Je(e) {
497
- const t = e.filter((n, r) => e.indexOf(n) !== r);
498
- return Array.from(new Set(t));
499
- }
500
- function ut(e) {
501
- return e.sort((n, r) => {
502
- const o = y(n, "priority") || 100, s = y(r, "priority") || 100;
503
- return o > s ? -1 : o < s ? 1 : 0;
504
- });
505
- }
506
- function Nt(e) {
507
- const t = ut(lt(e)), n = Je(t.map((r) => r.name));
508
- return n.length && console.warn(
509
- `[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
510
- ), t;
511
- }
512
- function Ot(e, t, n) {
513
- const { from: r, to: o } = t, { blockSeparator: s = `
514
-
515
- `, textSerializers: i = {} } = n || {};
516
- let a = "";
517
- return e.nodesBetween(r, o, (c, l, d, u) => {
518
- var p;
519
- c.isBlock && l > r && (a += s);
520
- const f = i?.[c.type.name];
521
- if (f)
522
- return d && (a += f({
523
- node: c,
524
- pos: l,
525
- parent: d,
526
- index: u,
527
- range: t
528
- })), !1;
529
- c.isText && (a += (p = c?.text) == null ? void 0 : p.slice(Math.max(r, l) - l, o - l));
530
- }), a;
531
- }
532
- function Ge(e, t) {
533
- const n = {
534
- from: 0,
535
- to: e.content.size
536
- };
537
- return Ot(e, n, t);
538
- }
539
- function Bt(e) {
540
- return Object.fromEntries(
541
- Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText])
542
- );
543
- }
544
- function $(e, t) {
545
- if (typeof e == "string") {
546
- if (!t.marks[e])
547
- throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
548
- return t.marks[e];
549
- }
550
- return e;
551
- }
552
- function jt(e, t) {
553
- const n = $(t, e.schema), { from: r, to: o, empty: s } = e.selection, i = [];
554
- s ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, o, (c) => {
555
- i.push(...c.marks);
556
- });
557
- const a = i.find((c) => c.type.name === n.name);
558
- return a ? { ...a.attrs } : {};
559
- }
560
- function E(e, t) {
561
- if (typeof e == "string") {
562
- if (!t.nodes[e])
563
- throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
564
- return t.nodes[e];
565
- }
566
- return e;
567
- }
568
- function Xe(e, t) {
569
- const n = E(t, e.schema), { from: r, to: o } = e.selection, s = [];
570
- e.doc.nodesBetween(r, o, (a) => {
571
- s.push(a);
572
- });
573
- const i = s.reverse().find((a) => a.type.name === n.name);
574
- return i ? { ...i.attrs } : {};
575
- }
576
- function Z(e, t) {
577
- return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
578
- }
579
- function Ye(e, t) {
580
- const n = Z(
581
- typeof t == "string" ? t : t.name,
582
- e.schema
583
- );
584
- return n === "node" ? Xe(e, t) : n === "mark" ? jt(e, t) : {};
585
- }
586
- function Qe(e, t = JSON.stringify) {
587
- const n = {};
588
- return e.filter((r) => {
589
- const o = t(r);
590
- return Object.prototype.hasOwnProperty.call(n, o) ? !1 : n[o] = !0;
591
- });
592
- }
593
- function Ze(e) {
594
- const t = Qe(e);
595
- return t.length === 1 ? t : t.filter((n, r) => !t.filter((s, i) => i !== r).some((s) => n.oldRange.from >= s.oldRange.from && n.oldRange.to <= s.oldRange.to && n.newRange.from >= s.newRange.from && n.newRange.to <= s.newRange.to));
596
- }
597
- function tn(e) {
598
- const { mapping: t, steps: n } = e, r = [];
599
- return t.maps.forEach((o, s) => {
600
- const i = [];
601
- if (o.ranges.length)
602
- o.forEach((a, c) => {
603
- i.push({ from: a, to: c });
604
- });
605
- else {
606
- const { from: a, to: c } = n[s];
607
- if (a === void 0 || c === void 0)
608
- return;
609
- i.push({ from: a, to: c });
610
- }
611
- i.forEach(({ from: a, to: c }) => {
612
- const l = t.slice(s).map(a, -1), d = t.slice(s).map(c), u = t.invert().map(l, -1), p = t.invert().map(d);
613
- r.push({
614
- oldRange: {
615
- from: u,
616
- to: p
617
- },
618
- newRange: {
619
- from: l,
620
- to: d
621
- }
622
- });
623
- });
624
- }), Ze(r);
625
- }
626
- function ft(e) {
627
- return Object.prototype.toString.call(e) === "[object RegExp]";
628
- }
629
- function J(e, t, n = { strict: !0 }) {
630
- const r = Object.keys(t);
631
- return r.length ? r.every((o) => n.strict ? t[o] === e[o] : ft(t[o]) ? t[o].test(e[o]) : t[o] === e[o]) : !0;
632
- }
633
- function Rt(e, t, n = {}) {
634
- return e.find((r) => r.type === t && J(
635
- // Only check equality for the attributes that are provided
636
- Object.fromEntries(Object.keys(n).map((o) => [o, r.attrs[o]])),
637
- n
638
- ));
639
- }
640
- function wt(e, t, n = {}) {
641
- return !!Rt(e, t, n);
642
- }
643
- function pt(e, t, n) {
644
- var r;
645
- if (!e || !t)
646
- return;
647
- let o = e.parent.childAfter(e.parentOffset);
648
- if ((!o.node || !o.node.marks.some((d) => d.type === t)) && (o = e.parent.childBefore(e.parentOffset)), !o.node || !o.node.marks.some((d) => d.type === t) || (n = n || ((r = o.node.marks[0]) == null ? void 0 : r.attrs), !Rt([...o.node.marks], t, n)))
649
- return;
650
- let i = o.index, a = e.start() + o.offset, c = i + 1, l = a + o.node.nodeSize;
651
- for (; i > 0 && wt([...e.parent.child(i - 1).marks], t, n); )
652
- i -= 1, a -= e.parent.child(i).nodeSize;
653
- for (; c < e.parent.childCount && wt([...e.parent.child(c).marks], t, n); )
654
- l += e.parent.child(c).nodeSize, c += 1;
655
- return {
656
- from: a,
657
- to: l
658
- };
659
- }
660
- function Dt(e, t, n) {
661
- const r = [];
662
- return e === t ? n.resolve(e).marks().forEach((o) => {
663
- const s = n.resolve(e), i = pt(s, o.type);
664
- i && r.push({
665
- mark: o,
666
- ...i
667
- });
668
- }) : n.nodesBetween(e, t, (o, s) => {
669
- !o || o?.nodeSize === void 0 || r.push(
670
- ...o.marks.map((i) => ({
671
- from: s,
672
- to: s + o.nodeSize,
673
- mark: i
674
- }))
675
- );
676
- }), r;
677
- }
678
- var Rr = (e, t, n, r = 20) => {
679
- const o = e.doc.resolve(n);
680
- let s = r, i = null;
681
- for (; s > 0 && i === null; ) {
682
- const a = o.node(s);
683
- a?.type.name === t ? i = a : s -= 1;
684
- }
685
- return [i, s];
686
- };
687
- function rt(e, t) {
688
- return t.nodes[e] || t.marks[e] || null;
689
- }
690
- function q(e, t, n) {
691
- return Object.fromEntries(
692
- Object.entries(n).filter(([r]) => {
693
- const o = e.find((s) => s.type === t && s.name === r);
694
- return o ? o.attribute.keepOnSplit : !1;
695
- })
696
- );
697
- }
698
- var en = (e, t = 500) => {
699
- let n = "";
700
- const r = e.parentOffset;
701
- return e.parent.nodesBetween(Math.max(0, r - t), r, (o, s, i, a) => {
702
- var c, l;
703
- const d = ((l = (c = o.type.spec).toText) == null ? void 0 : l.call(c, {
704
- node: o,
705
- pos: s,
706
- parent: i,
707
- index: a
708
- })) || o.textContent || "%leaf%";
709
- n += o.isAtom && !o.isText ? d : d.slice(0, Math.max(0, r - s));
710
- }), n;
711
- };
712
- function at(e, t, n = {}) {
713
- const { empty: r, ranges: o } = e.selection, s = t ? $(t, e.schema) : null;
714
- if (r)
715
- return !!(e.storedMarks || e.selection.$from.marks()).filter((u) => s ? s.name === u.type.name : !0).find((u) => J(u.attrs, n, { strict: !1 }));
716
- let i = 0;
717
- const a = [];
718
- if (o.forEach(({ $from: u, $to: p }) => {
719
- const f = u.pos, g = p.pos;
720
- e.doc.nodesBetween(f, g, (m, h) => {
721
- if (!m.isText && !m.marks.length)
722
- return;
723
- const v = Math.max(f, h), b = Math.min(g, h + m.nodeSize), k = b - v;
724
- i += k, a.push(
725
- ...m.marks.map((S) => ({
726
- mark: S,
727
- from: v,
728
- to: b
729
- }))
730
- );
731
- });
732
- }), i === 0)
733
- return !1;
734
- const c = a.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) => J(u.mark.attrs, n, { strict: !1 })).reduce((u, p) => u + p.to - p.from, 0), l = a.filter((u) => s ? u.mark.type !== s && u.mark.type.excludes(s) : !0).reduce((u, p) => u + p.to - p.from, 0);
735
- return (c > 0 ? c + l : c) >= i;
736
- }
737
- function L(e, t, n = {}) {
738
- const { from: r, to: o, empty: s } = e.selection, i = t ? E(t, e.schema) : null, a = [];
739
- e.doc.nodesBetween(r, o, (u, p) => {
740
- if (u.isText)
741
- return;
742
- const f = Math.max(r, p), g = Math.min(o, p + u.nodeSize);
743
- a.push({
744
- node: u,
745
- from: f,
746
- to: g
747
- });
748
- });
749
- const c = o - r, l = a.filter((u) => i ? i.name === u.node.type.name : !0).filter((u) => J(u.node.attrs, n, { strict: !1 }));
750
- return s ? !!l.length : l.reduce((u, p) => u + p.to - p.from, 0) >= c;
751
- }
752
- function nn(e, t, n = {}) {
753
- if (!t)
754
- return L(e, null, n) || at(e, null, n);
755
- const r = Z(t, e.schema);
756
- return r === "node" ? L(e, t, n) : r === "mark" ? at(e, t, n) : !1;
757
- }
758
- var Dr = (e, t) => {
759
- const { $from: n, $to: r, $anchor: o } = e.selection;
760
- if (t) {
761
- const s = Q((a) => a.type.name === t)(e.selection);
762
- if (!s)
763
- return !1;
764
- const i = e.doc.resolve(s.pos + 1);
765
- return o.pos + 1 === i.end();
766
- }
767
- return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
768
- }, Fr = (e) => {
769
- const { $from: t, $to: n } = e.selection;
770
- return !(t.parentOffset > 0 || t.pos !== n.pos);
771
- };
772
- function Mt(e, t) {
773
- return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
774
- }
775
- function St(e, t) {
776
- const { nodeExtensions: n } = _(t), r = n.find((i) => i.name === e);
777
- if (!r)
778
- return !1;
779
- const o = {
780
- name: r.name,
781
- options: r.options,
782
- storage: r.storage
783
- }, s = w(y(r, "group", o));
784
- return typeof s != "string" ? !1 : s.split(" ").includes("list");
785
- }
786
- function mt(e, {
787
- checkChildren: t = !0,
788
- ignoreWhitespace: n = !1
789
- } = {}) {
790
- var r;
791
- if (n) {
792
- if (e.type.name === "hardBreak")
793
- return !0;
794
- if (e.isText)
795
- return /^\s*$/m.test((r = e.text) != null ? r : "");
796
- }
797
- if (e.isText)
798
- return !e.text;
799
- if (e.isAtom || e.isLeaf)
800
- return !1;
801
- if (e.content.childCount === 0)
802
- return !0;
803
- if (t) {
804
- let o = !0;
805
- return e.content.forEach((s) => {
806
- o !== !1 && (mt(s, { ignoreWhitespace: n, checkChildren: t }) || (o = !1));
807
- }), o;
808
- }
809
- return !1;
810
- }
811
- function _r(e) {
812
- return e instanceof G;
813
- }
814
- function Ft(e) {
815
- return e instanceof A;
816
- }
817
- function O(e = 0, t = 0, n = 0) {
818
- return Math.min(Math.max(e, t), n);
819
- }
820
- function _t(e, t = null) {
821
- if (!t)
822
- return null;
823
- const n = D.atStart(e), r = D.atEnd(e);
824
- if (t === "start" || t === !0)
825
- return n;
826
- if (t === "end")
827
- return r;
828
- const o = n.from, s = r.to;
829
- return t === "all" ? A.create(e, O(0, o, s), O(e.content.size, o, s)) : A.create(e, O(t, o, s), O(t, o, s));
830
- }
831
- function rn(e, t, n) {
832
- const r = e.steps.length - 1;
833
- if (r < t)
834
- return;
835
- const o = e.steps[r];
836
- if (!(o instanceof pe || o instanceof me))
837
- return;
838
- const s = e.mapping.maps[r];
839
- let i = 0;
840
- s.forEach((a, c, l, d) => {
841
- i === 0 && (i = d);
842
- }), e.setSelection(D.near(e.doc.resolve(i), n));
843
- }
844
- var tt = class {
845
- constructor(e) {
846
- var t;
847
- this.find = e.find, this.handler = e.handler, this.undoable = (t = e.undoable) != null ? t : !0;
848
- }
849
- }, on = (e, t) => {
850
- if (ft(t))
851
- return t.exec(e);
852
- const n = t(e);
853
- if (!n)
854
- return null;
855
- const r = [n.text];
856
- return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
857
- };
858
- function V(e) {
859
- var t;
860
- const { editor: n, from: r, to: o, text: s, rules: i, plugin: a } = e, { view: c } = n;
861
- if (c.composing)
862
- return !1;
863
- const l = c.state.doc.resolve(r);
864
- if (
865
- // check for code node
866
- l.parent.type.spec.code || (t = l.nodeBefore || l.nodeAfter) != null && t.marks.find((p) => p.type.spec.code)
867
- )
868
- return !1;
869
- let d = !1;
870
- const u = en(l) + s;
871
- return i.forEach((p) => {
872
- if (d)
873
- return;
874
- const f = on(u, p.find);
875
- if (!f)
876
- return;
877
- const g = c.state.tr, m = X({
878
- state: c.state,
879
- transaction: g
880
- }), h = {
881
- from: r - (f[0].length - s.length),
882
- to: o
883
- }, { commands: v, chain: b, can: k } = new Y({
884
- editor: n,
885
- state: m
886
- });
887
- p.handler({
888
- state: m,
889
- range: h,
890
- match: f,
891
- commands: v,
892
- chain: b,
893
- can: k
894
- }) === null || !g.steps.length || (p.undoable && g.setMeta(a, {
895
- transform: g,
896
- from: r,
897
- to: o,
898
- text: s
899
- }), c.dispatch(g), d = !0);
900
- }), d;
901
- }
902
- function sn(e) {
903
- const { editor: t, rules: n } = e, r = new P({
904
- state: {
905
- init() {
906
- return null;
907
- },
908
- apply(o, s, i) {
909
- const a = o.getMeta(r);
910
- if (a)
911
- return a;
912
- const c = o.getMeta("applyInputRules");
913
- return !!c && setTimeout(() => {
914
- let { text: d } = c;
915
- typeof d == "string" ? d = d : d = dt(N.from(d), i.schema);
916
- const { from: u } = c, p = u + d.length;
917
- V({
918
- editor: t,
919
- from: u,
920
- to: p,
921
- text: d,
922
- rules: n,
923
- plugin: r
924
- });
925
- }), o.selectionSet || o.docChanged ? null : s;
926
- }
927
- },
928
- props: {
929
- handleTextInput(o, s, i, a) {
930
- return V({
931
- editor: t,
932
- from: s,
933
- to: i,
934
- text: a,
935
- rules: n,
936
- plugin: r
937
- });
938
- },
939
- handleDOMEvents: {
940
- compositionend: (o) => (setTimeout(() => {
941
- const { $cursor: s } = o.state.selection;
942
- s && V({
943
- editor: t,
944
- from: s.pos,
945
- to: s.pos,
946
- text: "",
947
- rules: n,
948
- plugin: r
949
- });
950
- }), !1)
951
- },
952
- // add support for input rules to trigger on enter
953
- // this is useful for example for code blocks
954
- handleKeyDown(o, s) {
955
- if (s.key !== "Enter")
956
- return !1;
957
- const { $cursor: i } = o.state.selection;
958
- return i ? V({
959
- editor: t,
960
- from: i.pos,
961
- to: i.pos,
962
- text: `
963
- `,
964
- rules: n,
965
- plugin: r
966
- }) : !1;
967
- }
968
- },
969
- // @ts-ignore
970
- isInputRules: !0
971
- });
972
- return r;
973
- }
974
- function an(e) {
975
- return Object.prototype.toString.call(e).slice(8, -1);
976
- }
977
- function H(e) {
978
- return an(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
979
- }
980
- function Lt(e, t) {
981
- const n = { ...e };
982
- return H(e) && H(t) && Object.keys(t).forEach((r) => {
983
- H(t[r]) && H(e[r]) ? n[r] = Lt(e[r], t[r]) : n[r] = t[r];
984
- }), n;
985
- }
986
- var ht = class {
987
- constructor(e = {}) {
988
- this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
989
- name: this.name
990
- }, this.config = {
991
- ...this.config,
992
- ...e
993
- }, this.name = this.config.name;
994
- }
995
- get options() {
996
- return {
997
- ...w(
998
- y(this, "addOptions", {
999
- name: this.name
1000
- })
1001
- ) || {}
1002
- };
1003
- }
1004
- get storage() {
1005
- return {
1006
- ...w(
1007
- y(this, "addStorage", {
1008
- name: this.name,
1009
- options: this.options
1010
- })
1011
- ) || {}
1012
- };
1013
- }
1014
- configure(e = {}) {
1015
- const t = this.extend({
1016
- ...this.config,
1017
- addOptions: () => Lt(this.options, e)
1018
- });
1019
- return t.name = this.name, t.parent = this.parent, t;
1020
- }
1021
- extend(e = {}) {
1022
- const t = new this.constructor({ ...this.config, ...e });
1023
- return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
1024
- }
1025
- }, cn = class zt extends ht {
1026
- constructor() {
1027
- super(...arguments), this.type = "mark";
1028
- }
1029
- /**
1030
- * Create a new Mark instance
1031
- * @param config - Mark configuration object or a function that returns a configuration object
1032
- */
1033
- static create(t = {}) {
1034
- const n = typeof t == "function" ? t() : t;
1035
- return new zt(n);
1036
- }
1037
- static handleExit({ editor: t, mark: n }) {
1038
- const { tr: r } = t.state, o = t.state.selection.$from;
1039
- if (o.pos === o.end()) {
1040
- const i = o.marks();
1041
- if (!!!i.find((l) => l?.type.name === n.name))
1042
- return !1;
1043
- const c = i.find((l) => l?.type.name === n.name);
1044
- return c && r.removeStoredMark(c), r.insertText(" ", o.pos), t.view.dispatch(r), !0;
1045
- }
1046
- return !1;
1047
- }
1048
- configure(t) {
1049
- return super.configure(t);
1050
- }
1051
- extend(t) {
1052
- const n = typeof t == "function" ? t() : t;
1053
- return super.extend(n);
1054
- }
1055
- };
1056
- function ln(e) {
1057
- return typeof e == "number";
1058
- }
1059
- var dn = class {
1060
- constructor(e) {
1061
- this.find = e.find, this.handler = e.handler;
1062
- }
1063
- }, un = (e, t, n) => {
1064
- if (ft(t))
1065
- return [...e.matchAll(t)];
1066
- const r = t(e, n);
1067
- return r ? r.map((o) => {
1068
- const s = [o.text];
1069
- return s.index = o.index, s.input = e, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), s.push(o.replaceWith)), s;
1070
- }) : [];
1071
- };
1072
- function fn(e) {
1073
- const { editor: t, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: d } = new Y({
1074
- editor: t,
1075
- state: n
1076
- }), u = [];
1077
- return n.doc.nodesBetween(r, o, (f, g) => {
1078
- var m, h, v, b, k;
1079
- if ((h = (m = f.type) == null ? void 0 : m.spec) != null && h.code || !(f.isText || f.isTextblock || f.isInline))
1080
- return;
1081
- const S = (k = (b = (v = f.content) == null ? void 0 : v.size) != null ? b : f.nodeSize) != null ? k : 0, M = Math.max(r, g), x = Math.min(o, g + S);
1082
- if (M >= x)
1083
- return;
1084
- const T = f.isText ? f.text || "" : f.textBetween(M - g, x - g, void 0, "");
1085
- un(T, s.find, i).forEach((j) => {
1086
- if (j.index === void 0)
1087
- return;
1088
- const vt = M + j.index + 1, ne = vt + j[0].length, re = {
1089
- from: n.tr.mapping.map(vt),
1090
- to: n.tr.mapping.map(ne)
1091
- }, oe = s.handler({
1092
- state: n,
1093
- range: re,
1094
- match: j,
1095
- commands: c,
1096
- chain: l,
1097
- can: d,
1098
- pasteEvent: i,
1099
- dropEvent: a
1100
- });
1101
- u.push(oe);
1102
- });
1103
- }), u.every((f) => f !== null);
1104
- }
1105
- var W = null, pn = (e) => {
1106
- var t;
1107
- const n = new ClipboardEvent("paste", {
1108
- clipboardData: new DataTransfer()
1109
- });
1110
- return (t = n.clipboardData) == null || t.setData("text/html", e), n;
1111
- };
1112
- function mn(e) {
1113
- const { editor: t, rules: n } = e;
1114
- let r = null, o = !1, s = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
1115
- try {
1116
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1117
- } catch {
1118
- a = null;
1119
- }
1120
- const c = ({
1121
- state: d,
1122
- from: u,
1123
- to: p,
1124
- rule: f,
1125
- pasteEvt: g
1126
- }) => {
1127
- const m = d.tr, h = X({
1128
- state: d,
1129
- transaction: m
1130
- });
1131
- if (!(!fn({
1132
- editor: t,
1133
- state: h,
1134
- from: Math.max(u - 1, 0),
1135
- to: p.b - 1,
1136
- rule: f,
1137
- pasteEvent: g,
1138
- dropEvent: a
1139
- }) || !m.steps.length)) {
1140
- try {
1141
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1142
- } catch {
1143
- a = null;
1144
- }
1145
- return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, m;
1146
- }
1147
- };
1148
- return n.map((d) => new P({
1149
- // we register a global drag handler to track the current drag source element
1150
- view(u) {
1151
- const p = (g) => {
1152
- var m;
1153
- r = (m = u.dom.parentElement) != null && m.contains(g.target) ? u.dom.parentElement : null, r && (W = t);
1154
- }, f = () => {
1155
- W && (W = null);
1156
- };
1157
- return window.addEventListener("dragstart", p), window.addEventListener("dragend", f), {
1158
- destroy() {
1159
- window.removeEventListener("dragstart", p), window.removeEventListener("dragend", f);
1160
- }
1161
- };
1162
- },
1163
- props: {
1164
- handleDOMEvents: {
1165
- drop: (u, p) => {
1166
- if (s = r === u.dom.parentElement, a = p, !s) {
1167
- const f = W;
1168
- f?.isEditable && setTimeout(() => {
1169
- const g = f.state.selection;
1170
- g && f.commands.deleteRange({ from: g.from, to: g.to });
1171
- }, 10);
1172
- }
1173
- return !1;
1174
- },
1175
- paste: (u, p) => {
1176
- var f;
1177
- const g = (f = p.clipboardData) == null ? void 0 : f.getData("text/html");
1178
- return i = p, o = !!g?.includes("data-pm-slice"), !1;
1179
- }
1180
- }
1181
- },
1182
- appendTransaction: (u, p, f) => {
1183
- const g = u[0], m = g.getMeta("uiEvent") === "paste" && !o, h = g.getMeta("uiEvent") === "drop" && !s, v = g.getMeta("applyPasteRules"), b = !!v;
1184
- if (!m && !h && !b)
1185
- return;
1186
- if (b) {
1187
- let { text: M } = v;
1188
- typeof M == "string" ? M = M : M = dt(N.from(M), f.schema);
1189
- const { from: x } = v, T = x + M.length, C = pn(M);
1190
- return c({
1191
- rule: d,
1192
- state: f,
1193
- from: x,
1194
- to: { b: T },
1195
- pasteEvt: C
1196
- });
1197
- }
1198
- const k = p.doc.content.findDiffStart(f.doc.content), S = p.doc.content.findDiffEnd(f.doc.content);
1199
- if (!(!ln(k) || !S || k === S.b))
1200
- return c({
1201
- rule: d,
1202
- state: f,
1203
- from: k,
1204
- to: S,
1205
- pasteEvt: i
1206
- });
1207
- }
1208
- }));
1209
- }
1210
- var et = class {
1211
- constructor(e, t) {
1212
- this.splittableMarks = [], this.editor = t, this.extensions = Nt(e), this.schema = Ke(this.extensions, t), this.setupExtensions();
1213
- }
1214
- /**
1215
- * Get all commands from the extensions.
1216
- * @returns An object with all commands where the key is the command name and the value is the command function
1217
- */
1218
- get commands() {
1219
- return this.extensions.reduce((e, t) => {
1220
- const n = {
1221
- name: t.name,
1222
- options: t.options,
1223
- storage: this.editor.extensionStorage[t.name],
1224
- editor: this.editor,
1225
- type: rt(t.name, this.schema)
1226
- }, r = y(t, "addCommands", n);
1227
- return r ? {
1228
- ...e,
1229
- ...r()
1230
- } : e;
1231
- }, {});
1232
- }
1233
- /**
1234
- * Get all registered Prosemirror plugins from the extensions.
1235
- * @returns An array of Prosemirror plugins
1236
- */
1237
- get plugins() {
1238
- const { editor: e } = this;
1239
- return ut([...this.extensions].reverse()).flatMap((r) => {
1240
- const o = {
1241
- name: r.name,
1242
- options: r.options,
1243
- storage: this.editor.extensionStorage[r.name],
1244
- editor: e,
1245
- type: rt(r.name, this.schema)
1246
- }, s = [], i = y(
1247
- r,
1248
- "addKeyboardShortcuts",
1249
- o
1250
- );
1251
- let a = {};
1252
- if (r.type === "mark" && y(r, "exitable", o) && (a.ArrowRight = () => cn.handleExit({ editor: e, mark: r })), i) {
1253
- const p = Object.fromEntries(
1254
- Object.entries(i()).map(([f, g]) => [f, () => g({ editor: e })])
1255
- );
1256
- a = { ...a, ...p };
1257
- }
1258
- const c = ce(a);
1259
- s.push(c);
1260
- const l = y(r, "addInputRules", o);
1261
- if (Mt(r, e.options.enableInputRules) && l) {
1262
- const p = l();
1263
- if (p && p.length) {
1264
- const f = sn({
1265
- editor: e,
1266
- rules: p
1267
- }), g = Array.isArray(f) ? f : [f];
1268
- s.push(...g);
1269
- }
1270
- }
1271
- const d = y(r, "addPasteRules", o);
1272
- if (Mt(r, e.options.enablePasteRules) && d) {
1273
- const p = d();
1274
- if (p && p.length) {
1275
- const f = mn({ editor: e, rules: p });
1276
- s.push(...f);
1277
- }
1278
- }
1279
- const u = y(
1280
- r,
1281
- "addProseMirrorPlugins",
1282
- o
1283
- );
1284
- if (u) {
1285
- const p = u();
1286
- s.push(...p);
1287
- }
1288
- return s;
1289
- });
1290
- }
1291
- /**
1292
- * Get all attributes from the extensions.
1293
- * @returns An array of attributes
1294
- */
1295
- get attributes() {
1296
- return It(this.extensions);
1297
- }
1298
- /**
1299
- * Get all node views from the extensions.
1300
- * @returns An object with all node views where the key is the node name and the value is the node view function
1301
- */
1302
- get nodeViews() {
1303
- const { editor: e } = this, { nodeExtensions: t } = _(this.extensions);
1304
- return Object.fromEntries(
1305
- t.filter((n) => !!y(n, "addNodeView")).map((n) => {
1306
- const r = this.attributes.filter((a) => a.type === n.name), o = {
1307
- name: n.name,
1308
- options: n.options,
1309
- storage: this.editor.extensionStorage[n.name],
1310
- editor: e,
1311
- type: E(n.name, this.schema)
1312
- }, s = y(n, "addNodeView", o);
1313
- if (!s)
1314
- return [];
1315
- const i = (a, c, l, d, u) => {
1316
- const p = K(a, r);
1317
- return s()({
1318
- // pass-through
1319
- node: a,
1320
- view: c,
1321
- getPos: l,
1322
- decorations: d,
1323
- innerDecorations: u,
1324
- // tiptap-specific
1325
- editor: e,
1326
- extension: n,
1327
- HTMLAttributes: p
1328
- });
1329
- };
1330
- return [n.name, i];
1331
- })
1332
- );
1333
- }
1334
- get markViews() {
1335
- const { editor: e } = this, { markExtensions: t } = _(this.extensions);
1336
- return Object.fromEntries(
1337
- t.filter((n) => !!y(n, "addMarkView")).map((n) => {
1338
- const r = this.attributes.filter((a) => a.type === n.name), o = {
1339
- name: n.name,
1340
- options: n.options,
1341
- storage: this.editor.extensionStorage[n.name],
1342
- editor: e,
1343
- type: $(n.name, this.schema)
1344
- }, s = y(n, "addMarkView", o);
1345
- if (!s)
1346
- return [];
1347
- const i = (a, c, l) => {
1348
- const d = K(a, r);
1349
- return s()({
1350
- // pass-through
1351
- mark: a,
1352
- view: c,
1353
- inline: l,
1354
- // tiptap-specific
1355
- editor: e,
1356
- extension: n,
1357
- HTMLAttributes: d,
1358
- updateAttributes: (u) => {
1359
- Cr(a, e, u);
1360
- }
1361
- });
1362
- };
1363
- return [n.name, i];
1364
- })
1365
- );
1366
- }
1367
- /**
1368
- * Go through all extensions, create extension storages & setup marks
1369
- * & bind editor event listener.
1370
- */
1371
- setupExtensions() {
1372
- const e = this.extensions;
1373
- this.editor.extensionStorage = Object.fromEntries(
1374
- e.map((t) => [t.name, t.storage])
1375
- ), e.forEach((t) => {
1376
- var n;
1377
- const r = {
1378
- name: t.name,
1379
- options: t.options,
1380
- storage: this.editor.extensionStorage[t.name],
1381
- editor: this.editor,
1382
- type: rt(t.name, this.schema)
1383
- };
1384
- t.type === "mark" && ((n = w(y(t, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(t.name);
1385
- const o = y(t, "onBeforeCreate", r), s = y(t, "onCreate", r), i = y(t, "onUpdate", r), a = y(
1386
- t,
1387
- "onSelectionUpdate",
1388
- r
1389
- ), c = y(t, "onTransaction", r), l = y(t, "onFocus", r), d = y(t, "onBlur", r), u = y(t, "onDestroy", r);
1390
- o && this.editor.on("beforeCreate", o), s && this.editor.on("create", s), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), c && this.editor.on("transaction", c), l && this.editor.on("focus", l), d && this.editor.on("blur", d), u && this.editor.on("destroy", u);
1391
- });
1392
- }
1393
- };
1394
- et.resolve = Nt;
1395
- et.sort = ut;
1396
- et.flatten = lt;
1397
- var hn = {};
1398
- At(hn, {
1399
- ClipboardTextSerializer: () => Ht,
1400
- Commands: () => qt,
1401
- Delete: () => Kt,
1402
- Drop: () => Jt,
1403
- Editable: () => Gt,
1404
- FocusEvents: () => Yt,
1405
- Keymap: () => Qt,
1406
- Paste: () => Zt,
1407
- Tabindex: () => te,
1408
- focusEventsPluginKey: () => Xt
1409
- });
1410
- var I = class Vt extends ht {
1411
- constructor() {
1412
- super(...arguments), this.type = "extension";
1413
- }
1414
- /**
1415
- * Create a new Extension instance
1416
- * @param config - Extension configuration object or a function that returns a configuration object
1417
- */
1418
- static create(t = {}) {
1419
- const n = typeof t == "function" ? t() : t;
1420
- return new Vt(n);
1421
- }
1422
- configure(t) {
1423
- return super.configure(t);
1424
- }
1425
- extend(t) {
1426
- const n = typeof t == "function" ? t() : t;
1427
- return super.extend(n);
1428
- }
1429
- }, Ht = I.create({
1430
- name: "clipboardTextSerializer",
1431
- addOptions() {
1432
- return {
1433
- blockSeparator: void 0
1434
- };
1435
- },
1436
- addProseMirrorPlugins() {
1437
- return [
1438
- new P({
1439
- key: new B("clipboardTextSerializer"),
1440
- props: {
1441
- clipboardTextSerializer: () => {
1442
- const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: o } = t, { ranges: s } = o, i = Math.min(...s.map((d) => d.$from.pos)), a = Math.max(...s.map((d) => d.$to.pos)), c = Bt(n);
1443
- return Ot(r, { from: i, to: a }, {
1444
- ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
1445
- textSerializers: c
1446
- });
1447
- }
1448
- }
1449
- })
1450
- ];
1451
- }
1452
- }), Wt = {};
1453
- At(Wt, {
1454
- blur: () => gn,
1455
- clearContent: () => vn,
1456
- clearNodes: () => yn,
1457
- command: () => bn,
1458
- createParagraphNear: () => kn,
1459
- cut: () => wn,
1460
- deleteCurrentNode: () => Mn,
1461
- deleteNode: () => Sn,
1462
- deleteRange: () => En,
1463
- deleteSelection: () => xn,
1464
- enter: () => Tn,
1465
- exitCode: () => Cn,
1466
- extendMarkRange: () => An,
1467
- first: () => Pn,
1468
- focus: () => In,
1469
- forEach: () => Nn,
1470
- insertContent: () => On,
1471
- insertContentAt: () => jn,
1472
- joinBackward: () => Fn,
1473
- joinDown: () => Dn,
1474
- joinForward: () => _n,
1475
- joinItemBackward: () => Ln,
1476
- joinItemForward: () => zn,
1477
- joinTextblockBackward: () => Vn,
1478
- joinTextblockForward: () => Hn,
1479
- joinUp: () => Rn,
1480
- keyboardShortcut: () => Un,
1481
- lift: () => qn,
1482
- liftEmptyBlock: () => Kn,
1483
- liftListItem: () => Jn,
1484
- newlineInCode: () => Gn,
1485
- resetAttributes: () => Xn,
1486
- scrollIntoView: () => Yn,
1487
- selectAll: () => Qn,
1488
- selectNodeBackward: () => Zn,
1489
- selectNodeForward: () => tr,
1490
- selectParentNode: () => er,
1491
- selectTextblockEnd: () => nr,
1492
- selectTextblockStart: () => rr,
1493
- setContent: () => or,
1494
- setMark: () => ir,
1495
- setMeta: () => ar,
1496
- setNode: () => cr,
1497
- setNodeSelection: () => lr,
1498
- setTextSelection: () => dr,
1499
- sinkListItem: () => ur,
1500
- splitBlock: () => fr,
1501
- splitListItem: () => pr,
1502
- toggleList: () => mr,
1503
- toggleMark: () => hr,
1504
- toggleNode: () => gr,
1505
- toggleWrap: () => vr,
1506
- undoInputRule: () => yr,
1507
- unsetAllMarks: () => br,
1508
- unsetMark: () => kr,
1509
- updateAttributes: () => wr,
1510
- wrapIn: () => Mr,
1511
- wrapInList: () => Sr
1512
- });
1513
- var gn = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
1514
- var n;
1515
- e.isDestroyed || (t.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
1516
- }), !0), vn = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), yn = () => ({ state: e, tr: t, dispatch: n }) => {
1517
- const { selection: r } = t, { ranges: o } = r;
1518
- return n && o.forEach(({ $from: s, $to: i }) => {
1519
- e.doc.nodesBetween(s.pos, i.pos, (a, c) => {
1520
- if (a.type.isText)
1521
- return;
1522
- const { doc: l, mapping: d } = t, u = l.resolve(d.map(c)), p = l.resolve(d.map(c + a.nodeSize)), f = u.blockRange(p);
1523
- if (!f)
1524
- return;
1525
- const g = fe(f);
1526
- if (a.type.isTextblock) {
1527
- const { defaultType: m } = u.parent.contentMatchAt(u.index());
1528
- t.setNodeMarkup(f.start, m);
1529
- }
1530
- (g || g === 0) && t.lift(f, g);
1531
- });
1532
- }), !0;
1533
- }, bn = (e) => (t) => e(t), kn = () => ({ state: e, dispatch: t }) => ye(e, t), wn = (e, t) => ({ editor: n, tr: r }) => {
1534
- const { state: o } = n, s = o.doc.slice(e.from, e.to);
1535
- r.deleteRange(e.from, e.to);
1536
- const i = r.mapping.map(t);
1537
- return r.insert(i, s.content), r.setSelection(new A(r.doc.resolve(Math.max(i - 1, 0)))), !0;
1538
- }, Mn = () => ({ tr: e, dispatch: t }) => {
1539
- const { selection: n } = e, r = n.$anchor.node();
1540
- if (r.content.size > 0)
1541
- return !1;
1542
- const o = e.selection.$anchor;
1543
- for (let s = o.depth; s > 0; s -= 1)
1544
- if (o.node(s).type === r.type) {
1545
- if (t) {
1546
- const a = o.before(s), c = o.after(s);
1547
- e.delete(a, c).scrollIntoView();
1548
- }
1549
- return !0;
1550
- }
1551
- return !1;
1552
- }, Sn = (e) => ({ tr: t, state: n, dispatch: r }) => {
1553
- const o = E(e, n.schema), s = t.selection.$anchor;
1554
- for (let i = s.depth; i > 0; i -= 1)
1555
- if (s.node(i).type === o) {
1556
- if (r) {
1557
- const c = s.before(i), l = s.after(i);
1558
- t.delete(c, l).scrollIntoView();
1559
- }
1560
- return !0;
1561
- }
1562
- return !1;
1563
- }, En = (e) => ({ tr: t, dispatch: n }) => {
1564
- const { from: r, to: o } = e;
1565
- return n && t.delete(r, o), !0;
1566
- }, xn = () => ({ state: e, dispatch: t }) => be(e, t), Tn = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Cn = () => ({ state: e, dispatch: t }) => ke(e, t), An = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1567
- const s = $(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: d } = a;
1568
- if (o) {
1569
- const u = pt(c, s, t);
1570
- if (u && u.from <= l && u.to >= d) {
1571
- const p = A.create(i, u.from, u.to);
1572
- n.setSelection(p);
1573
- }
1574
- }
1575
- return !0;
1576
- }, Pn = (e) => (t) => {
1577
- const n = typeof e == "function" ? e(t) : e;
1578
- for (let r = 0; r < n.length; r += 1)
1579
- if (n[r](t))
1580
- return !0;
1581
- return !1;
1582
- };
1583
- function $n() {
1584
- return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
1585
- }
1586
- function gt() {
1587
- return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
1588
- navigator.userAgent.includes("Mac") && "ontouchend" in document;
1589
- }
1590
- var In = (e = null, t = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
1591
- t = {
1592
- scrollIntoView: !0,
1593
- ...t
1594
- };
1595
- const i = () => {
1596
- (gt() || $n()) && r.dom.focus(), requestAnimationFrame(() => {
1597
- n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
1598
- });
1599
- };
1600
- if (r.hasFocus() && e === null || e === !1)
1601
- return !0;
1602
- if (s && e === null && !Ft(n.state.selection))
1603
- return i(), !0;
1604
- const a = _t(o.doc, e) || n.state.selection, c = n.state.selection.eq(a);
1605
- return s && (c || o.setSelection(a), c && o.storedMarks && o.setStoredMarks(o.storedMarks), i()), !0;
1606
- }, Nn = (e, t) => (n) => e.every((r, o) => t(r, { ...n, index: o })), On = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Bn = (e) => !("type" in e), jn = (e, t, n) => ({ tr: r, dispatch: o, editor: s }) => {
1607
- var i;
1608
- if (o) {
1609
- n = {
1610
- parseOptions: s.options.parseOptions,
1611
- updateSelection: !0,
1612
- applyInputRules: !1,
1613
- applyPasteRules: !1,
1614
- ...n
1615
- };
1616
- let a;
1617
- const c = (h) => {
1618
- s.emit("contentError", {
1619
- editor: s,
1620
- error: h,
1621
- disableCollaboration: () => {
1622
- "collaboration" in s.storage && typeof s.storage.collaboration == "object" && s.storage.collaboration && (s.storage.collaboration.isDisabled = !0);
1623
- }
1624
- });
1625
- }, l = {
1626
- preserveWhitespace: "full",
1627
- ...n.parseOptions
1628
- };
1629
- if (!n.errorOnInvalidContent && !s.options.enableContentCheck && s.options.emitContentError)
1630
- try {
1631
- F(t, s.schema, {
1632
- parseOptions: l,
1633
- errorOnInvalidContent: !0
1634
- });
1635
- } catch (h) {
1636
- c(h);
1637
- }
1638
- try {
1639
- a = F(t, s.schema, {
1640
- parseOptions: l,
1641
- errorOnInvalidContent: (i = n.errorOnInvalidContent) != null ? i : s.options.enableContentCheck
1642
- });
1643
- } catch (h) {
1644
- return c(h), !1;
1645
- }
1646
- let { from: d, to: u } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, p = !0, f = !0;
1647
- if ((Bn(a) ? a : [a]).forEach((h) => {
1648
- h.check(), p = p ? h.isText && h.marks.length === 0 : !1, f = f ? h.isBlock : !1;
1649
- }), d === u && f) {
1650
- const { parent: h } = r.doc.resolve(d);
1651
- h.isTextblock && !h.type.spec.code && !h.childCount && (d -= 1, u += 1);
1652
- }
1653
- let m;
1654
- if (p) {
1655
- if (Array.isArray(t))
1656
- m = t.map((h) => h.text || "").join("");
1657
- else if (t instanceof N) {
1658
- let h = "";
1659
- t.forEach((v) => {
1660
- v.text && (h += v.text);
1661
- }), m = h;
1662
- } else typeof t == "object" && t && t.text ? m = t.text : m = t;
1663
- r.insertText(m, d, u);
1664
- } else {
1665
- m = a;
1666
- const h = r.doc.resolve(d), v = h.node(), b = h.parentOffset === 0, k = v.isText || v.isTextblock, S = v.content.size > 0;
1667
- b && k && S && (d = Math.max(0, d - 1)), r.replaceWith(d, u, m);
1668
- }
1669
- n.updateSelection && rn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: d, text: m }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: d, text: m });
1670
- }
1671
- return !0;
1672
- }, Rn = () => ({ state: e, dispatch: t }) => we(e, t), Dn = () => ({ state: e, dispatch: t }) => Me(e, t), Fn = () => ({ state: e, dispatch: t }) => Se(e, t), _n = () => ({ state: e, dispatch: t }) => Ee(e, t), Ln = () => ({ state: e, dispatch: t, tr: n }) => {
1673
- try {
1674
- const r = Tt(e.doc, e.selection.$from.pos, -1);
1675
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
1676
- } catch {
1677
- return !1;
1678
- }
1679
- }, zn = () => ({ state: e, dispatch: t, tr: n }) => {
1680
- try {
1681
- const r = Tt(e.doc, e.selection.$from.pos, 1);
1682
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
1683
- } catch {
1684
- return !1;
1685
- }
1686
- }, Vn = () => ({ state: e, dispatch: t }) => xe(e, t), Hn = () => ({ state: e, dispatch: t }) => Te(e, t);
1687
- function Ut() {
1688
- return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
1689
- }
1690
- function Wn(e) {
1691
- const t = e.split(/-(?!$)/);
1692
- let n = t[t.length - 1];
1693
- n === "Space" && (n = " ");
1694
- let r, o, s, i;
1695
- for (let a = 0; a < t.length - 1; a += 1) {
1696
- const c = t[a];
1697
- if (/^(cmd|meta|m)$/i.test(c))
1698
- i = !0;
1699
- else if (/^a(lt)?$/i.test(c))
1700
- r = !0;
1701
- else if (/^(c|ctrl|control)$/i.test(c))
1702
- o = !0;
1703
- else if (/^s(hift)?$/i.test(c))
1704
- s = !0;
1705
- else if (/^mod$/i.test(c))
1706
- gt() || Ut() ? i = !0 : o = !0;
1707
- else
1708
- throw new Error(`Unrecognized modifier name: ${c}`);
1709
- }
1710
- return r && (n = `Alt-${n}`), o && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), s && (n = `Shift-${n}`), n;
1711
- }
1712
- var Un = (e) => ({ editor: t, view: n, tr: r, dispatch: o }) => {
1713
- const s = Wn(e).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
1714
- key: i === "Space" ? " " : i,
1715
- altKey: s.includes("Alt"),
1716
- ctrlKey: s.includes("Ctrl"),
1717
- metaKey: s.includes("Meta"),
1718
- shiftKey: s.includes("Shift"),
1719
- bubbles: !0,
1720
- cancelable: !0
1721
- }), c = t.captureTransaction(() => {
1722
- n.someProp("handleKeyDown", (l) => l(n, a));
1723
- });
1724
- return c?.steps.forEach((l) => {
1725
- const d = l.map(r.mapping);
1726
- d && o && r.maybeStep(d);
1727
- }), !0;
1728
- }, qn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1729
- const o = E(e, n.schema);
1730
- return L(n, o, t) ? Ce(n, r) : !1;
1731
- }, Kn = () => ({ state: e, dispatch: t }) => Ae(e, t), Jn = (e) => ({ state: t, dispatch: n }) => {
1732
- const r = E(e, t.schema);
1733
- return Re(r)(t, n);
1734
- }, Gn = () => ({ state: e, dispatch: t }) => Pe(e, t);
1735
- function Et(e, t) {
1736
- const n = typeof t == "string" ? [t] : t;
1737
- return Object.keys(e).reduce((r, o) => (n.includes(o) || (r[o] = e[o]), r), {});
1738
- }
1739
- var Xn = (e, t) => ({ tr: n, state: r, dispatch: o }) => {
1740
- let s = null, i = null;
1741
- const a = Z(
1742
- typeof e == "string" ? e : e.name,
1743
- r.schema
1744
- );
1745
- return a ? (a === "node" && (s = E(e, r.schema)), a === "mark" && (i = $(e, r.schema)), o && n.selection.ranges.forEach((c) => {
1746
- r.doc.nodesBetween(c.$from.pos, c.$to.pos, (l, d) => {
1747
- s && s === l.type && n.setNodeMarkup(d, void 0, Et(l.attrs, t)), i && l.marks.length && l.marks.forEach((u) => {
1748
- i === u.type && n.addMark(d, d + l.nodeSize, i.create(Et(u.attrs, t)));
1749
- });
1750
- });
1751
- }), !0) : !1;
1752
- }, Yn = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Qn = () => ({ tr: e, dispatch: t }) => {
1753
- if (t) {
1754
- const n = new ie(e.doc);
1755
- e.setSelection(n);
1756
- }
1757
- return !0;
1758
- }, Zn = () => ({ state: e, dispatch: t }) => $e(e, t), tr = () => ({ state: e, dispatch: t }) => Ie(e, t), er = () => ({ state: e, dispatch: t }) => Ne(e, t), nr = () => ({ state: e, dispatch: t }) => Oe(e, t), rr = () => ({ state: e, dispatch: t }) => Be(e, t), or = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: a }) => {
1759
- const { doc: c } = s;
1760
- if (r.preserveWhitespace !== "full") {
1761
- const l = it(e, o.schema, r, {
1762
- errorOnInvalidContent: t ?? o.options.enableContentCheck
1763
- });
1764
- return i && s.replaceWith(0, c.content.size, l).setMeta("preventUpdate", !n), !0;
1765
- }
1766
- return i && s.setMeta("preventUpdate", !n), a.insertContentAt({ from: 0, to: c.content.size }, e, {
1767
- parseOptions: r,
1768
- errorOnInvalidContent: t ?? o.options.enableContentCheck
1769
- });
1770
- };
1771
- function sr(e, t, n) {
1772
- var r;
1773
- const { selection: o } = t;
1774
- let s = null;
1775
- if (Ft(o) && (s = o.$cursor), s) {
1776
- const a = (r = e.storedMarks) != null ? r : s.marks();
1777
- return s.parent.type.allowsMarkType(n) && (!!n.isInSet(a) || !a.some((l) => l.type.excludes(n)));
1778
- }
1779
- const { ranges: i } = o;
1780
- return i.some(({ $from: a, $to: c }) => {
1781
- let l = a.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
1782
- return e.doc.nodesBetween(a.pos, c.pos, (d, u, p) => {
1783
- if (l)
1784
- return !1;
1785
- if (d.isInline) {
1786
- const f = !p || p.type.allowsMarkType(n), g = !!n.isInSet(d.marks) || !d.marks.some((m) => m.type.excludes(n));
1787
- l = f && g;
1788
- }
1789
- return !l;
1790
- }), l;
1791
- });
1792
- }
1793
- var ir = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1794
- const { selection: s } = n, { empty: i, ranges: a } = s, c = $(e, r.schema);
1795
- if (o)
1796
- if (i) {
1797
- const l = jt(r, c);
1798
- n.addStoredMark(
1799
- c.create({
1800
- ...l,
1801
- ...t
1802
- })
1803
- );
1804
- } else
1805
- a.forEach((l) => {
1806
- const d = l.$from.pos, u = l.$to.pos;
1807
- r.doc.nodesBetween(d, u, (p, f) => {
1808
- const g = Math.max(f, d), m = Math.min(f + p.nodeSize, u);
1809
- p.marks.find((v) => v.type === c) ? p.marks.forEach((v) => {
1810
- c === v.type && n.addMark(
1811
- g,
1812
- m,
1813
- c.create({
1814
- ...v.attrs,
1815
- ...t
1816
- })
1817
- );
1818
- }) : n.addMark(g, m, c.create(t));
1819
- });
1820
- });
1821
- return sr(r, n, c);
1822
- }, ar = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), cr = (e, t = {}) => ({ state: n, dispatch: r, chain: o }) => {
1823
- const s = E(e, n.schema);
1824
- let i;
1825
- return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: a }) => yt(s, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => yt(s, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1826
- }, lr = (e) => ({ tr: t, dispatch: n }) => {
1827
- if (n) {
1828
- const { doc: r } = t, o = O(e, 0, r.content.size), s = G.create(r, o);
1829
- t.setSelection(s);
1830
- }
1831
- return !0;
1832
- }, dr = (e) => ({ tr: t, dispatch: n }) => {
1833
- if (n) {
1834
- const { doc: r } = t, { from: o, to: s } = typeof e == "number" ? { from: e, to: e } : e, i = A.atStart(r).from, a = A.atEnd(r).to, c = O(o, i, a), l = O(s, i, a), d = A.create(r, c, l);
1835
- t.setSelection(d);
1836
- }
1837
- return !0;
1838
- }, ur = (e) => ({ state: t, dispatch: n }) => {
1839
- const r = E(e, t.schema);
1840
- return De(r)(t, n);
1841
- };
1842
- function xt(e, t) {
1843
- const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1844
- if (n) {
1845
- const r = n.filter((o) => t?.includes(o.type.name));
1846
- e.tr.ensureMarks(r);
1847
- }
1848
- }
1849
- var fr = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: o }) => {
1850
- const { selection: s, doc: i } = t, { $from: a, $to: c } = s, l = o.extensionManager.attributes, d = q(l, a.node().type.name, a.node().attrs);
1851
- if (s instanceof G && s.node.isBlock)
1852
- return !a.parentOffset || !U(i, a.pos) ? !1 : (r && (e && xt(n, o.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
1853
- if (!a.parent.isBlock)
1854
- return !1;
1855
- const u = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : Ve(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1856
- let f = u && p ? [
1857
- {
1858
- type: p,
1859
- attrs: d
1860
- }
1861
- ] : void 0, g = U(t.doc, t.mapping.map(a.pos), 1, f);
1862
- if (!f && !g && U(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (g = !0, f = p ? [
1863
- {
1864
- type: p,
1865
- attrs: d
1866
- }
1867
- ] : void 0), r) {
1868
- if (g && (s instanceof A && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, f), p && !u && !a.parentOffset && a.parent.type !== p)) {
1869
- const m = t.mapping.map(a.before()), h = t.doc.resolve(m);
1870
- a.node(-1).canReplaceWith(h.index(), h.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1871
- }
1872
- e && xt(n, o.extensionManager.splittableMarks), t.scrollIntoView();
1873
- }
1874
- return g;
1875
- }, pr = (e, t = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
1876
- var i;
1877
- const a = E(e, r.schema), { $from: c, $to: l } = r.selection, d = r.selection.node;
1878
- if (d && d.isBlock || c.depth < 2 || !c.sameParent(l))
1879
- return !1;
1880
- const u = c.node(-1);
1881
- if (u.type !== a)
1882
- return !1;
1883
- const p = s.extensionManager.attributes;
1884
- if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1885
- if (c.depth === 2 || c.node(-3).type !== a || c.index(-2) !== c.node(-2).childCount - 1)
1886
- return !1;
1887
- if (o) {
1888
- let v = N.empty;
1889
- const b = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1890
- for (let C = c.depth - b; C >= c.depth - 3; C -= 1)
1891
- v = N.from(c.node(C).copy(v));
1892
- const k = (
1893
- // eslint-disable-next-line no-nested-ternary
1894
- c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3
1895
- ), S = {
1896
- ...q(p, c.node().type.name, c.node().attrs),
1897
- ...t
1898
- }, M = ((i = a.contentMatch.defaultType) == null ? void 0 : i.createAndFill(S)) || void 0;
1899
- v = v.append(N.from(a.createAndFill(null, M) || void 0));
1900
- const x = c.before(c.depth - (b - 1));
1901
- n.replace(x, c.after(-k), new ve(v, 4 - b, 0));
1902
- let T = -1;
1903
- n.doc.nodesBetween(x, n.doc.content.size, (C, j) => {
1904
- if (T > -1)
1905
- return !1;
1906
- C.isTextblock && C.content.size === 0 && (T = j + 1);
1907
- }), T > -1 && n.setSelection(A.near(n.doc.resolve(T))), n.scrollIntoView();
1908
- }
1909
- return !0;
1910
- }
1911
- const f = l.pos === c.end() ? u.contentMatchAt(0).defaultType : null, g = {
1912
- ...q(p, u.type.name, u.attrs),
1913
- ...t
1914
- }, m = {
1915
- ...q(p, c.node().type.name, c.node().attrs),
1916
- ...t
1917
- };
1918
- n.delete(c.pos, l.pos);
1919
- const h = f ? [
1920
- { type: a, attrs: g },
1921
- { type: f, attrs: m }
1922
- ] : [{ type: a, attrs: g }];
1923
- if (!U(n.doc, c.pos, 2))
1924
- return !1;
1925
- if (o) {
1926
- const { selection: v, storedMarks: b } = r, { splittableMarks: k } = s.extensionManager, S = b || v.$to.parentOffset && v.$from.marks();
1927
- if (n.split(c.pos, 2, h).scrollIntoView(), !S || !o)
1928
- return !0;
1929
- const M = S.filter((x) => k.includes(x.type.name));
1930
- n.ensureMarks(M);
1931
- }
1932
- return !0;
1933
- }, ot = (e, t) => {
1934
- const n = Q((i) => i.type === t)(e.selection);
1935
- if (!n)
1936
- return !0;
1937
- const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1938
- if (r === void 0)
1939
- return !0;
1940
- const o = e.doc.nodeAt(r);
1941
- return n.node.type === o?.type && ct(e.doc, n.pos) && e.join(n.pos), !0;
1942
- }, st = (e, t) => {
1943
- const n = Q((i) => i.type === t)(e.selection);
1944
- if (!n)
1945
- return !0;
1946
- const r = e.doc.resolve(n.start).after(n.depth);
1947
- if (r === void 0)
1948
- return !0;
1949
- const o = e.doc.nodeAt(r);
1950
- return n.node.type === o?.type && ct(e.doc, r) && e.join(r), !0;
1951
- }, mr = (e, t, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain: c, commands: l, can: d }) => {
1952
- const { extensions: u, splittableMarks: p } = o.extensionManager, f = E(e, i.schema), g = E(t, i.schema), { selection: m, storedMarks: h } = i, { $from: v, $to: b } = m, k = v.blockRange(b), S = h || m.$to.parentOffset && m.$from.marks();
1953
- if (!k)
1954
- return !1;
1955
- const M = Q((x) => St(x.type.name, u))(m);
1956
- if (k.depth >= 1 && M && k.depth - M.depth <= 1) {
1957
- if (M.node.type === f)
1958
- return l.liftListItem(g);
1959
- if (St(M.node.type.name, u) && f.validContent(M.node.content) && a)
1960
- return c().command(() => (s.setNodeMarkup(M.pos, f), !0)).command(() => ot(s, f)).command(() => st(s, f)).run();
1961
- }
1962
- return !n || !S || !a ? c().command(() => d().wrapInList(f, r) ? !0 : l.clearNodes()).wrapInList(f, r).command(() => ot(s, f)).command(() => st(s, f)).run() : c().command(() => {
1963
- const x = d().wrapInList(f, r), T = S.filter((C) => p.includes(C.type.name));
1964
- return s.ensureMarks(T), x ? !0 : l.clearNodes();
1965
- }).wrapInList(f, r).command(() => ot(s, f)).command(() => st(s, f)).run();
1966
- }, hr = (e, t = {}, n = {}) => ({ state: r, commands: o }) => {
1967
- const { extendEmptyMarkRange: s = !1 } = n, i = $(e, r.schema);
1968
- return at(r, i, t) ? o.unsetMark(i, { extendEmptyMarkRange: s }) : o.setMark(i, t);
1969
- }, gr = (e, t, n = {}) => ({ state: r, commands: o }) => {
1970
- const s = E(e, r.schema), i = E(t, r.schema), a = L(r, s, n);
1971
- let c;
1972
- return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? o.setNode(i, c) : o.setNode(s, { ...c, ...n });
1973
- }, vr = (e, t = {}) => ({ state: n, commands: r }) => {
1974
- const o = E(e, n.schema);
1975
- return L(n, o, t) ? r.lift(o) : r.wrapIn(o, t);
1976
- }, yr = () => ({ state: e, dispatch: t }) => {
1977
- const n = e.plugins;
1978
- for (let r = 0; r < n.length; r += 1) {
1979
- const o = n[r];
1980
- let s;
1981
- if (o.spec.isInputRules && (s = o.getState(e))) {
1982
- if (t) {
1983
- const i = e.tr, a = s.transform;
1984
- for (let c = a.steps.length - 1; c >= 0; c -= 1)
1985
- i.step(a.steps[c].invert(a.docs[c]));
1986
- if (s.text) {
1987
- const c = i.doc.resolve(s.from).marks();
1988
- i.replaceWith(s.from, s.to, e.schema.text(s.text, c));
1989
- } else
1990
- i.delete(s.from, s.to);
1991
- }
1992
- return !0;
1993
- }
1994
- }
1995
- return !1;
1996
- }, br = () => ({ tr: e, dispatch: t }) => {
1997
- const { selection: n } = e, { empty: r, ranges: o } = n;
1998
- return r || t && o.forEach((s) => {
1999
- e.removeMark(s.$from.pos, s.$to.pos);
2000
- }), !0;
2001
- }, kr = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
2002
- var s;
2003
- const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = $(e, r.schema), { $from: l, empty: d, ranges: u } = a;
2004
- if (!o)
2005
- return !0;
2006
- if (d && i) {
2007
- let { from: p, to: f } = a;
2008
- const g = (s = l.marks().find((h) => h.type === c)) == null ? void 0 : s.attrs, m = pt(l, c, g);
2009
- m && (p = m.from, f = m.to), n.removeMark(p, f, c);
2010
- } else
2011
- u.forEach((p) => {
2012
- n.removeMark(p.$from.pos, p.$to.pos, c);
2013
- });
2014
- return n.removeStoredMark(c), !0;
2015
- }, wr = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
2016
- let s = null, i = null;
2017
- const a = Z(
2018
- typeof e == "string" ? e : e.name,
2019
- r.schema
2020
- );
2021
- return a ? (a === "node" && (s = E(e, r.schema)), a === "mark" && (i = $(e, r.schema)), o && n.selection.ranges.forEach((c) => {
2022
- const l = c.$from.pos, d = c.$to.pos;
2023
- let u, p, f, g;
2024
- n.selection.empty ? r.doc.nodesBetween(l, d, (m, h) => {
2025
- s && s === m.type && (f = Math.max(h, l), g = Math.min(h + m.nodeSize, d), u = h, p = m);
2026
- }) : r.doc.nodesBetween(l, d, (m, h) => {
2027
- h < l && s && s === m.type && (f = Math.max(h, l), g = Math.min(h + m.nodeSize, d), u = h, p = m), h >= l && h <= d && (s && s === m.type && n.setNodeMarkup(h, void 0, {
2028
- ...m.attrs,
2029
- ...t
2030
- }), i && m.marks.length && m.marks.forEach((v) => {
2031
- if (i === v.type) {
2032
- const b = Math.max(h, l), k = Math.min(h + m.nodeSize, d);
2033
- n.addMark(
2034
- b,
2035
- k,
2036
- i.create({
2037
- ...v.attrs,
2038
- ...t
2039
- })
2040
- );
2041
- }
2042
- }));
2043
- }), p && (u !== void 0 && n.setNodeMarkup(u, void 0, {
2044
- ...p.attrs,
2045
- ...t
2046
- }), i && p.marks.length && p.marks.forEach((m) => {
2047
- i === m.type && n.addMark(
2048
- f,
2049
- g,
2050
- i.create({
2051
- ...m.attrs,
2052
- ...t
2053
- })
2054
- );
2055
- }));
2056
- }), !0) : !1;
2057
- }, Mr = (e, t = {}) => ({ state: n, dispatch: r }) => {
2058
- const o = E(e, n.schema);
2059
- return je(o, t)(n, r);
2060
- }, Sr = (e, t = {}) => ({ state: n, dispatch: r }) => {
2061
- const o = E(e, n.schema);
2062
- return Fe(o, t)(n, r);
2063
- }, qt = I.create({
2064
- name: "commands",
2065
- addCommands() {
2066
- return {
2067
- ...Wt
2068
- };
2069
- }
2070
- }), Kt = I.create({
2071
- name: "delete",
2072
- onUpdate({ transaction: e, appendedTransactions: t }) {
2073
- var n, r, o;
2074
- const s = () => {
2075
- var i, a, c, l;
2076
- if ((l = (c = (a = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : a.filterTransaction) == null ? void 0 : c.call(a, e)) != null ? l : e.getMeta("y-sync$"))
2077
- return;
2078
- const d = ze(e.before, [e, ...t]);
2079
- tn(d).forEach((f) => {
2080
- d.mapping.mapResult(f.oldRange.from).deletedAfter && d.mapping.mapResult(f.oldRange.to).deletedBefore && d.before.nodesBetween(f.oldRange.from, f.oldRange.to, (g, m) => {
2081
- const h = m + g.nodeSize - 2, v = f.oldRange.from <= m && h <= f.oldRange.to;
2082
- this.editor.emit("delete", {
2083
- type: "node",
2084
- node: g,
2085
- from: m,
2086
- to: h,
2087
- newFrom: d.mapping.map(m),
2088
- newTo: d.mapping.map(h),
2089
- deletedRange: f.oldRange,
2090
- newRange: f.newRange,
2091
- partial: !v,
2092
- editor: this.editor,
2093
- transaction: e,
2094
- combinedTransform: d
2095
- });
2096
- });
2097
- });
2098
- const p = d.mapping;
2099
- d.steps.forEach((f, g) => {
2100
- var m, h;
2101
- if (f instanceof ue) {
2102
- const v = p.slice(g).map(f.from, -1), b = p.slice(g).map(f.to), k = p.invert().map(v, -1), S = p.invert().map(b), M = (m = d.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((T) => T.eq(f.mark)), x = (h = d.doc.nodeAt(b)) == null ? void 0 : h.marks.some((T) => T.eq(f.mark));
2103
- this.editor.emit("delete", {
2104
- type: "mark",
2105
- mark: f.mark,
2106
- from: f.from,
2107
- to: f.to,
2108
- deletedRange: {
2109
- from: k,
2110
- to: S
2111
- },
2112
- newRange: {
2113
- from: v,
2114
- to: b
2115
- },
2116
- partial: !!(x || M),
2117
- editor: this.editor,
2118
- transaction: e,
2119
- combinedTransform: d
2120
- });
2121
- }
2122
- });
2123
- };
2124
- (o = (r = (n = this.editor.options.coreExtensionOptions) == null ? void 0 : n.delete) == null ? void 0 : r.async) == null || o ? setTimeout(s, 0) : s();
2125
- }
2126
- }), Jt = I.create({
2127
- name: "drop",
2128
- addProseMirrorPlugins() {
2129
- return [
2130
- new P({
2131
- key: new B("tiptapDrop"),
2132
- props: {
2133
- handleDrop: (e, t, n, r) => {
2134
- this.editor.emit("drop", {
2135
- editor: this.editor,
2136
- event: t,
2137
- slice: n,
2138
- moved: r
2139
- });
2140
- }
2141
- }
2142
- })
2143
- ];
2144
- }
2145
- }), Gt = I.create({
2146
- name: "editable",
2147
- addProseMirrorPlugins() {
2148
- return [
2149
- new P({
2150
- key: new B("editable"),
2151
- props: {
2152
- editable: () => this.editor.options.editable
2153
- }
2154
- })
2155
- ];
2156
- }
2157
- }), Xt = new B("focusEvents"), Yt = I.create({
2158
- name: "focusEvents",
2159
- addProseMirrorPlugins() {
2160
- const { editor: e } = this;
2161
- return [
2162
- new P({
2163
- key: Xt,
2164
- props: {
2165
- handleDOMEvents: {
2166
- focus: (t, n) => {
2167
- e.isFocused = !0;
2168
- const r = e.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2169
- return t.dispatch(r), !1;
2170
- },
2171
- blur: (t, n) => {
2172
- e.isFocused = !1;
2173
- const r = e.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2174
- return t.dispatch(r), !1;
2175
- }
2176
- }
2177
- }
2178
- })
2179
- ];
2180
- }
2181
- }), Qt = I.create({
2182
- name: "keymap",
2183
- addKeyboardShortcuts() {
2184
- const e = () => this.editor.commands.first(({ commands: i }) => [
2185
- () => i.undoInputRule(),
2186
- // maybe convert first text block node to default node
2187
- () => i.command(({ tr: a }) => {
2188
- const { selection: c, doc: l } = a, { empty: d, $anchor: u } = c, { pos: p, parent: f } = u, g = u.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : u, m = g.parent.type.spec.isolating, h = u.pos - u.parentOffset, v = m && g.parent.childCount === 1 ? h === u.pos : D.atStart(l).from === p;
2189
- return !d || !f.type.isTextblock || f.textContent.length || !v || v && u.parent.type.name === "paragraph" ? !1 : i.clearNodes();
2190
- }),
2191
- () => i.deleteSelection(),
2192
- () => i.joinBackward(),
2193
- () => i.selectNodeBackward()
2194
- ]), t = () => this.editor.commands.first(({ commands: i }) => [
2195
- () => i.deleteSelection(),
2196
- () => i.deleteCurrentNode(),
2197
- () => i.joinForward(),
2198
- () => i.selectNodeForward()
2199
- ]), r = {
2200
- Enter: () => this.editor.commands.first(({ commands: i }) => [
2201
- () => i.newlineInCode(),
2202
- () => i.createParagraphNear(),
2203
- () => i.liftEmptyBlock(),
2204
- () => i.splitBlock()
2205
- ]),
2206
- "Mod-Enter": () => this.editor.commands.exitCode(),
2207
- Backspace: e,
2208
- "Mod-Backspace": e,
2209
- "Shift-Backspace": e,
2210
- Delete: t,
2211
- "Mod-Delete": t,
2212
- "Mod-a": () => this.editor.commands.selectAll()
2213
- }, o = {
2214
- ...r
2215
- }, s = {
2216
- ...r,
2217
- "Ctrl-h": e,
2218
- "Alt-Backspace": e,
2219
- "Ctrl-d": t,
2220
- "Ctrl-Alt-Backspace": t,
2221
- "Alt-Delete": t,
2222
- "Alt-d": t,
2223
- "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2224
- "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2225
- };
2226
- return gt() || Ut() ? s : o;
2227
- },
2228
- addProseMirrorPlugins() {
2229
- return [
2230
- // With this plugin we check if the whole document was selected and deleted.
2231
- // In this case we will additionally call `clearNodes()` to convert e.g. a heading
2232
- // to a paragraph if necessary.
2233
- // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
2234
- // with many other commands.
2235
- new P({
2236
- key: new B("clearDocument"),
2237
- appendTransaction: (e, t, n) => {
2238
- if (e.some((m) => m.getMeta("composition")))
2239
- return;
2240
- const r = e.some((m) => m.docChanged) && !t.doc.eq(n.doc), o = e.some((m) => m.getMeta("preventClearDocument"));
2241
- if (!r || o)
2242
- return;
2243
- const { empty: s, from: i, to: a } = t.selection, c = D.atStart(t.doc).from, l = D.atEnd(t.doc).to;
2244
- if (s || !(i === c && a === l) || !mt(n.doc))
2245
- return;
2246
- const p = n.tr, f = X({
2247
- state: n,
2248
- transaction: p
2249
- }), { commands: g } = new Y({
2250
- editor: this.editor,
2251
- state: f
2252
- });
2253
- if (g.clearNodes(), !!p.steps.length)
2254
- return p;
2255
- }
2256
- })
2257
- ];
2258
- }
2259
- }), Zt = I.create({
2260
- name: "paste",
2261
- addProseMirrorPlugins() {
2262
- return [
2263
- new P({
2264
- key: new B("tiptapPaste"),
2265
- props: {
2266
- handlePaste: (e, t, n) => {
2267
- this.editor.emit("paste", {
2268
- editor: this.editor,
2269
- event: t,
2270
- slice: n
2271
- });
2272
- }
2273
- }
2274
- })
2275
- ];
2276
- }
2277
- }), te = I.create({
2278
- name: "tabindex",
2279
- addProseMirrorPlugins() {
2280
- return [
2281
- new P({
2282
- key: new B("tabindex"),
2283
- props: {
2284
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
2285
- }
2286
- })
2287
- ];
2288
- }
2289
- }), Er = class R {
2290
- constructor(t, n, r = !1, o = null) {
2291
- this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = t, this.editor = n, this.currentNode = o;
2292
- }
2293
- get name() {
2294
- return this.node.type.name;
2295
- }
2296
- get node() {
2297
- return this.currentNode || this.resolvedPos.node();
2298
- }
2299
- get element() {
2300
- return this.editor.view.domAtPos(this.pos).node;
2301
- }
2302
- get depth() {
2303
- var t;
2304
- return (t = this.actualDepth) != null ? t : this.resolvedPos.depth;
2305
- }
2306
- get pos() {
2307
- return this.resolvedPos.pos;
2308
- }
2309
- get content() {
2310
- return this.node.content;
2311
- }
2312
- set content(t) {
2313
- let n = this.from, r = this.to;
2314
- if (this.isBlock) {
2315
- if (this.content.size === 0) {
2316
- console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
2317
- return;
2318
- }
2319
- n = this.from + 1, r = this.to - 1;
2320
- }
2321
- this.editor.commands.insertContentAt({ from: n, to: r }, t);
2322
- }
2323
- get attributes() {
2324
- return this.node.attrs;
2325
- }
2326
- get textContent() {
2327
- return this.node.textContent;
2328
- }
2329
- get size() {
2330
- return this.node.nodeSize;
2331
- }
2332
- get from() {
2333
- return this.isBlock ? this.pos : this.resolvedPos.start(this.resolvedPos.depth);
2334
- }
2335
- get range() {
2336
- return {
2337
- from: this.from,
2338
- to: this.to
2339
- };
2340
- }
2341
- get to() {
2342
- return this.isBlock ? this.pos + this.size : this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
2343
- }
2344
- get parent() {
2345
- if (this.depth === 0)
2346
- return null;
2347
- const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
2348
- return new R(n, this.editor);
2349
- }
2350
- get before() {
2351
- let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2352
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new R(t, this.editor);
2353
- }
2354
- get after() {
2355
- let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2356
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new R(t, this.editor);
2357
- }
2358
- get children() {
2359
- const t = [];
2360
- return this.node.content.forEach((n, r) => {
2361
- const o = n.isBlock && !n.isTextblock, s = n.isAtom && !n.isText, i = this.pos + r + (s ? 0 : 1);
2362
- if (i < 0 || i > this.resolvedPos.doc.nodeSize - 2)
2363
- return;
2364
- const a = this.resolvedPos.doc.resolve(i);
2365
- if (!o && a.depth <= this.depth)
2366
- return;
2367
- const c = new R(a, this.editor, o, o ? n : null);
2368
- o && (c.actualDepth = this.depth + 1), t.push(new R(a, this.editor, o, o ? n : null));
2369
- }), t;
2370
- }
2371
- get firstChild() {
2372
- return this.children[0] || null;
2373
- }
2374
- get lastChild() {
2375
- const t = this.children;
2376
- return t[t.length - 1] || null;
2377
- }
2378
- closest(t, n = {}) {
2379
- let r = null, o = this.parent;
2380
- for (; o && !r; ) {
2381
- if (o.node.type.name === t)
2382
- if (Object.keys(n).length > 0) {
2383
- const s = o.node.attrs, i = Object.keys(n);
2384
- for (let a = 0; a < i.length; a += 1) {
2385
- const c = i[a];
2386
- if (s[c] !== n[c])
2387
- break;
2388
- }
2389
- } else
2390
- r = o;
2391
- o = o.parent;
2392
- }
2393
- return r;
2394
- }
2395
- querySelector(t, n = {}) {
2396
- return this.querySelectorAll(t, n, !0)[0] || null;
2397
- }
2398
- querySelectorAll(t, n = {}, r = !1) {
2399
- let o = [];
2400
- if (!this.children || this.children.length === 0)
2401
- return o;
2402
- const s = Object.keys(n);
2403
- return this.children.forEach((i) => {
2404
- r && o.length > 0 || (i.node.type.name === t && s.every((c) => n[c] === i.node.attrs[c]) && o.push(i), !(r && o.length > 0) && (o = o.concat(i.querySelectorAll(t, n, r))));
2405
- }), o;
2406
- }
2407
- setAttribute(t) {
2408
- const { tr: n } = this.editor.state;
2409
- n.setNodeMarkup(this.from, void 0, {
2410
- ...this.node.attrs,
2411
- ...t
2412
- }), this.editor.view.dispatch(n);
2413
- }
2414
- }, xr = `.ProseMirror {
2415
- position: relative;
2416
- }
2417
-
2418
- .ProseMirror {
2419
- word-wrap: break-word;
2420
- white-space: pre-wrap;
2421
- white-space: break-spaces;
2422
- -webkit-font-variant-ligatures: none;
2423
- font-variant-ligatures: none;
2424
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
2425
- }
2426
-
2427
- .ProseMirror [contenteditable="false"] {
2428
- white-space: normal;
2429
- }
2430
-
2431
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
2432
- white-space: pre-wrap;
2433
- }
2434
-
2435
- .ProseMirror pre {
2436
- white-space: pre-wrap;
2437
- }
2438
-
2439
- img.ProseMirror-separator {
2440
- display: inline !important;
2441
- border: none !important;
2442
- margin: 0 !important;
2443
- width: 0 !important;
2444
- height: 0 !important;
2445
- }
2446
-
2447
- .ProseMirror-gapcursor {
2448
- display: none;
2449
- pointer-events: none;
2450
- position: absolute;
2451
- margin: 0;
2452
- }
2453
-
2454
- .ProseMirror-gapcursor:after {
2455
- content: "";
2456
- display: block;
2457
- position: absolute;
2458
- top: -2px;
2459
- width: 20px;
2460
- border-top: 1px solid black;
2461
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
2462
- }
2463
-
2464
- @keyframes ProseMirror-cursor-blink {
2465
- to {
2466
- visibility: hidden;
2467
- }
2468
- }
2469
-
2470
- .ProseMirror-hideselection *::selection {
2471
- background: transparent;
2472
- }
2473
-
2474
- .ProseMirror-hideselection *::-moz-selection {
2475
- background: transparent;
2476
- }
2477
-
2478
- .ProseMirror-hideselection * {
2479
- caret-color: transparent;
2480
- }
2481
-
2482
- .ProseMirror-focused .ProseMirror-gapcursor {
2483
- display: block;
2484
- }`;
2485
- function Tr(e, t, n) {
2486
- const r = document.querySelector("style[data-tiptap-style]");
2487
- if (r !== null)
2488
- return r;
2489
- const o = document.createElement("style");
2490
- return t && o.setAttribute("nonce", t), o.setAttribute("data-tiptap-style", ""), o.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(o), o;
2491
- }
2492
- var Lr = class extends Le {
2493
- constructor(t = {}) {
2494
- super(), this.css = null, this.editorView = null, this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.options = {
2495
- element: typeof document < "u" ? document.createElement("div") : null,
2496
- content: "",
2497
- injectCSS: !0,
2498
- injectNonce: void 0,
2499
- extensions: [],
2500
- autofocus: !1,
2501
- editable: !0,
2502
- editorProps: {},
2503
- parseOptions: {},
2504
- coreExtensionOptions: {},
2505
- enableInputRules: !0,
2506
- enablePasteRules: !0,
2507
- enableCoreExtensions: !0,
2508
- enableContentCheck: !1,
2509
- emitContentError: !1,
2510
- onBeforeCreate: () => null,
2511
- onCreate: () => null,
2512
- onMount: () => null,
2513
- onUnmount: () => null,
2514
- onUpdate: () => null,
2515
- onSelectionUpdate: () => null,
2516
- onTransaction: () => null,
2517
- onFocus: () => null,
2518
- onBlur: () => null,
2519
- onDestroy: () => null,
2520
- onContentError: ({ error: o }) => {
2521
- throw o;
2522
- },
2523
- onPaste: () => null,
2524
- onDrop: () => null,
2525
- onDelete: () => null
2526
- }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: o, slice: s, moved: i }) => this.options.onDrop(o, s, i)), this.on("paste", ({ event: o, slice: s }) => this.options.onPaste(o, s)), this.on("delete", this.options.onDelete);
2527
- const n = this.createDoc(), r = _t(n, this.options.autofocus);
2528
- this.editorState = se.create({
2529
- doc: n,
2530
- schema: this.schema,
2531
- selection: r || void 0
2532
- }), this.options.element && this.mount(this.options.element);
2533
- }
2534
- /**
2535
- * Attach the editor to the DOM, creating a new editor view.
2536
- */
2537
- mount(t) {
2538
- if (typeof document > "u")
2539
- throw new Error(
2540
- "[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment."
2541
- );
2542
- this.createView(t), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
2543
- this.isDestroyed || (this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
2544
- }, 0);
2545
- }
2546
- /**
2547
- * Remove the editor from the DOM, but still allow remounting at a different point in time
2548
- */
2549
- unmount() {
2550
- if (this.editorView) {
2551
- const t = this.editorView.dom;
2552
- t?.editor && delete t.editor, this.editorView.destroy();
2553
- }
2554
- if (this.editorView = null, this.isInitialized = !1, this.css)
2555
- try {
2556
- typeof this.css.remove == "function" ? this.css.remove() : this.css.parentNode && this.css.parentNode.removeChild(this.css);
2557
- } catch (t) {
2558
- console.warn("Failed to remove CSS element:", t);
2559
- }
2560
- this.css = null, this.emit("unmount", { editor: this });
2561
- }
2562
- /**
2563
- * Returns the editor storage.
2564
- */
2565
- get storage() {
2566
- return this.extensionStorage;
2567
- }
2568
- /**
2569
- * An object of all registered commands.
2570
- */
2571
- get commands() {
2572
- return this.commandManager.commands;
2573
- }
2574
- /**
2575
- * Create a command chain to call multiple commands at once.
2576
- */
2577
- chain() {
2578
- return this.commandManager.chain();
2579
- }
2580
- /**
2581
- * Check if a command or a command chain can be executed. Without executing it.
2582
- */
2583
- can() {
2584
- return this.commandManager.can();
2585
- }
2586
- /**
2587
- * Inject CSS styles.
2588
- */
2589
- injectCSS() {
2590
- this.options.injectCSS && typeof document < "u" && (this.css = Tr(xr, this.options.injectNonce));
2591
- }
2592
- /**
2593
- * Update editor options.
2594
- *
2595
- * @param options A list of options
2596
- */
2597
- setOptions(t = {}) {
2598
- this.options = {
2599
- ...this.options,
2600
- ...t
2601
- }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
2602
- }
2603
- /**
2604
- * Update editable state of the editor.
2605
- */
2606
- setEditable(t, n = !0) {
2607
- this.setOptions({ editable: t }), n && this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
2608
- }
2609
- /**
2610
- * Returns whether the editor is editable.
2611
- */
2612
- get isEditable() {
2613
- return this.options.editable && this.view && this.view.editable;
2614
- }
2615
- /**
2616
- * Returns the editor state.
2617
- */
2618
- get view() {
2619
- return this.editorView ? this.editorView : new Proxy(
2620
- {
2621
- state: this.editorState,
2622
- updateState: (t) => {
2623
- this.editorState = t;
2624
- },
2625
- dispatch: (t) => {
2626
- this.editorState = this.state.apply(t);
2627
- },
2628
- // Stub some commonly accessed properties to prevent errors
2629
- composing: !1,
2630
- dragging: null,
2631
- editable: !0,
2632
- isDestroyed: !1
2633
- },
2634
- {
2635
- get: (t, n) => {
2636
- if (n === "state")
2637
- return this.editorState;
2638
- if (n in t)
2639
- return Reflect.get(t, n);
2640
- throw new Error(
2641
- `[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`
2642
- );
2643
- }
2644
- }
2645
- );
2646
- }
2647
- /**
2648
- * Returns the editor state.
2649
- */
2650
- get state() {
2651
- return this.editorView && (this.editorState = this.view.state), this.editorState;
2652
- }
2653
- /**
2654
- * Register a ProseMirror plugin.
2655
- *
2656
- * @param plugin A ProseMirror plugin
2657
- * @param handlePlugins Control how to merge the plugin into the existing plugins.
2658
- * @returns The new editor state
2659
- */
2660
- registerPlugin(t, n) {
2661
- const r = $t(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], o = this.state.reconfigure({ plugins: r });
2662
- return this.view.updateState(o), o;
2663
- }
2664
- /**
2665
- * Unregister a ProseMirror plugin.
2666
- *
2667
- * @param nameOrPluginKeyToRemove The plugins name
2668
- * @returns The new editor state or undefined if the editor is destroyed
2669
- */
2670
- unregisterPlugin(t) {
2671
- if (this.isDestroyed)
2672
- return;
2673
- const n = this.state.plugins;
2674
- let r = n;
2675
- if ([].concat(t).forEach((s) => {
2676
- const i = typeof s == "string" ? `${s}$` : s.key;
2677
- r = r.filter((a) => !a.key.startsWith(i));
2678
- }), n.length === r.length)
2679
- return;
2680
- const o = this.state.reconfigure({
2681
- plugins: r
2682
- });
2683
- return this.view.updateState(o), o;
2684
- }
2685
- /**
2686
- * Creates an extension manager.
2687
- */
2688
- createExtensionManager() {
2689
- var t, n;
2690
- const o = [...this.options.enableCoreExtensions ? [
2691
- Gt,
2692
- Ht.configure({
2693
- blockSeparator: (n = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : n.blockSeparator
2694
- }),
2695
- qt,
2696
- Yt,
2697
- Qt,
2698
- te,
2699
- Jt,
2700
- Zt,
2701
- Kt
2702
- ].filter((s) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[s.name] !== !1 : !0) : [], ...this.options.extensions].filter((s) => ["extension", "node", "mark"].includes(s?.type));
2703
- this.extensionManager = new et(o, this);
2704
- }
2705
- /**
2706
- * Creates an command manager.
2707
- */
2708
- createCommandManager() {
2709
- this.commandManager = new Y({
2710
- editor: this
2711
- });
2712
- }
2713
- /**
2714
- * Creates a ProseMirror schema.
2715
- */
2716
- createSchema() {
2717
- this.schema = this.extensionManager.schema;
2718
- }
2719
- /**
2720
- * Creates the initial document.
2721
- */
2722
- createDoc() {
2723
- let t;
2724
- try {
2725
- t = it(this.options.content, this.schema, this.options.parseOptions, {
2726
- errorOnInvalidContent: this.options.enableContentCheck
2727
- });
2728
- } catch (n) {
2729
- if (!(n instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(n.message))
2730
- throw n;
2731
- this.emit("contentError", {
2732
- editor: this,
2733
- error: n,
2734
- disableCollaboration: () => {
2735
- "collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((r) => r.name !== "collaboration"), this.createExtensionManager();
2736
- }
2737
- }), t = it(this.options.content, this.schema, this.options.parseOptions, {
2738
- errorOnInvalidContent: !1
2739
- });
2740
- }
2741
- return t;
2742
- }
2743
- /**
2744
- * Creates a ProseMirror view.
2745
- */
2746
- createView(t) {
2747
- var n;
2748
- this.editorView = new ae(t, {
2749
- ...this.options.editorProps,
2750
- attributes: {
2751
- // add `role="textbox"` to the editor element
2752
- role: "textbox",
2753
- ...(n = this.options.editorProps) == null ? void 0 : n.attributes
2754
- },
2755
- dispatchTransaction: this.dispatchTransaction.bind(this),
2756
- state: this.editorState,
2757
- markViews: this.extensionManager.markViews,
2758
- nodeViews: this.extensionManager.nodeViews
2759
- });
2760
- const r = this.state.reconfigure({
2761
- plugins: this.extensionManager.plugins
2762
- });
2763
- this.view.updateState(r), this.prependClass(), this.injectCSS();
2764
- const o = this.view.dom;
2765
- o.editor = this;
2766
- }
2767
- /**
2768
- * Creates all node and mark views.
2769
- */
2770
- createNodeViews() {
2771
- this.view.isDestroyed || this.view.setProps({
2772
- markViews: this.extensionManager.markViews,
2773
- nodeViews: this.extensionManager.nodeViews
2774
- });
2775
- }
2776
- /**
2777
- * Prepend class name to element.
2778
- */
2779
- prependClass() {
2780
- this.view.dom.className = `tiptap ${this.view.dom.className}`;
2781
- }
2782
- captureTransaction(t) {
2783
- this.isCapturingTransaction = !0, t(), this.isCapturingTransaction = !1;
2784
- const n = this.capturedTransaction;
2785
- return this.capturedTransaction = null, n;
2786
- }
2787
- /**
2788
- * The callback over which to send transactions (state updates) produced by the view.
2789
- *
2790
- * @param transaction An editor state transaction
2791
- */
2792
- dispatchTransaction(t) {
2793
- if (this.view.isDestroyed)
2794
- return;
2795
- if (this.isCapturingTransaction) {
2796
- if (!this.capturedTransaction) {
2797
- this.capturedTransaction = t;
2798
- return;
2799
- }
2800
- t.steps.forEach((d) => {
2801
- var u;
2802
- return (u = this.capturedTransaction) == null ? void 0 : u.step(d);
2803
- });
2804
- return;
2805
- }
2806
- const { state: n, transactions: r } = this.state.applyTransaction(t), o = !this.state.selection.eq(n.selection), s = r.includes(t), i = this.state;
2807
- if (this.emit("beforeTransaction", {
2808
- editor: this,
2809
- transaction: t,
2810
- nextState: n
2811
- }), !s)
2812
- return;
2813
- this.view.updateState(n), this.emit("transaction", {
2814
- editor: this,
2815
- transaction: t,
2816
- appendedTransactions: r.slice(1)
2817
- }), o && this.emit("selectionUpdate", {
2818
- editor: this,
2819
- transaction: t
2820
- });
2821
- const a = r.findLast((d) => d.getMeta("focus") || d.getMeta("blur")), c = a?.getMeta("focus"), l = a?.getMeta("blur");
2822
- c && this.emit("focus", {
2823
- editor: this,
2824
- event: c.event,
2825
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2826
- transaction: a
2827
- }), l && this.emit("blur", {
2828
- editor: this,
2829
- event: l.event,
2830
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2831
- transaction: a
2832
- }), !(t.getMeta("preventUpdate") || !r.some((d) => d.docChanged) || i.doc.eq(n.doc)) && this.emit("update", {
2833
- editor: this,
2834
- transaction: t,
2835
- appendedTransactions: r.slice(1)
2836
- });
2837
- }
2838
- /**
2839
- * Get attributes of the currently selected node or mark.
2840
- */
2841
- getAttributes(t) {
2842
- return Ye(this.state, t);
2843
- }
2844
- isActive(t, n) {
2845
- const r = typeof t == "string" ? t : null, o = typeof t == "string" ? n : t;
2846
- return nn(this.state, r, o);
2847
- }
2848
- /**
2849
- * Get the document as JSON.
2850
- */
2851
- getJSON() {
2852
- return this.state.doc.toJSON();
2853
- }
2854
- /**
2855
- * Get the document as HTML.
2856
- */
2857
- getHTML() {
2858
- return dt(this.state.doc.content, this.schema);
2859
- }
2860
- /**
2861
- * Get the document as text.
2862
- */
2863
- getText(t) {
2864
- const { blockSeparator: n = `
2865
-
2866
- `, textSerializers: r = {} } = t || {};
2867
- return Ge(this.state.doc, {
2868
- blockSeparator: n,
2869
- textSerializers: {
2870
- ...Bt(this.schema),
2871
- ...r
2872
- }
2873
- });
2874
- }
2875
- /**
2876
- * Check if there is no content.
2877
- */
2878
- get isEmpty() {
2879
- return mt(this.state.doc);
2880
- }
2881
- /**
2882
- * Destroy the editor.
2883
- */
2884
- destroy() {
2885
- this.emit("destroy"), this.unmount(), this.removeAllListeners();
2886
- }
2887
- /**
2888
- * Check if the editor is already destroyed.
2889
- */
2890
- get isDestroyed() {
2891
- var t, n;
2892
- return (n = (t = this.editorView) == null ? void 0 : t.isDestroyed) != null ? n : !0;
2893
- }
2894
- $node(t, n) {
2895
- var r;
2896
- return ((r = this.$doc) == null ? void 0 : r.querySelector(t, n)) || null;
2897
- }
2898
- $nodes(t, n) {
2899
- var r;
2900
- return ((r = this.$doc) == null ? void 0 : r.querySelectorAll(t, n)) || null;
2901
- }
2902
- $pos(t) {
2903
- const n = this.state.doc.resolve(t);
2904
- return new Er(n, this);
2905
- }
2906
- get $doc() {
2907
- return this.$pos(0);
2908
- }
2909
- };
2910
- function Vr(e) {
2911
- return new tt({
2912
- find: e.find,
2913
- handler: ({ state: t, range: n, match: r }) => {
2914
- const o = w(e.getAttributes, void 0, r);
2915
- if (o === !1 || o === null)
2916
- return null;
2917
- const { tr: s } = t, i = r[r.length - 1], a = r[0];
2918
- if (i) {
2919
- const c = a.search(/\S/), l = n.from + a.indexOf(i), d = l + i.length;
2920
- if (Dt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((m) => m === e.type && m !== f.mark.type)).filter((f) => f.to > l).length)
2921
- return null;
2922
- d < n.to && s.delete(d, n.to), l > n.from && s.delete(n.from + c, l);
2923
- const p = n.from + c + i.length;
2924
- s.addMark(n.from + c, p, e.type.create(o || {})), s.removeStoredMark(e.type);
2925
- }
2926
- },
2927
- undoable: e.undoable
2928
- });
2929
- }
2930
- function Hr(e) {
2931
- return new tt({
2932
- find: e.find,
2933
- handler: ({ state: t, range: n, match: r }) => {
2934
- const o = w(e.getAttributes, void 0, r) || {}, { tr: s } = t, i = n.from;
2935
- let a = n.to;
2936
- const c = e.type.create(o);
2937
- if (r[1]) {
2938
- const l = r[0].lastIndexOf(r[1]);
2939
- let d = i + l;
2940
- d > a ? d = a : a = d + r[1].length;
2941
- const u = r[0][r[0].length - 1];
2942
- s.insertText(u, i + r[0].length - 1), s.replaceWith(d, a, c);
2943
- } else if (r[0]) {
2944
- const l = e.type.isInline ? i : i - 1;
2945
- s.insert(l, e.type.create(o)).delete(s.mapping.map(i), s.mapping.map(a));
2946
- }
2947
- s.scrollIntoView();
2948
- },
2949
- undoable: e.undoable
2950
- });
2951
- }
2952
- function Wr(e) {
2953
- return new tt({
2954
- find: e.find,
2955
- handler: ({ state: t, range: n, match: r }) => {
2956
- const o = t.doc.resolve(n.from), s = w(e.getAttributes, void 0, r) || {};
2957
- if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), e.type))
2958
- return null;
2959
- t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, s);
2960
- },
2961
- undoable: e.undoable
2962
- });
2963
- }
2964
- function Ur(e) {
2965
- return new tt({
2966
- find: e.find,
2967
- handler: ({ state: t, range: n, match: r, chain: o }) => {
2968
- const s = w(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && le(c, e.type, s);
2969
- if (!l)
2970
- return null;
2971
- if (i.wrap(c, l), e.keepMarks && e.editor) {
2972
- const { selection: u, storedMarks: p } = t, { splittableMarks: f } = e.editor.extensionManager, g = p || u.$to.parentOffset && u.$from.marks();
2973
- if (g) {
2974
- const m = g.filter((h) => f.includes(h.type.name));
2975
- i.ensureMarks(m);
2976
- }
2977
- }
2978
- if (e.keepAttributes) {
2979
- const u = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
2980
- o().updateAttributes(u, s).run();
2981
- }
2982
- const d = i.doc.resolve(n.from - 1).nodeBefore;
2983
- d && d.type === e.type && ct(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, d)) && i.join(n.from - 1);
2984
- },
2985
- undoable: e.undoable
2986
- });
2987
- }
2988
- function qr(e, t) {
2989
- const { selection: n } = e, { $from: r } = n;
2990
- if (n instanceof G) {
2991
- const s = r.index();
2992
- return r.parent.canReplaceWith(s, s + 1, t);
2993
- }
2994
- let o = r.depth;
2995
- for (; o >= 0; ) {
2996
- const s = r.index(o);
2997
- if (r.node(o).contentMatchAt(s).matchType(t))
2998
- return !0;
2999
- o -= 1;
3000
- }
3001
- return !1;
3002
- }
3003
- function Cr(e, t, n = {}) {
3004
- const { state: r } = t, { doc: o, tr: s } = r, i = e;
3005
- o.descendants((a, c) => {
3006
- const l = s.mapping.map(c), d = s.mapping.map(c) + a.nodeSize;
3007
- let u = null;
3008
- if (a.marks.forEach((f) => {
3009
- if (f !== i)
3010
- return !1;
3011
- u = f;
3012
- }), !u)
3013
- return;
3014
- let p = !1;
3015
- if (Object.keys(n).forEach((f) => {
3016
- n[f] !== u.attrs[f] && (p = !0);
3017
- }), p) {
3018
- const f = e.type.create({
3019
- ...e.attrs,
3020
- ...n
3021
- });
3022
- s.removeMark(l, d, e.type), s.addMark(l, d, f);
3023
- }
3024
- }), s.docChanged && t.view.dispatch(s);
3025
- }
3026
- var Kr = class ee extends ht {
3027
- constructor() {
3028
- super(...arguments), this.type = "node";
3029
- }
3030
- /**
3031
- * Create a new Node instance
3032
- * @param config - Node configuration object or a function that returns a configuration object
3033
- */
3034
- static create(t = {}) {
3035
- const n = typeof t == "function" ? t() : t;
3036
- return new ee(n);
3037
- }
3038
- configure(t) {
3039
- return super.configure(t);
3040
- }
3041
- extend(t) {
3042
- const n = typeof t == "function" ? t() : t;
3043
- return super.extend(n);
3044
- }
3045
- };
3046
- function Jr(e) {
3047
- return new dn({
3048
- find: e.find,
3049
- handler: ({ state: t, range: n, match: r, pasteEvent: o }) => {
3050
- const s = w(e.getAttributes, void 0, r, o);
3051
- if (s === !1 || s === null)
3052
- return null;
3053
- const { tr: i } = t, a = r[r.length - 1], c = r[0];
3054
- let l = n.to;
3055
- if (a) {
3056
- const d = c.search(/\S/), u = n.from + c.indexOf(a), p = u + a.length;
3057
- if (Dt(n.from, n.to, t.doc).filter((g) => g.mark.type.excluded.find((h) => h === e.type && h !== g.mark.type)).filter((g) => g.to > u).length)
3058
- return null;
3059
- p < n.to && i.delete(p, n.to), u > n.from && i.delete(n.from + d, u), l = n.from + d + a.length, i.addMark(n.from + d, l, e.type.create(s || {})), i.removeStoredMark(e.type);
3060
- }
3061
- }
3062
- });
3063
- }
3064
- var Gr = (e, t) => {
3065
- if (e === "slot")
3066
- return 0;
3067
- if (e instanceof Function)
3068
- return e(t);
3069
- const { children: n, ...r } = t ?? {};
3070
- if (e === "svg")
3071
- throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
3072
- return [e, r, n];
3073
- };
3074
- export {
3075
- I as E,
3076
- cn as M,
3077
- Kr as N,
3078
- Jr as a,
3079
- Vr as b,
3080
- qr as c,
3081
- ze as d,
3082
- Dt as e,
3083
- jr as f,
3084
- tn as g,
3085
- Gr as h,
3086
- _r as i,
3087
- Ye as j,
3088
- L as k,
3089
- Fr as l,
3090
- Ue as m,
3091
- Hr as n,
3092
- Dr as o,
3093
- E as p,
3094
- Rr as q,
3095
- w as r,
3096
- y as s,
3097
- Wr as t,
3098
- He as u,
3099
- mt as v,
3100
- Ur as w,
3101
- hn as x,
3102
- dt as y,
3103
- Lr as z
3104
- };