@vc-shell/framework 1.1.73 → 1.1.75

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