@vc-shell/framework 1.1.99-alpha.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/api/platform.ts +9883 -9883
- package/core/composables/useDynamicProperties/index.ts +16 -10
- package/core/composables/useNotifications/index.ts +1 -32
- package/core/composables/useSettings/index.ts +3 -8
- package/core/composables/useUser/index.ts +171 -74
- package/core/composables/useUserManagement/index.ts +25 -67
- package/core/interceptors/index.ts +56 -19
- package/core/plugins/signalR/index.ts +1 -27
- package/core/types/index.ts +0 -2
- package/dist/core/api/platform.d.ts +1 -1
- package/dist/core/api/platform.d.ts.map +1 -1
- package/dist/core/composables/useDynamicProperties/index.d.ts.map +1 -1
- package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
- package/dist/core/composables/useSettings/index.d.ts.map +1 -1
- package/dist/core/composables/useUser/index.d.ts +9 -18
- package/dist/core/composables/useUser/index.d.ts.map +1 -1
- package/dist/core/composables/useUserManagement/index.d.ts +7 -7
- package/dist/core/composables/useUserManagement/index.d.ts.map +1 -1
- package/dist/core/interceptors/index.d.ts +1 -2
- package/dist/core/interceptors/index.d.ts.map +1 -1
- package/dist/core/plugins/signalR/index.d.ts +0 -2
- package/dist/core/plugins/signalR/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/injection-keys.d.ts +1 -2
- package/dist/injection-keys.d.ts.map +1 -1
- package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
- package/dist/shared/components/multilanguage-selector/multilanguage-selector.vue.d.ts +1 -1
- package/dist/shared/components/notifications/components/notification-container/index.d.ts +10 -10
- package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
- package/dist/shared/components/sign-in/useExternalProvider.d.ts +1 -1
- package/dist/shared/components/sign-in/useExternalProvider.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +2 -2
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +2 -2
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts +1 -1
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts +1 -1
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts +2 -2
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/index.d.ts +1 -0
- package/dist/ui/components/molecules/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-accordion/_internal/vc-accordion-item/vc-accordion-item.vue.d.ts +34 -0
- package/dist/ui/components/molecules/vc-accordion/_internal/vc-accordion-item/vc-accordion-item.vue.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-accordion/index.d.ts +7 -0
- package/dist/ui/components/molecules/vc-accordion/index.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-accordion/vc-accordion.vue.d.ts +42 -0
- package/dist/ui/components/molecules/vc-accordion/vc-accordion.vue.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +2 -2
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
- 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
- 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
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
- 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
- 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
- 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
- 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
- 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
- package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts +3 -3
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +5 -5
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts +2 -2
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts +2 -2
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts +3 -3
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +1 -1
- package/package.json +5 -7
- package/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +2 -2
- package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +1 -15
- package/shared/components/sign-in/useExternalProvider.ts +1 -11
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +3 -11
- package/ui/components/atoms/vc-badge/vc-badge.stories.ts +1 -1
- package/ui/components/atoms/vc-button/vc-button.stories.ts +1 -1
- package/ui/components/atoms/vc-card/vc-card.stories.ts +1 -1
- package/ui/components/atoms/vc-col/vc-col.stories.ts +1 -1
- package/ui/components/atoms/vc-container/vc-container.stories.ts +1 -1
- package/ui/components/atoms/vc-hint/vc-hint.stories.ts +1 -1
- package/ui/components/atoms/vc-icon/vc-icon.stories.ts +1 -1
- package/ui/components/atoms/vc-image/vc-image.stories.ts +1 -1
- package/ui/components/atoms/vc-label/vc-label.stories.ts +1 -1
- package/ui/components/atoms/vc-link/vc-link.stories.ts +1 -1
- package/ui/components/atoms/vc-progress/vc-progress.stories.ts +1 -1
- package/ui/components/atoms/vc-row/vc-row.stories.ts +1 -1
- package/ui/components/atoms/vc-skeleton/vc-skeleton.stories.ts +1 -1
- package/ui/components/atoms/vc-status/vc-status.stories.ts +1 -1
- package/ui/components/atoms/vc-status-icon/vc-status-icon.stories.ts +1 -1
- package/ui/components/atoms/vc-tooltip/vc-tooltip.stories.ts +1 -1
- package/ui/components/atoms/vc-video/vc-video.stories.ts +1 -1
- package/ui/components/atoms/vc-widget/vc-widget.stories.ts +1 -1
- package/ui/components/molecules/index.ts +1 -0
- package/ui/components/molecules/vc-accordion/_internal/vc-accordion-item/vc-accordion-item.vue +251 -0
- package/ui/components/molecules/vc-accordion/index.ts +11 -0
- package/ui/components/molecules/vc-accordion/vc-accordion.stories.ts +526 -0
- package/ui/components/molecules/vc-accordion/vc-accordion.vue +176 -0
- package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +1 -1
- package/ui/components/molecules/vc-checkbox/vc-checkbox.stories.ts +1 -1
- package/ui/components/molecules/vc-editor/vc-editor.stories.ts +1 -1
- package/ui/components/molecules/vc-field/vc-field.stories.ts +1 -1
- package/ui/components/molecules/vc-file-upload/vc-file-upload.stories.ts +1 -1
- package/ui/components/molecules/vc-form/vc-form.stories.ts +1 -1
- package/ui/components/molecules/vc-input/vc-input.stories.ts +1 -1
- package/ui/components/molecules/vc-input-currency/vc-input-currency.stories.ts +1 -1
- package/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.stories.ts +1 -1
- package/ui/components/molecules/vc-multivalue/vc-multivalue.stories.ts +1 -1
- package/ui/components/molecules/vc-pagination/vc-pagination.stories.ts +1 -1
- package/ui/components/molecules/vc-radio-button/vc-radio-button.stories.ts +1 -1
- package/ui/components/molecules/vc-rating/vc-rating.stories.ts +1 -1
- package/ui/components/molecules/vc-select/vc-select.stories.ts +1 -1
- package/ui/components/molecules/vc-slider/vc-slider.stories.ts +1 -1
- package/ui/components/molecules/vc-switch/vc-switch.stories.ts +1 -1
- package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +1 -1
- package/ui/components/molecules/vc-toast/vc-toast.stories.ts +1 -1
- package/ui/components/organisms/vc-app/vc-app.vue +2 -20
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +4 -0
- package/ui/components/organisms/vc-gallery/vc-gallery.stories.ts +1 -1
- package/ui/components/organisms/vc-popup/vc-popup.stories.ts +1 -1
- package/core/providers/README.md +0 -176
- package/core/providers/auth-provider-manager.ts +0 -74
- package/core/providers/auth-provider-utils.ts +0 -26
- package/core/providers/example-custom-auth-provider.ts +0 -162
- package/core/providers/index.ts +0 -3
- package/core/providers/platform-auth-provider.ts +0 -207
- package/core/types/auth-provider.ts +0 -40
- package/dist/assets/042c75b764bc78a7.svg +0 -1
- package/dist/assets/0ba156439a339f2a.svg +0 -1
- package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
- package/dist/assets/0f590f8a94577092.svg +0 -1
- package/dist/assets/0fc5820f8be53a1b.svg +0 -1
- package/dist/assets/105efd028edc1dfe.woff +0 -0
- package/dist/assets/10768e2cc79fc60b.svg +0 -1
- package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
- package/dist/assets/154365acf3010d96.woff2 +0 -0
- package/dist/assets/157b8721e0600ea8.svg +0 -1
- package/dist/assets/15e91cdd649cde9a.svg +0 -1
- package/dist/assets/19275e398ae57130.woff2 +0 -0
- package/dist/assets/1a3e84b2457f709a.woff +0 -0
- package/dist/assets/1de63eb118636cce.svg +0 -1
- package/dist/assets/1ea01de36eb5491b.svg +0 -1
- package/dist/assets/204eaf512fde2023.svg +0 -1
- package/dist/assets/2088983edf42e153.svg +0 -1
- package/dist/assets/208f810a9321a327.svg +0 -1
- package/dist/assets/21220a9d10e6c558.svg +0 -1
- package/dist/assets/220db345a102045d.woff2 +0 -0
- package/dist/assets/225da11d23968333.svg +0 -1
- package/dist/assets/226f862dd81bdc13.woff2 +0 -0
- package/dist/assets/23a2d53395ddb14f.woff +0 -0
- package/dist/assets/259e6ad461a52ad7.svg +0 -1
- package/dist/assets/261e6dec4d53b9ac.woff +0 -0
- package/dist/assets/262f46a0b6d94bb6.svg +0 -1
- package/dist/assets/2857c513073467da.svg +0 -1
- package/dist/assets/2b3be7889467d98f.woff +0 -0
- package/dist/assets/2d4e6190eec72737.svg +0 -1
- package/dist/assets/2eba973185078bc8.woff +0 -0
- package/dist/assets/334d3f6bc766c516.woff +0 -0
- package/dist/assets/34ff7dd0c2285956.svg +0 -1
- package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
- package/dist/assets/3d892965ab4f1cbb.woff2 +0 -0
- package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
- package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
- package/dist/assets/41275bcb979cb650.svg +0 -1
- package/dist/assets/434f7982590e462f.woff +0 -0
- package/dist/assets/475937116ee3314a.woff2 +0 -0
- package/dist/assets/489710fb710e73f0.woff +0 -0
- package/dist/assets/49791943b3872376.woff2 +0 -0
- package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
- package/dist/assets/4d7a77b0e5373992.svg +0 -1
- package/dist/assets/4e43c74354534fb3.svg +0 -1
- package/dist/assets/4fe75f5117100705.svg +0 -1
- package/dist/assets/52e261a005074e1b.woff +0 -0
- package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
- package/dist/assets/54cda5482c6c9218.woff +0 -0
- package/dist/assets/550f52072e8ccafe.woff2 +0 -0
- package/dist/assets/572bb1bb4156a9c1.svg +0 -1
- package/dist/assets/6075995d7e74da46.woff2 +0 -0
- package/dist/assets/617c4736236e199e.woff +0 -0
- package/dist/assets/67230f05dc94a265.svg +0 -1
- package/dist/assets/6798e4dd4add9b48.svg +0 -1
- package/dist/assets/686d4077c1e26876.woff2 +0 -0
- package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
- package/dist/assets/6a3e73faf406cf33.svg +0 -1
- package/dist/assets/72de3a63bc0b70dd.svg +0 -1
- package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
- package/dist/assets/74ed5f8a78e71106.svg +0 -1
- package/dist/assets/7a5aa5abd625137f.ttf +0 -0
- package/dist/assets/7ce0c166fd6a1204.woff +0 -0
- package/dist/assets/7d55399c2a7bc985.svg +0 -1
- package/dist/assets/7d970675c69fca1d.woff +0 -0
- package/dist/assets/7eda727273fd98d3.svg +0 -1
- package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
- package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
- package/dist/assets/861e6b7192b3b6c7.woff +0 -0
- package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
- package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
- package/dist/assets/910b0d99b9e26568.svg +0 -1
- package/dist/assets/91fe94e424323d61.woff +0 -0
- package/dist/assets/92508f8707159b51.svg +0 -1
- package/dist/assets/9392bf1d591e1abb.svg +0 -1
- package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
- package/dist/assets/9cb83236f6bb7ab1.svg +0 -1
- package/dist/assets/9d37314695c0b68d.woff +0 -0
- package/dist/assets/a03cdcd8da5bb987.woff +0 -0
- package/dist/assets/a18404194e3f9047.svg +0 -1
- package/dist/assets/a2017fe7f0a26510.svg +0 -1
- package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
- package/dist/assets/abf88f301a0730f4.svg +0 -1
- package/dist/assets/ac1a99b3d05d8232.woff +0 -0
- package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
- package/dist/assets/b1a596e31ad1185a.svg +0 -1
- package/dist/assets/b27767411c8427be.woff +0 -0
- package/dist/assets/b325adcae33bbe7a.svg +0 -1
- package/dist/assets/b372390551ca2fa1.svg +0 -1
- package/dist/assets/b5bb1e8fc975decd.svg +0 -1
- package/dist/assets/b645a4a2181b9dc1.svg +0 -1
- package/dist/assets/b6499ddce0a4ef7d.svg +0 -1
- package/dist/assets/b94421fadd23b0f2.svg +0 -1
- package/dist/assets/bb28fb0f27f1c11b.svg +0 -1
- package/dist/assets/c9191b638a10f67b.woff2 +0 -0
- package/dist/assets/ca791c5ca5848a03.svg +0 -1
- package/dist/assets/cb32840ce330103f.woff +0 -0
- package/dist/assets/ccc878931d74181b.woff2 +0 -0
- package/dist/assets/d084bda16abe8a56.svg +0 -1
- package/dist/assets/d32b129cae2fffd6.svg +0 -1
- package/dist/assets/d35a4c7113315758.woff2 +0 -0
- package/dist/assets/d3f792f54ae4c307.svg +0 -1
- package/dist/assets/d5a5b8630120073d.svg +0 -1
- package/dist/assets/d5f9664ebbfb104b.svg +0 -1
- package/dist/assets/d84247b59449dd88.woff2 +0 -0
- package/dist/assets/dceaf3b39091e6a4.woff +0 -0
- package/dist/assets/dd05d43ff0df2fc7.svg +0 -1
- package/dist/assets/e2ad5b3428289141.woff +0 -0
- package/dist/assets/e38acaa1757232e0.svg +0 -1
- package/dist/assets/e4a8550f1c7ffe36.svg +0 -1
- package/dist/assets/e5adb5ae3a3698f6.svg +0 -1
- package/dist/assets/e61a1889bac955f4.woff2 +0 -0
- package/dist/assets/e72bb11356af94c7.svg +0 -1
- package/dist/assets/e98196a9f8dcb2f0.svg +0 -1
- package/dist/assets/ebec912a42ad49ff.woff +0 -0
- package/dist/assets/ee6983981ffcbb41.woff2 +0 -0
- package/dist/assets/f09d89268e4c0317.svg +0 -1
- package/dist/assets/f239394367fcf005.woff2 +0 -0
- package/dist/assets/f5722262b6e7214e.woff2 +0 -0
- package/dist/assets/f7fc8bf46089d8b2.svg +0 -1
- package/dist/assets/fc829e3f399b70e0.woff2 +0 -0
- package/dist/assets/fe141d99763f5d2b.woff +0 -0
- package/dist/assets/fed13b0d59903483.svg +0 -1
- package/dist/assets/fed757d2c2344ead.woff2 +0 -0
- package/dist/assets/ffc438f20e79ce73.woff +0 -0
- package/dist/core/providers/auth-provider-manager.d.ts +0 -34
- package/dist/core/providers/auth-provider-manager.d.ts.map +0 -1
- package/dist/core/providers/auth-provider-utils.d.ts +0 -17
- package/dist/core/providers/auth-provider-utils.d.ts.map +0 -1
- package/dist/core/providers/example-custom-auth-provider.d.ts +0 -45
- package/dist/core/providers/example-custom-auth-provider.d.ts.map +0 -1
- package/dist/core/providers/index.d.ts +0 -3
- package/dist/core/providers/index.d.ts.map +0 -1
- package/dist/core/providers/platform-auth-provider.d.ts +0 -34
- package/dist/core/providers/platform-auth-provider.d.ts.map +0 -1
- package/dist/core/types/auth-provider.d.ts +0 -27
- package/dist/core/types/auth-provider.d.ts.map +0 -1
- package/dist/framework.js +0 -25048
- package/dist/index.css +0 -9
- package/dist/vendor-boolbase-A_-Pp38P.js +0 -23
- package/dist/vendor-cheerio-C46iBpCu.js +0 -1053
- package/dist/vendor-cheerio-select-C8emRZsx.js +0 -191
- package/dist/vendor-core-js-DDuR6YMQ.js +0 -1206
- package/dist/vendor-css-select-DR9bp36p.js +0 -622
- package/dist/vendor-css-what-CZZaquJM.js +0 -267
- package/dist/vendor-cypress-signalr-mock-DjBxJHA6.js +0 -769
- package/dist/vendor-date-fns-sZ1zMzTH.js +0 -3008
- package/dist/vendor-dom-serializer-Sk3xHhQk.js +0 -213
- package/dist/vendor-domelementtype-B3sFIGaC.js +0 -21
- package/dist/vendor-domhandler-CL40eeX9.js +0 -311
- package/dist/vendor-dompurify-BuxjWxA2.js +0 -553
- package/dist/vendor-domutils-BiVCXO8c.js +0 -386
- package/dist/vendor-entities-CCReaWqU.js +0 -364
- package/dist/vendor-floating-ui-core-Cl9nBI4j.js +0 -349
- package/dist/vendor-floating-ui-dom-3z44E4mf.js +0 -395
- package/dist/vendor-floating-ui-utils-D2sT7feD.js +0 -259
- package/dist/vendor-floating-ui-vue-ClrgkeO5.js +0 -107
- package/dist/vendor-headlessui-vue-D7tzx4PC.js +0 -961
- package/dist/vendor-htmlparser2-CpQu33io.js +0 -735
- package/dist/vendor-intlify-core-base-Da62SG4M.js +0 -1130
- package/dist/vendor-intlify-message-compiler-CHvGSH2u.js +0 -952
- package/dist/vendor-intlify-shared-jWBPd9WB.js +0 -144
- package/dist/vendor-iso-639-1-BJO6WZAt.js +0 -781
- package/dist/vendor-linkify-it-LzoUhj6C.js +0 -199
- package/dist/vendor-linkifyjs-dCH9UYes.js +0 -701
- package/dist/vendor-lodash-es-BqkGj3Jl.js +0 -4816
- package/dist/vendor-lucide-vue-next-m0L4DzUL.js +0 -29780
- package/dist/vendor-markdown-it-Czg9qJTh.js +0 -2263
- package/dist/vendor-markdown-it-task-lists-BxLwscWK.js +0 -69
- package/dist/vendor-mdurl-DZFDNdqC.js +0 -192
- package/dist/vendor-microsoft-applicationinsights-analytics-js-C1Yxuzwg.js +0 -1207
- package/dist/vendor-microsoft-applicationinsights-cfgsync-js-DArHD4Dn.js +0 -261
- package/dist/vendor-microsoft-applicationinsights-channel-js-Dbs0XRes.js +0 -1822
- package/dist/vendor-microsoft-applicationinsights-common-OjU3Zs6r.js +0 -1921
- package/dist/vendor-microsoft-applicationinsights-core-js-DWRvqBek.js +0 -4276
- package/dist/vendor-microsoft-applicationinsights-dependencies-js-BxTNw-Sk.js +0 -1407
- package/dist/vendor-microsoft-applicationinsights-properties-js-Gfhpu-At.js +0 -572
- package/dist/vendor-microsoft-applicationinsights-shims-CxtPYiwp.js +0 -43
- package/dist/vendor-microsoft-applicationinsights-web-9yeJ0EZv.js +0 -487
- package/dist/vendor-microsoft-dynamicproto-js-DSkQkH3T.js +0 -147
- package/dist/vendor-microsoft-signalr-Bgpbb4fW.js +0 -1761
- package/dist/vendor-moment-DMLRxgRE.js +0 -2589
- package/dist/vendor-nevware21-ts-async-CdMc_sGt.js +0 -261
- package/dist/vendor-nevware21-ts-utils-Dy41wRhA.js +0 -853
- package/dist/vendor-nth-check-CS1D-zr5.js +0 -45
- package/dist/vendor-orderedmap-B3SOk52B.js +0 -103
- package/dist/vendor-parse5-htmlparser2-tree-adapter-BWywtwol.js +0 -143
- package/dist/vendor-parse5-zq5Hn0y9.js +0 -5749
- package/dist/vendor-prettier-cZc5sCiS.js +0 -4875
- package/dist/vendor-prosemirror-commands-Cu1q5ZDk.js +0 -385
- package/dist/vendor-prosemirror-dropcursor-BuGmFgFS.js +0 -86
- package/dist/vendor-prosemirror-gapcursor-CyYcCWVK.js +0 -203
- package/dist/vendor-prosemirror-history-DzRcbrCw.js +0 -248
- package/dist/vendor-prosemirror-keymap-KfbdOEJw.js +0 -62
- package/dist/vendor-prosemirror-markdown-OyxRuawK.js +0 -650
- package/dist/vendor-prosemirror-model-DFp4ML7B.js +0 -2730
- package/dist/vendor-prosemirror-schema-list-CwCUArvx.js +0 -87
- package/dist/vendor-prosemirror-state-DHaVEu5h.js +0 -821
- package/dist/vendor-prosemirror-tables-mYok4vGT.js +0 -1711
- package/dist/vendor-prosemirror-transform-CAHmg-qG.js +0 -1508
- package/dist/vendor-prosemirror-view-CspJa44O.js +0 -3751
- package/dist/vendor-punycode-js-CgGegfA_.js +0 -133
- package/dist/vendor-rope-sequence-BWC2FSrq.js +0 -100
- package/dist/vendor-semver-Dar8oU3V.js +0 -1023
- package/dist/vendor-swiper-1bp0oJwt.js +0 -3387
- package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +0 -1
- package/dist/vendor-tanstack-vue-virtual-CD9yLWd7.js +0 -1
- package/dist/vendor-tiptap-core-ClsTgaMv.js +0 -3699
- package/dist/vendor-tiptap-extension-blockquote-r1MBx4hD.js +0 -54
- package/dist/vendor-tiptap-extension-bold-BjLI4i8b.js +0 -74
- package/dist/vendor-tiptap-extension-code-D5-kDnMW.js +0 -52
- package/dist/vendor-tiptap-extension-code-block-RjEb0zPA.js +0 -215
- package/dist/vendor-tiptap-extension-document--PLOxIdq.js +0 -12
- package/dist/vendor-tiptap-extension-hard-break-9cxC2YOS.js +0 -59
- package/dist/vendor-tiptap-extension-heading-2w0TutHn.js +0 -63
- package/dist/vendor-tiptap-extension-horizontal-rule-CFowa_lc.js +0 -56
- package/dist/vendor-tiptap-extension-image-aWn-na6j.js +0 -127
- package/dist/vendor-tiptap-extension-italic-Bn-6saY0.js +0 -73
- package/dist/vendor-tiptap-extension-link-BmcG1_k-.js +0 -298
- package/dist/vendor-tiptap-extension-list-BrNBJ45n.js +0 -707
- package/dist/vendor-tiptap-extension-paragraph-DAiYhwUB.js +0 -41
- package/dist/vendor-tiptap-extension-placeholder-9tURDKy-.js +0 -1
- package/dist/vendor-tiptap-extension-strike-DqbXPfos.js +0 -64
- package/dist/vendor-tiptap-extension-table-DQwPaR7v.js +0 -374
- package/dist/vendor-tiptap-extension-table-cell-C0tEP_0i.js +0 -1
- package/dist/vendor-tiptap-extension-table-header-C0tEP_0i.js +0 -1
- package/dist/vendor-tiptap-extension-table-row-C0tEP_0i.js +0 -1
- package/dist/vendor-tiptap-extension-text-BFnfj70b.js +0 -13
- package/dist/vendor-tiptap-extension-text-style-Darua3qr.js +0 -235
- package/dist/vendor-tiptap-extension-underline-QyVnBqQZ.js +0 -65
- package/dist/vendor-tiptap-extensions-CU-D7bfm.js +0 -290
- package/dist/vendor-tiptap-markdown-BwATYN5A.js +0 -826
- package/dist/vendor-tiptap-pm-d91nGny8.js +0 -1
- package/dist/vendor-tiptap-starter-kit-5luf7zzS.js +0 -28
- package/dist/vendor-tiptap-vue-3-CFBErZGb.js +0 -157
- package/dist/vendor-truncate-html-DYC0Lj9o.js +0 -145
- package/dist/vendor-uc-micro-4lbSaZOs.js +0 -17
- package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +0 -93
- package/dist/vendor-vee-validate-rules-4oWUZPpG.js +0 -316
- package/dist/vendor-vue-currency-input-BqaYAdhD.js +0 -317
- package/dist/vendor-vue-demi-CD9yLWd7.js +0 -1
- package/dist/vendor-vue-devtools-api-aVYGocXp.js +0 -93
- package/dist/vendor-vue-i18n-CO5LWKE0.js +0 -1370
- package/dist/vendor-vue3-application-insights-BKiiWnf2.js +0 -69
- package/dist/vendor-vue3-touch-events-DqysuuWh.js +0 -169
- package/dist/vendor-vuepic-vue-datepicker-CaY_xSnG.js +0 -4998
- package/dist/vendor-vueuse-components-sgKpNzof.js +0 -542
- package/dist/vendor-vueuse-core-D0cN7FqY.js +0 -5130
- package/dist/vendor-vueuse-shared-Pt0UEStA.js +0 -1169
- package/dist/vendor-w3c-keyname-CLxH8j-f.js +0 -92
|
@@ -1,2730 +0,0 @@
|
|
|
1
|
-
import { O as q } from "./vendor-orderedmap-B3SOk52B.js";
|
|
2
|
-
function Y(l, t, e) {
|
|
3
|
-
for (let n = 0; ; n++) {
|
|
4
|
-
if (n == l.childCount || n == t.childCount)
|
|
5
|
-
return l.childCount == t.childCount ? null : e;
|
|
6
|
-
let i = l.child(n), r = t.child(n);
|
|
7
|
-
if (i == r) {
|
|
8
|
-
e += i.nodeSize;
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
if (!i.sameMarkup(r))
|
|
12
|
-
return e;
|
|
13
|
-
if (i.isText && i.text != r.text) {
|
|
14
|
-
for (let s = 0; i.text[s] == r.text[s]; s++)
|
|
15
|
-
e++;
|
|
16
|
-
return e;
|
|
17
|
-
}
|
|
18
|
-
if (i.content.size || r.content.size) {
|
|
19
|
-
let s = Y(i.content, r.content, e + 1);
|
|
20
|
-
if (s != null)
|
|
21
|
-
return s;
|
|
22
|
-
}
|
|
23
|
-
e += i.nodeSize;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function Z(l, t, e, n) {
|
|
27
|
-
for (let i = l.childCount, r = t.childCount; ; ) {
|
|
28
|
-
if (i == 0 || r == 0)
|
|
29
|
-
return i == r ? null : { a: e, b: n };
|
|
30
|
-
let s = l.child(--i), o = t.child(--r), h = s.nodeSize;
|
|
31
|
-
if (s == o) {
|
|
32
|
-
e -= h, n -= h;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (!s.sameMarkup(o))
|
|
36
|
-
return { a: e, b: n };
|
|
37
|
-
if (s.isText && s.text != o.text) {
|
|
38
|
-
let a = 0, f = Math.min(s.text.length, o.text.length);
|
|
39
|
-
for (; a < f && s.text[s.text.length - a - 1] == o.text[o.text.length - a - 1]; )
|
|
40
|
-
a++, e--, n--;
|
|
41
|
-
return { a: e, b: n };
|
|
42
|
-
}
|
|
43
|
-
if (s.content.size || o.content.size) {
|
|
44
|
-
let a = Z(s.content, o.content, e - 1, n - 1);
|
|
45
|
-
if (a)
|
|
46
|
-
return a;
|
|
47
|
-
}
|
|
48
|
-
e -= h, n -= h;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
class c {
|
|
52
|
-
/**
|
|
53
|
-
@internal
|
|
54
|
-
*/
|
|
55
|
-
constructor(t, e) {
|
|
56
|
-
if (this.content = t, this.size = e || 0, e == null)
|
|
57
|
-
for (let n = 0; n < t.length; n++)
|
|
58
|
-
this.size += t[n].nodeSize;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
Invoke a callback for all descendant nodes between the given two
|
|
62
|
-
positions (relative to start of this fragment). Doesn't descend
|
|
63
|
-
into a node when the callback returns `false`.
|
|
64
|
-
*/
|
|
65
|
-
nodesBetween(t, e, n, i = 0, r) {
|
|
66
|
-
for (let s = 0, o = 0; o < e; s++) {
|
|
67
|
-
let h = this.content[s], a = o + h.nodeSize;
|
|
68
|
-
if (a > t && n(h, i + o, r || null, s) !== !1 && h.content.size) {
|
|
69
|
-
let f = o + 1;
|
|
70
|
-
h.nodesBetween(Math.max(0, t - f), Math.min(h.content.size, e - f), n, i + f);
|
|
71
|
-
}
|
|
72
|
-
o = a;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
Call the given callback for every descendant node. `pos` will be
|
|
77
|
-
relative to the start of the fragment. The callback may return
|
|
78
|
-
`false` to prevent traversal of a given node's children.
|
|
79
|
-
*/
|
|
80
|
-
descendants(t) {
|
|
81
|
-
this.nodesBetween(0, this.size, t);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
Extract the text between `from` and `to`. See the same method on
|
|
85
|
-
[`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
|
|
86
|
-
*/
|
|
87
|
-
textBetween(t, e, n, i) {
|
|
88
|
-
let r = "", s = !0;
|
|
89
|
-
return this.nodesBetween(t, e, (o, h) => {
|
|
90
|
-
let a = o.isText ? o.text.slice(Math.max(t, h) - h, e - h) : o.isLeaf ? i ? typeof i == "function" ? i(o) : i : o.type.spec.leafText ? o.type.spec.leafText(o) : "" : "";
|
|
91
|
-
o.isBlock && (o.isLeaf && a || o.isTextblock) && n && (s ? s = !1 : r += n), r += a;
|
|
92
|
-
}, 0), r;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
Create a new fragment containing the combined content of this
|
|
96
|
-
fragment and the other.
|
|
97
|
-
*/
|
|
98
|
-
append(t) {
|
|
99
|
-
if (!t.size)
|
|
100
|
-
return this;
|
|
101
|
-
if (!this.size)
|
|
102
|
-
return t;
|
|
103
|
-
let e = this.lastChild, n = t.firstChild, i = this.content.slice(), r = 0;
|
|
104
|
-
for (e.isText && e.sameMarkup(n) && (i[i.length - 1] = e.withText(e.text + n.text), r = 1); r < t.content.length; r++)
|
|
105
|
-
i.push(t.content[r]);
|
|
106
|
-
return new c(i, this.size + t.size);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
Cut out the sub-fragment between the two given positions.
|
|
110
|
-
*/
|
|
111
|
-
cut(t, e = this.size) {
|
|
112
|
-
if (t == 0 && e == this.size)
|
|
113
|
-
return this;
|
|
114
|
-
let n = [], i = 0;
|
|
115
|
-
if (e > t)
|
|
116
|
-
for (let r = 0, s = 0; s < e; r++) {
|
|
117
|
-
let o = this.content[r], h = s + o.nodeSize;
|
|
118
|
-
h > t && ((s < t || h > e) && (o.isText ? o = o.cut(Math.max(0, t - s), Math.min(o.text.length, e - s)) : o = o.cut(Math.max(0, t - s - 1), Math.min(o.content.size, e - s - 1))), n.push(o), i += o.nodeSize), s = h;
|
|
119
|
-
}
|
|
120
|
-
return new c(n, i);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
@internal
|
|
124
|
-
*/
|
|
125
|
-
cutByIndex(t, e) {
|
|
126
|
-
return t == e ? c.empty : t == 0 && e == this.content.length ? this : new c(this.content.slice(t, e));
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
Create a new fragment in which the node at the given index is
|
|
130
|
-
replaced by the given node.
|
|
131
|
-
*/
|
|
132
|
-
replaceChild(t, e) {
|
|
133
|
-
let n = this.content[t];
|
|
134
|
-
if (n == e)
|
|
135
|
-
return this;
|
|
136
|
-
let i = this.content.slice(), r = this.size + e.nodeSize - n.nodeSize;
|
|
137
|
-
return i[t] = e, new c(i, r);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
Create a new fragment by prepending the given node to this
|
|
141
|
-
fragment.
|
|
142
|
-
*/
|
|
143
|
-
addToStart(t) {
|
|
144
|
-
return new c([t].concat(this.content), this.size + t.nodeSize);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
Create a new fragment by appending the given node to this
|
|
148
|
-
fragment.
|
|
149
|
-
*/
|
|
150
|
-
addToEnd(t) {
|
|
151
|
-
return new c(this.content.concat(t), this.size + t.nodeSize);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
Compare this fragment to another one.
|
|
155
|
-
*/
|
|
156
|
-
eq(t) {
|
|
157
|
-
if (this.content.length != t.content.length)
|
|
158
|
-
return !1;
|
|
159
|
-
for (let e = 0; e < this.content.length; e++)
|
|
160
|
-
if (!this.content[e].eq(t.content[e]))
|
|
161
|
-
return !1;
|
|
162
|
-
return !0;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
The first child of the fragment, or `null` if it is empty.
|
|
166
|
-
*/
|
|
167
|
-
get firstChild() {
|
|
168
|
-
return this.content.length ? this.content[0] : null;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
The last child of the fragment, or `null` if it is empty.
|
|
172
|
-
*/
|
|
173
|
-
get lastChild() {
|
|
174
|
-
return this.content.length ? this.content[this.content.length - 1] : null;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
The number of child nodes in this fragment.
|
|
178
|
-
*/
|
|
179
|
-
get childCount() {
|
|
180
|
-
return this.content.length;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
Get the child node at the given index. Raise an error when the
|
|
184
|
-
index is out of range.
|
|
185
|
-
*/
|
|
186
|
-
child(t) {
|
|
187
|
-
let e = this.content[t];
|
|
188
|
-
if (!e)
|
|
189
|
-
throw new RangeError("Index " + t + " out of range for " + this);
|
|
190
|
-
return e;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
Get the child node at the given index, if it exists.
|
|
194
|
-
*/
|
|
195
|
-
maybeChild(t) {
|
|
196
|
-
return this.content[t] || null;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
Call `f` for every child node, passing the node, its offset
|
|
200
|
-
into this parent node, and its index.
|
|
201
|
-
*/
|
|
202
|
-
forEach(t) {
|
|
203
|
-
for (let e = 0, n = 0; e < this.content.length; e++) {
|
|
204
|
-
let i = this.content[e];
|
|
205
|
-
t(i, n, e), n += i.nodeSize;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
Find the first position at which this fragment and another
|
|
210
|
-
fragment differ, or `null` if they are the same.
|
|
211
|
-
*/
|
|
212
|
-
findDiffStart(t, e = 0) {
|
|
213
|
-
return Y(this, t, e);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
Find the first position, searching from the end, at which this
|
|
217
|
-
fragment and the given fragment differ, or `null` if they are
|
|
218
|
-
the same. Since this position will not be the same in both
|
|
219
|
-
nodes, an object with two separate positions is returned.
|
|
220
|
-
*/
|
|
221
|
-
findDiffEnd(t, e = this.size, n = t.size) {
|
|
222
|
-
return Z(this, t, e, n);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
Find the index and inner offset corresponding to a given relative
|
|
226
|
-
position in this fragment. The result object will be reused
|
|
227
|
-
(overwritten) the next time the function is called. @internal
|
|
228
|
-
*/
|
|
229
|
-
findIndex(t) {
|
|
230
|
-
if (t == 0)
|
|
231
|
-
return O(0, t);
|
|
232
|
-
if (t == this.size)
|
|
233
|
-
return O(this.content.length, t);
|
|
234
|
-
if (t > this.size || t < 0)
|
|
235
|
-
throw new RangeError(`Position ${t} outside of fragment (${this})`);
|
|
236
|
-
for (let e = 0, n = 0; ; e++) {
|
|
237
|
-
let i = this.child(e), r = n + i.nodeSize;
|
|
238
|
-
if (r >= t)
|
|
239
|
-
return r == t ? O(e + 1, r) : O(e, n);
|
|
240
|
-
n = r;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
Return a debugging string that describes this fragment.
|
|
245
|
-
*/
|
|
246
|
-
toString() {
|
|
247
|
-
return "<" + this.toStringInner() + ">";
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
@internal
|
|
251
|
-
*/
|
|
252
|
-
toStringInner() {
|
|
253
|
-
return this.content.join(", ");
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
Create a JSON-serializeable representation of this fragment.
|
|
257
|
-
*/
|
|
258
|
-
toJSON() {
|
|
259
|
-
return this.content.length ? this.content.map((t) => t.toJSON()) : null;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
Deserialize a fragment from its JSON representation.
|
|
263
|
-
*/
|
|
264
|
-
static fromJSON(t, e) {
|
|
265
|
-
if (!e)
|
|
266
|
-
return c.empty;
|
|
267
|
-
if (!Array.isArray(e))
|
|
268
|
-
throw new RangeError("Invalid input for Fragment.fromJSON");
|
|
269
|
-
return new c(e.map(t.nodeFromJSON));
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
Build a fragment from an array of nodes. Ensures that adjacent
|
|
273
|
-
text nodes with the same marks are joined together.
|
|
274
|
-
*/
|
|
275
|
-
static fromArray(t) {
|
|
276
|
-
if (!t.length)
|
|
277
|
-
return c.empty;
|
|
278
|
-
let e, n = 0;
|
|
279
|
-
for (let i = 0; i < t.length; i++) {
|
|
280
|
-
let r = t[i];
|
|
281
|
-
n += r.nodeSize, i && r.isText && t[i - 1].sameMarkup(r) ? (e || (e = t.slice(0, i)), e[e.length - 1] = r.withText(e[e.length - 1].text + r.text)) : e && e.push(r);
|
|
282
|
-
}
|
|
283
|
-
return new c(e || t, n);
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
Create a fragment from something that can be interpreted as a
|
|
287
|
-
set of nodes. For `null`, it returns the empty fragment. For a
|
|
288
|
-
fragment, the fragment itself. For a node or array of nodes, a
|
|
289
|
-
fragment containing those nodes.
|
|
290
|
-
*/
|
|
291
|
-
static from(t) {
|
|
292
|
-
if (!t)
|
|
293
|
-
return c.empty;
|
|
294
|
-
if (t instanceof c)
|
|
295
|
-
return t;
|
|
296
|
-
if (Array.isArray(t))
|
|
297
|
-
return this.fromArray(t);
|
|
298
|
-
if (t.attrs)
|
|
299
|
-
return new c([t], t.nodeSize);
|
|
300
|
-
throw new RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
c.empty = new c([], 0);
|
|
304
|
-
const R = { index: 0, offset: 0 };
|
|
305
|
-
function O(l, t) {
|
|
306
|
-
return R.index = l, R.offset = t, R;
|
|
307
|
-
}
|
|
308
|
-
function M(l, t) {
|
|
309
|
-
if (l === t)
|
|
310
|
-
return !0;
|
|
311
|
-
if (!(l && typeof l == "object") || !(t && typeof t == "object"))
|
|
312
|
-
return !1;
|
|
313
|
-
let e = Array.isArray(l);
|
|
314
|
-
if (Array.isArray(t) != e)
|
|
315
|
-
return !1;
|
|
316
|
-
if (e) {
|
|
317
|
-
if (l.length != t.length)
|
|
318
|
-
return !1;
|
|
319
|
-
for (let n = 0; n < l.length; n++)
|
|
320
|
-
if (!M(l[n], t[n]))
|
|
321
|
-
return !1;
|
|
322
|
-
} else {
|
|
323
|
-
for (let n in l)
|
|
324
|
-
if (!(n in t) || !M(l[n], t[n]))
|
|
325
|
-
return !1;
|
|
326
|
-
for (let n in t)
|
|
327
|
-
if (!(n in l))
|
|
328
|
-
return !1;
|
|
329
|
-
}
|
|
330
|
-
return !0;
|
|
331
|
-
}
|
|
332
|
-
class u {
|
|
333
|
-
/**
|
|
334
|
-
@internal
|
|
335
|
-
*/
|
|
336
|
-
constructor(t, e) {
|
|
337
|
-
this.type = t, this.attrs = e;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
Given a set of marks, create a new set which contains this one as
|
|
341
|
-
well, in the right position. If this mark is already in the set,
|
|
342
|
-
the set itself is returned. If any marks that are set to be
|
|
343
|
-
[exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
|
|
344
|
-
those are replaced by this one.
|
|
345
|
-
*/
|
|
346
|
-
addToSet(t) {
|
|
347
|
-
let e, n = !1;
|
|
348
|
-
for (let i = 0; i < t.length; i++) {
|
|
349
|
-
let r = t[i];
|
|
350
|
-
if (this.eq(r))
|
|
351
|
-
return t;
|
|
352
|
-
if (this.type.excludes(r.type))
|
|
353
|
-
e || (e = t.slice(0, i));
|
|
354
|
-
else {
|
|
355
|
-
if (r.type.excludes(this.type))
|
|
356
|
-
return t;
|
|
357
|
-
!n && r.type.rank > this.type.rank && (e || (e = t.slice(0, i)), e.push(this), n = !0), e && e.push(r);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return e || (e = t.slice()), n || e.push(this), e;
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
Remove this mark from the given set, returning a new set. If this
|
|
364
|
-
mark is not in the set, the set itself is returned.
|
|
365
|
-
*/
|
|
366
|
-
removeFromSet(t) {
|
|
367
|
-
for (let e = 0; e < t.length; e++)
|
|
368
|
-
if (this.eq(t[e]))
|
|
369
|
-
return t.slice(0, e).concat(t.slice(e + 1));
|
|
370
|
-
return t;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
Test whether this mark is in the given set of marks.
|
|
374
|
-
*/
|
|
375
|
-
isInSet(t) {
|
|
376
|
-
for (let e = 0; e < t.length; e++)
|
|
377
|
-
if (this.eq(t[e]))
|
|
378
|
-
return !0;
|
|
379
|
-
return !1;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
Test whether this mark has the same type and attributes as
|
|
383
|
-
another mark.
|
|
384
|
-
*/
|
|
385
|
-
eq(t) {
|
|
386
|
-
return this == t || this.type == t.type && M(this.attrs, t.attrs);
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
Convert this mark to a JSON-serializeable representation.
|
|
390
|
-
*/
|
|
391
|
-
toJSON() {
|
|
392
|
-
let t = { type: this.type.name };
|
|
393
|
-
for (let e in this.attrs) {
|
|
394
|
-
t.attrs = this.attrs;
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
return t;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
Deserialize a mark from JSON.
|
|
401
|
-
*/
|
|
402
|
-
static fromJSON(t, e) {
|
|
403
|
-
if (!e)
|
|
404
|
-
throw new RangeError("Invalid input for Mark.fromJSON");
|
|
405
|
-
let n = t.marks[e.type];
|
|
406
|
-
if (!n)
|
|
407
|
-
throw new RangeError(`There is no mark type ${e.type} in this schema`);
|
|
408
|
-
let i = n.create(e.attrs);
|
|
409
|
-
return n.checkAttrs(i.attrs), i;
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
Test whether two sets of marks are identical.
|
|
413
|
-
*/
|
|
414
|
-
static sameSet(t, e) {
|
|
415
|
-
if (t == e)
|
|
416
|
-
return !0;
|
|
417
|
-
if (t.length != e.length)
|
|
418
|
-
return !1;
|
|
419
|
-
for (let n = 0; n < t.length; n++)
|
|
420
|
-
if (!t[n].eq(e[n]))
|
|
421
|
-
return !1;
|
|
422
|
-
return !0;
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
Create a properly sorted mark set from null, a single mark, or an
|
|
426
|
-
unsorted array of marks.
|
|
427
|
-
*/
|
|
428
|
-
static setFrom(t) {
|
|
429
|
-
if (!t || Array.isArray(t) && t.length == 0)
|
|
430
|
-
return u.none;
|
|
431
|
-
if (t instanceof u)
|
|
432
|
-
return [t];
|
|
433
|
-
let e = t.slice();
|
|
434
|
-
return e.sort((n, i) => n.type.rank - i.type.rank), e;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
u.none = [];
|
|
438
|
-
class I extends Error {
|
|
439
|
-
}
|
|
440
|
-
class d {
|
|
441
|
-
/**
|
|
442
|
-
Create a slice. When specifying a non-zero open depth, you must
|
|
443
|
-
make sure that there are nodes of at least that depth at the
|
|
444
|
-
appropriate side of the fragment—i.e. if the fragment is an
|
|
445
|
-
empty paragraph node, `openStart` and `openEnd` can't be greater
|
|
446
|
-
than 1.
|
|
447
|
-
|
|
448
|
-
It is not necessary for the content of open nodes to conform to
|
|
449
|
-
the schema's content constraints, though it should be a valid
|
|
450
|
-
start/end/middle for such a node, depending on which sides are
|
|
451
|
-
open.
|
|
452
|
-
*/
|
|
453
|
-
constructor(t, e, n) {
|
|
454
|
-
this.content = t, this.openStart = e, this.openEnd = n;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
The size this slice would add when inserted into a document.
|
|
458
|
-
*/
|
|
459
|
-
get size() {
|
|
460
|
-
return this.content.size - this.openStart - this.openEnd;
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
@internal
|
|
464
|
-
*/
|
|
465
|
-
insertAt(t, e) {
|
|
466
|
-
let n = $(this.content, t + this.openStart, e);
|
|
467
|
-
return n && new d(n, this.openStart, this.openEnd);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
@internal
|
|
471
|
-
*/
|
|
472
|
-
removeBetween(t, e) {
|
|
473
|
-
return new d(_(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
Tests whether this slice is equal to another slice.
|
|
477
|
-
*/
|
|
478
|
-
eq(t) {
|
|
479
|
-
return this.content.eq(t.content) && this.openStart == t.openStart && this.openEnd == t.openEnd;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
@internal
|
|
483
|
-
*/
|
|
484
|
-
toString() {
|
|
485
|
-
return this.content + "(" + this.openStart + "," + this.openEnd + ")";
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
Convert a slice to a JSON-serializable representation.
|
|
489
|
-
*/
|
|
490
|
-
toJSON() {
|
|
491
|
-
if (!this.content.size)
|
|
492
|
-
return null;
|
|
493
|
-
let t = { content: this.content.toJSON() };
|
|
494
|
-
return this.openStart > 0 && (t.openStart = this.openStart), this.openEnd > 0 && (t.openEnd = this.openEnd), t;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
Deserialize a slice from its JSON representation.
|
|
498
|
-
*/
|
|
499
|
-
static fromJSON(t, e) {
|
|
500
|
-
if (!e)
|
|
501
|
-
return d.empty;
|
|
502
|
-
let n = e.openStart || 0, i = e.openEnd || 0;
|
|
503
|
-
if (typeof n != "number" || typeof i != "number")
|
|
504
|
-
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
505
|
-
return new d(c.fromJSON(t, e.content), n, i);
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
Create a slice from a fragment by taking the maximum possible
|
|
509
|
-
open value on both side of the fragment.
|
|
510
|
-
*/
|
|
511
|
-
static maxOpen(t, e = !0) {
|
|
512
|
-
let n = 0, i = 0;
|
|
513
|
-
for (let r = t.firstChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.firstChild)
|
|
514
|
-
n++;
|
|
515
|
-
for (let r = t.lastChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.lastChild)
|
|
516
|
-
i++;
|
|
517
|
-
return new d(t, n, i);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
d.empty = new d(c.empty, 0, 0);
|
|
521
|
-
function _(l, t, e) {
|
|
522
|
-
let { index: n, offset: i } = l.findIndex(t), r = l.maybeChild(n), { index: s, offset: o } = l.findIndex(e);
|
|
523
|
-
if (i == t || r.isText) {
|
|
524
|
-
if (o != e && !l.child(s).isText)
|
|
525
|
-
throw new RangeError("Removing non-flat range");
|
|
526
|
-
return l.cut(0, t).append(l.cut(e));
|
|
527
|
-
}
|
|
528
|
-
if (n != s)
|
|
529
|
-
throw new RangeError("Removing non-flat range");
|
|
530
|
-
return l.replaceChild(n, r.copy(_(r.content, t - i - 1, e - i - 1)));
|
|
531
|
-
}
|
|
532
|
-
function $(l, t, e, n) {
|
|
533
|
-
let { index: i, offset: r } = l.findIndex(t), s = l.maybeChild(i);
|
|
534
|
-
if (r == t || s.isText)
|
|
535
|
-
return n && !n.canReplace(i, i, e) ? null : l.cut(0, t).append(e).append(l.cut(t));
|
|
536
|
-
let o = $(s.content, t - r - 1, e, s);
|
|
537
|
-
return o && l.replaceChild(i, s.copy(o));
|
|
538
|
-
}
|
|
539
|
-
function dt(l, t, e) {
|
|
540
|
-
if (e.openStart > l.depth)
|
|
541
|
-
throw new I("Inserted content deeper than insertion position");
|
|
542
|
-
if (l.depth - e.openStart != t.depth - e.openEnd)
|
|
543
|
-
throw new I("Inconsistent open depths");
|
|
544
|
-
return tt(l, t, e, 0);
|
|
545
|
-
}
|
|
546
|
-
function tt(l, t, e, n) {
|
|
547
|
-
let i = l.index(n), r = l.node(n);
|
|
548
|
-
if (i == t.index(n) && n < l.depth - e.openStart) {
|
|
549
|
-
let s = tt(l, t, e, n + 1);
|
|
550
|
-
return r.copy(r.content.replaceChild(i, s));
|
|
551
|
-
} else if (e.content.size)
|
|
552
|
-
if (!e.openStart && !e.openEnd && l.depth == n && t.depth == n) {
|
|
553
|
-
let s = l.parent, o = s.content;
|
|
554
|
-
return m(s, o.cut(0, l.parentOffset).append(e.content).append(o.cut(t.parentOffset)));
|
|
555
|
-
} else {
|
|
556
|
-
let { start: s, end: o } = yt(e, l);
|
|
557
|
-
return m(r, nt(l, s, o, t, n));
|
|
558
|
-
}
|
|
559
|
-
else return m(r, A(l, t, n));
|
|
560
|
-
}
|
|
561
|
-
function et(l, t) {
|
|
562
|
-
if (!t.type.compatibleContent(l.type))
|
|
563
|
-
throw new I("Cannot join " + t.type.name + " onto " + l.type.name);
|
|
564
|
-
}
|
|
565
|
-
function D(l, t, e) {
|
|
566
|
-
let n = l.node(e);
|
|
567
|
-
return et(n, t.node(e)), n;
|
|
568
|
-
}
|
|
569
|
-
function x(l, t) {
|
|
570
|
-
let e = t.length - 1;
|
|
571
|
-
e >= 0 && l.isText && l.sameMarkup(t[e]) ? t[e] = l.withText(t[e].text + l.text) : t.push(l);
|
|
572
|
-
}
|
|
573
|
-
function k(l, t, e, n) {
|
|
574
|
-
let i = (t || l).node(e), r = 0, s = t ? t.index(e) : i.childCount;
|
|
575
|
-
l && (r = l.index(e), l.depth > e ? r++ : l.textOffset && (x(l.nodeAfter, n), r++));
|
|
576
|
-
for (let o = r; o < s; o++)
|
|
577
|
-
x(i.child(o), n);
|
|
578
|
-
t && t.depth == e && t.textOffset && x(t.nodeBefore, n);
|
|
579
|
-
}
|
|
580
|
-
function m(l, t) {
|
|
581
|
-
return l.type.checkContent(t), l.copy(t);
|
|
582
|
-
}
|
|
583
|
-
function nt(l, t, e, n, i) {
|
|
584
|
-
let r = l.depth > i && D(l, t, i + 1), s = n.depth > i && D(e, n, i + 1), o = [];
|
|
585
|
-
return k(null, l, i, o), r && s && t.index(i) == e.index(i) ? (et(r, s), x(m(r, nt(l, t, e, n, i + 1)), o)) : (r && x(m(r, A(l, t, i + 1)), o), k(t, e, i, o), s && x(m(s, A(e, n, i + 1)), o)), k(n, null, i, o), new c(o);
|
|
586
|
-
}
|
|
587
|
-
function A(l, t, e) {
|
|
588
|
-
let n = [];
|
|
589
|
-
if (k(null, l, e, n), l.depth > e) {
|
|
590
|
-
let i = D(l, t, e + 1);
|
|
591
|
-
x(m(i, A(l, t, e + 1)), n);
|
|
592
|
-
}
|
|
593
|
-
return k(t, null, e, n), new c(n);
|
|
594
|
-
}
|
|
595
|
-
function yt(l, t) {
|
|
596
|
-
let e = t.depth - l.openStart, i = t.node(e).copy(l.content);
|
|
597
|
-
for (let r = e - 1; r >= 0; r--)
|
|
598
|
-
i = t.node(r).copy(c.from(i));
|
|
599
|
-
return {
|
|
600
|
-
start: i.resolveNoCache(l.openStart + e),
|
|
601
|
-
end: i.resolveNoCache(i.content.size - l.openEnd - e)
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
class E {
|
|
605
|
-
/**
|
|
606
|
-
@internal
|
|
607
|
-
*/
|
|
608
|
-
constructor(t, e, n) {
|
|
609
|
-
this.pos = t, this.path = e, this.parentOffset = n, this.depth = e.length / 3 - 1;
|
|
610
|
-
}
|
|
611
|
-
/**
|
|
612
|
-
@internal
|
|
613
|
-
*/
|
|
614
|
-
resolveDepth(t) {
|
|
615
|
-
return t == null ? this.depth : t < 0 ? this.depth + t : t;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
The parent node that the position points into. Note that even if
|
|
619
|
-
a position points into a text node, that node is not considered
|
|
620
|
-
the parent—text nodes are ‘flat’ in this model, and have no content.
|
|
621
|
-
*/
|
|
622
|
-
get parent() {
|
|
623
|
-
return this.node(this.depth);
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
The root node in which the position was resolved.
|
|
627
|
-
*/
|
|
628
|
-
get doc() {
|
|
629
|
-
return this.node(0);
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
The ancestor node at the given level. `p.node(p.depth)` is the
|
|
633
|
-
same as `p.parent`.
|
|
634
|
-
*/
|
|
635
|
-
node(t) {
|
|
636
|
-
return this.path[this.resolveDepth(t) * 3];
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
The index into the ancestor at the given level. If this points
|
|
640
|
-
at the 3rd node in the 2nd paragraph on the top level, for
|
|
641
|
-
example, `p.index(0)` is 1 and `p.index(1)` is 2.
|
|
642
|
-
*/
|
|
643
|
-
index(t) {
|
|
644
|
-
return this.path[this.resolveDepth(t) * 3 + 1];
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
The index pointing after this position into the ancestor at the
|
|
648
|
-
given level.
|
|
649
|
-
*/
|
|
650
|
-
indexAfter(t) {
|
|
651
|
-
return t = this.resolveDepth(t), this.index(t) + (t == this.depth && !this.textOffset ? 0 : 1);
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
The (absolute) position at the start of the node at the given
|
|
655
|
-
level.
|
|
656
|
-
*/
|
|
657
|
-
start(t) {
|
|
658
|
-
return t = this.resolveDepth(t), t == 0 ? 0 : this.path[t * 3 - 1] + 1;
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
The (absolute) position at the end of the node at the given
|
|
662
|
-
level.
|
|
663
|
-
*/
|
|
664
|
-
end(t) {
|
|
665
|
-
return t = this.resolveDepth(t), this.start(t) + this.node(t).content.size;
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
The (absolute) position directly before the wrapping node at the
|
|
669
|
-
given level, or, when `depth` is `this.depth + 1`, the original
|
|
670
|
-
position.
|
|
671
|
-
*/
|
|
672
|
-
before(t) {
|
|
673
|
-
if (t = this.resolveDepth(t), !t)
|
|
674
|
-
throw new RangeError("There is no position before the top-level node");
|
|
675
|
-
return t == this.depth + 1 ? this.pos : this.path[t * 3 - 1];
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
The (absolute) position directly after the wrapping node at the
|
|
679
|
-
given level, or the original position when `depth` is `this.depth + 1`.
|
|
680
|
-
*/
|
|
681
|
-
after(t) {
|
|
682
|
-
if (t = this.resolveDepth(t), !t)
|
|
683
|
-
throw new RangeError("There is no position after the top-level node");
|
|
684
|
-
return t == this.depth + 1 ? this.pos : this.path[t * 3 - 1] + this.path[t * 3].nodeSize;
|
|
685
|
-
}
|
|
686
|
-
/**
|
|
687
|
-
When this position points into a text node, this returns the
|
|
688
|
-
distance between the position and the start of the text node.
|
|
689
|
-
Will be zero for positions that point between nodes.
|
|
690
|
-
*/
|
|
691
|
-
get textOffset() {
|
|
692
|
-
return this.pos - this.path[this.path.length - 1];
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
Get the node directly after the position, if any. If the position
|
|
696
|
-
points into a text node, only the part of that node after the
|
|
697
|
-
position is returned.
|
|
698
|
-
*/
|
|
699
|
-
get nodeAfter() {
|
|
700
|
-
let t = this.parent, e = this.index(this.depth);
|
|
701
|
-
if (e == t.childCount)
|
|
702
|
-
return null;
|
|
703
|
-
let n = this.pos - this.path[this.path.length - 1], i = t.child(e);
|
|
704
|
-
return n ? t.child(e).cut(n) : i;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
Get the node directly before the position, if any. If the
|
|
708
|
-
position points into a text node, only the part of that node
|
|
709
|
-
before the position is returned.
|
|
710
|
-
*/
|
|
711
|
-
get nodeBefore() {
|
|
712
|
-
let t = this.index(this.depth), e = this.pos - this.path[this.path.length - 1];
|
|
713
|
-
return e ? this.parent.child(t).cut(0, e) : t == 0 ? null : this.parent.child(t - 1);
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
Get the position at the given index in the parent node at the
|
|
717
|
-
given depth (which defaults to `this.depth`).
|
|
718
|
-
*/
|
|
719
|
-
posAtIndex(t, e) {
|
|
720
|
-
e = this.resolveDepth(e);
|
|
721
|
-
let n = this.path[e * 3], i = e == 0 ? 0 : this.path[e * 3 - 1] + 1;
|
|
722
|
-
for (let r = 0; r < t; r++)
|
|
723
|
-
i += n.child(r).nodeSize;
|
|
724
|
-
return i;
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
Get the marks at this position, factoring in the surrounding
|
|
728
|
-
marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
|
|
729
|
-
position is at the start of a non-empty node, the marks of the
|
|
730
|
-
node after it (if any) are returned.
|
|
731
|
-
*/
|
|
732
|
-
marks() {
|
|
733
|
-
let t = this.parent, e = this.index();
|
|
734
|
-
if (t.content.size == 0)
|
|
735
|
-
return u.none;
|
|
736
|
-
if (this.textOffset)
|
|
737
|
-
return t.child(e).marks;
|
|
738
|
-
let n = t.maybeChild(e - 1), i = t.maybeChild(e);
|
|
739
|
-
if (!n) {
|
|
740
|
-
let o = n;
|
|
741
|
-
n = i, i = o;
|
|
742
|
-
}
|
|
743
|
-
let r = n.marks;
|
|
744
|
-
for (var s = 0; s < r.length; s++)
|
|
745
|
-
r[s].type.spec.inclusive === !1 && (!i || !r[s].isInSet(i.marks)) && (r = r[s--].removeFromSet(r));
|
|
746
|
-
return r;
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
Get the marks after the current position, if any, except those
|
|
750
|
-
that are non-inclusive and not present at position `$end`. This
|
|
751
|
-
is mostly useful for getting the set of marks to preserve after a
|
|
752
|
-
deletion. Will return `null` if this position is at the end of
|
|
753
|
-
its parent node or its parent node isn't a textblock (in which
|
|
754
|
-
case no marks should be preserved).
|
|
755
|
-
*/
|
|
756
|
-
marksAcross(t) {
|
|
757
|
-
let e = this.parent.maybeChild(this.index());
|
|
758
|
-
if (!e || !e.isInline)
|
|
759
|
-
return null;
|
|
760
|
-
let n = e.marks, i = t.parent.maybeChild(t.index());
|
|
761
|
-
for (var r = 0; r < n.length; r++)
|
|
762
|
-
n[r].type.spec.inclusive === !1 && (!i || !n[r].isInSet(i.marks)) && (n = n[r--].removeFromSet(n));
|
|
763
|
-
return n;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
The depth up to which this position and the given (non-resolved)
|
|
767
|
-
position share the same parent nodes.
|
|
768
|
-
*/
|
|
769
|
-
sharedDepth(t) {
|
|
770
|
-
for (let e = this.depth; e > 0; e--)
|
|
771
|
-
if (this.start(e) <= t && this.end(e) >= t)
|
|
772
|
-
return e;
|
|
773
|
-
return 0;
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
Returns a range based on the place where this position and the
|
|
777
|
-
given position diverge around block content. If both point into
|
|
778
|
-
the same textblock, for example, a range around that textblock
|
|
779
|
-
will be returned. If they point into different blocks, the range
|
|
780
|
-
around those blocks in their shared ancestor is returned. You can
|
|
781
|
-
pass in an optional predicate that will be called with a parent
|
|
782
|
-
node to see if a range into that parent is acceptable.
|
|
783
|
-
*/
|
|
784
|
-
blockRange(t = this, e) {
|
|
785
|
-
if (t.pos < this.pos)
|
|
786
|
-
return t.blockRange(this);
|
|
787
|
-
for (let n = this.depth - (this.parent.inlineContent || this.pos == t.pos ? 1 : 0); n >= 0; n--)
|
|
788
|
-
if (t.pos <= this.end(n) && (!e || e(this.node(n))))
|
|
789
|
-
return new mt(this, t, n);
|
|
790
|
-
return null;
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
Query whether the given position shares the same parent node.
|
|
794
|
-
*/
|
|
795
|
-
sameParent(t) {
|
|
796
|
-
return this.pos - this.parentOffset == t.pos - t.parentOffset;
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
Return the greater of this and the given position.
|
|
800
|
-
*/
|
|
801
|
-
max(t) {
|
|
802
|
-
return t.pos > this.pos ? t : this;
|
|
803
|
-
}
|
|
804
|
-
/**
|
|
805
|
-
Return the smaller of this and the given position.
|
|
806
|
-
*/
|
|
807
|
-
min(t) {
|
|
808
|
-
return t.pos < this.pos ? t : this;
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
@internal
|
|
812
|
-
*/
|
|
813
|
-
toString() {
|
|
814
|
-
let t = "";
|
|
815
|
-
for (let e = 1; e <= this.depth; e++)
|
|
816
|
-
t += (t ? "/" : "") + this.node(e).type.name + "_" + this.index(e - 1);
|
|
817
|
-
return t + ":" + this.parentOffset;
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
@internal
|
|
821
|
-
*/
|
|
822
|
-
static resolve(t, e) {
|
|
823
|
-
if (!(e >= 0 && e <= t.content.size))
|
|
824
|
-
throw new RangeError("Position " + e + " out of range");
|
|
825
|
-
let n = [], i = 0, r = e;
|
|
826
|
-
for (let s = t; ; ) {
|
|
827
|
-
let { index: o, offset: h } = s.content.findIndex(r), a = r - h;
|
|
828
|
-
if (n.push(s, o, i + h), !a || (s = s.child(o), s.isText))
|
|
829
|
-
break;
|
|
830
|
-
r = a - 1, i += h + 1;
|
|
831
|
-
}
|
|
832
|
-
return new E(e, n, r);
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
@internal
|
|
836
|
-
*/
|
|
837
|
-
static resolveCached(t, e) {
|
|
838
|
-
let n = L.get(t);
|
|
839
|
-
if (n)
|
|
840
|
-
for (let r = 0; r < n.elts.length; r++) {
|
|
841
|
-
let s = n.elts[r];
|
|
842
|
-
if (s.pos == e)
|
|
843
|
-
return s;
|
|
844
|
-
}
|
|
845
|
-
else
|
|
846
|
-
L.set(t, n = new gt());
|
|
847
|
-
let i = n.elts[n.i] = E.resolve(t, e);
|
|
848
|
-
return n.i = (n.i + 1) % xt, i;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
class gt {
|
|
852
|
-
constructor() {
|
|
853
|
-
this.elts = [], this.i = 0;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
const xt = 12, L = /* @__PURE__ */ new WeakMap();
|
|
857
|
-
class mt {
|
|
858
|
-
/**
|
|
859
|
-
Construct a node range. `$from` and `$to` should point into the
|
|
860
|
-
same node until at least the given `depth`, since a node range
|
|
861
|
-
denotes an adjacent set of nodes in a single parent node.
|
|
862
|
-
*/
|
|
863
|
-
constructor(t, e, n) {
|
|
864
|
-
this.$from = t, this.$to = e, this.depth = n;
|
|
865
|
-
}
|
|
866
|
-
/**
|
|
867
|
-
The position at the start of the range.
|
|
868
|
-
*/
|
|
869
|
-
get start() {
|
|
870
|
-
return this.$from.before(this.depth + 1);
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
The position at the end of the range.
|
|
874
|
-
*/
|
|
875
|
-
get end() {
|
|
876
|
-
return this.$to.after(this.depth + 1);
|
|
877
|
-
}
|
|
878
|
-
/**
|
|
879
|
-
The parent node that the range points into.
|
|
880
|
-
*/
|
|
881
|
-
get parent() {
|
|
882
|
-
return this.$from.node(this.depth);
|
|
883
|
-
}
|
|
884
|
-
/**
|
|
885
|
-
The start index of the range in the parent node.
|
|
886
|
-
*/
|
|
887
|
-
get startIndex() {
|
|
888
|
-
return this.$from.index(this.depth);
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
The end index of the range in the parent node.
|
|
892
|
-
*/
|
|
893
|
-
get endIndex() {
|
|
894
|
-
return this.$to.indexAfter(this.depth);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
const wt = /* @__PURE__ */ Object.create(null);
|
|
898
|
-
class g {
|
|
899
|
-
/**
|
|
900
|
-
@internal
|
|
901
|
-
*/
|
|
902
|
-
constructor(t, e, n, i = u.none) {
|
|
903
|
-
this.type = t, this.attrs = e, this.marks = i, this.content = n || c.empty;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
The array of this node's child nodes.
|
|
907
|
-
*/
|
|
908
|
-
get children() {
|
|
909
|
-
return this.content.content;
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
The size of this node, as defined by the integer-based [indexing
|
|
913
|
-
scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
|
|
914
|
-
amount of characters. For other leaf nodes, it is one. For
|
|
915
|
-
non-leaf nodes, it is the size of the content plus two (the
|
|
916
|
-
start and end token).
|
|
917
|
-
*/
|
|
918
|
-
get nodeSize() {
|
|
919
|
-
return this.isLeaf ? 1 : 2 + this.content.size;
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
The number of children that the node has.
|
|
923
|
-
*/
|
|
924
|
-
get childCount() {
|
|
925
|
-
return this.content.childCount;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
Get the child node at the given index. Raises an error when the
|
|
929
|
-
index is out of range.
|
|
930
|
-
*/
|
|
931
|
-
child(t) {
|
|
932
|
-
return this.content.child(t);
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
Get the child node at the given index, if it exists.
|
|
936
|
-
*/
|
|
937
|
-
maybeChild(t) {
|
|
938
|
-
return this.content.maybeChild(t);
|
|
939
|
-
}
|
|
940
|
-
/**
|
|
941
|
-
Call `f` for every child node, passing the node, its offset
|
|
942
|
-
into this parent node, and its index.
|
|
943
|
-
*/
|
|
944
|
-
forEach(t) {
|
|
945
|
-
this.content.forEach(t);
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
Invoke a callback for all descendant nodes recursively between
|
|
949
|
-
the given two positions that are relative to start of this
|
|
950
|
-
node's content. The callback is invoked with the node, its
|
|
951
|
-
position relative to the original node (method receiver),
|
|
952
|
-
its parent node, and its child index. When the callback returns
|
|
953
|
-
false for a given node, that node's children will not be
|
|
954
|
-
recursed over. The last parameter can be used to specify a
|
|
955
|
-
starting position to count from.
|
|
956
|
-
*/
|
|
957
|
-
nodesBetween(t, e, n, i = 0) {
|
|
958
|
-
this.content.nodesBetween(t, e, n, i, this);
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
Call the given callback for every descendant node. Doesn't
|
|
962
|
-
descend into a node when the callback returns `false`.
|
|
963
|
-
*/
|
|
964
|
-
descendants(t) {
|
|
965
|
-
this.nodesBetween(0, this.content.size, t);
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
Concatenates all the text nodes found in this fragment and its
|
|
969
|
-
children.
|
|
970
|
-
*/
|
|
971
|
-
get textContent() {
|
|
972
|
-
return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
Get all text between positions `from` and `to`. When
|
|
976
|
-
`blockSeparator` is given, it will be inserted to separate text
|
|
977
|
-
from different block nodes. If `leafText` is given, it'll be
|
|
978
|
-
inserted for every non-text leaf node encountered, otherwise
|
|
979
|
-
[`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
|
|
980
|
-
*/
|
|
981
|
-
textBetween(t, e, n, i) {
|
|
982
|
-
return this.content.textBetween(t, e, n, i);
|
|
983
|
-
}
|
|
984
|
-
/**
|
|
985
|
-
Returns this node's first child, or `null` if there are no
|
|
986
|
-
children.
|
|
987
|
-
*/
|
|
988
|
-
get firstChild() {
|
|
989
|
-
return this.content.firstChild;
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
Returns this node's last child, or `null` if there are no
|
|
993
|
-
children.
|
|
994
|
-
*/
|
|
995
|
-
get lastChild() {
|
|
996
|
-
return this.content.lastChild;
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
Test whether two nodes represent the same piece of document.
|
|
1000
|
-
*/
|
|
1001
|
-
eq(t) {
|
|
1002
|
-
return this == t || this.sameMarkup(t) && this.content.eq(t.content);
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
Compare the markup (type, attributes, and marks) of this node to
|
|
1006
|
-
those of another. Returns `true` if both have the same markup.
|
|
1007
|
-
*/
|
|
1008
|
-
sameMarkup(t) {
|
|
1009
|
-
return this.hasMarkup(t.type, t.attrs, t.marks);
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
Check whether this node's markup correspond to the given type,
|
|
1013
|
-
attributes, and marks.
|
|
1014
|
-
*/
|
|
1015
|
-
hasMarkup(t, e, n) {
|
|
1016
|
-
return this.type == t && M(this.attrs, e || t.defaultAttrs || wt) && u.sameSet(this.marks, n || u.none);
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
Create a new node with the same markup as this node, containing
|
|
1020
|
-
the given content (or empty, if no content is given).
|
|
1021
|
-
*/
|
|
1022
|
-
copy(t = null) {
|
|
1023
|
-
return t == this.content ? this : new g(this.type, this.attrs, t, this.marks);
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
Create a copy of this node, with the given set of marks instead
|
|
1027
|
-
of the node's own marks.
|
|
1028
|
-
*/
|
|
1029
|
-
mark(t) {
|
|
1030
|
-
return t == this.marks ? this : new g(this.type, this.attrs, this.content, t);
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
Create a copy of this node with only the content between the
|
|
1034
|
-
given positions. If `to` is not given, it defaults to the end of
|
|
1035
|
-
the node.
|
|
1036
|
-
*/
|
|
1037
|
-
cut(t, e = this.content.size) {
|
|
1038
|
-
return t == 0 && e == this.content.size ? this : this.copy(this.content.cut(t, e));
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
Cut out the part of the document between the given positions, and
|
|
1042
|
-
return it as a `Slice` object.
|
|
1043
|
-
*/
|
|
1044
|
-
slice(t, e = this.content.size, n = !1) {
|
|
1045
|
-
if (t == e)
|
|
1046
|
-
return d.empty;
|
|
1047
|
-
let i = this.resolve(t), r = this.resolve(e), s = n ? 0 : i.sharedDepth(e), o = i.start(s), a = i.node(s).content.cut(i.pos - o, r.pos - o);
|
|
1048
|
-
return new d(a, i.depth - s, r.depth - s);
|
|
1049
|
-
}
|
|
1050
|
-
/**
|
|
1051
|
-
Replace the part of the document between the given positions with
|
|
1052
|
-
the given slice. The slice must 'fit', meaning its open sides
|
|
1053
|
-
must be able to connect to the surrounding content, and its
|
|
1054
|
-
content nodes must be valid children for the node they are placed
|
|
1055
|
-
into. If any of this is violated, an error of type
|
|
1056
|
-
[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
|
|
1057
|
-
*/
|
|
1058
|
-
replace(t, e, n) {
|
|
1059
|
-
return dt(this.resolve(t), this.resolve(e), n);
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
Find the node directly after the given position.
|
|
1063
|
-
*/
|
|
1064
|
-
nodeAt(t) {
|
|
1065
|
-
for (let e = this; ; ) {
|
|
1066
|
-
let { index: n, offset: i } = e.content.findIndex(t);
|
|
1067
|
-
if (e = e.maybeChild(n), !e)
|
|
1068
|
-
return null;
|
|
1069
|
-
if (i == t || e.isText)
|
|
1070
|
-
return e;
|
|
1071
|
-
t -= i + 1;
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
Find the (direct) child node after the given offset, if any,
|
|
1076
|
-
and return it along with its index and offset relative to this
|
|
1077
|
-
node.
|
|
1078
|
-
*/
|
|
1079
|
-
childAfter(t) {
|
|
1080
|
-
let { index: e, offset: n } = this.content.findIndex(t);
|
|
1081
|
-
return { node: this.content.maybeChild(e), index: e, offset: n };
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
Find the (direct) child node before the given offset, if any,
|
|
1085
|
-
and return it along with its index and offset relative to this
|
|
1086
|
-
node.
|
|
1087
|
-
*/
|
|
1088
|
-
childBefore(t) {
|
|
1089
|
-
if (t == 0)
|
|
1090
|
-
return { node: null, index: 0, offset: 0 };
|
|
1091
|
-
let { index: e, offset: n } = this.content.findIndex(t);
|
|
1092
|
-
if (n < t)
|
|
1093
|
-
return { node: this.content.child(e), index: e, offset: n };
|
|
1094
|
-
let i = this.content.child(e - 1);
|
|
1095
|
-
return { node: i, index: e - 1, offset: n - i.nodeSize };
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
Resolve the given position in the document, returning an
|
|
1099
|
-
[object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
|
|
1100
|
-
*/
|
|
1101
|
-
resolve(t) {
|
|
1102
|
-
return E.resolveCached(this, t);
|
|
1103
|
-
}
|
|
1104
|
-
/**
|
|
1105
|
-
@internal
|
|
1106
|
-
*/
|
|
1107
|
-
resolveNoCache(t) {
|
|
1108
|
-
return E.resolve(this, t);
|
|
1109
|
-
}
|
|
1110
|
-
/**
|
|
1111
|
-
Test whether a given mark or mark type occurs in this document
|
|
1112
|
-
between the two given positions.
|
|
1113
|
-
*/
|
|
1114
|
-
rangeHasMark(t, e, n) {
|
|
1115
|
-
let i = !1;
|
|
1116
|
-
return e > t && this.nodesBetween(t, e, (r) => (n.isInSet(r.marks) && (i = !0), !i)), i;
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
True when this is a block (non-inline node)
|
|
1120
|
-
*/
|
|
1121
|
-
get isBlock() {
|
|
1122
|
-
return this.type.isBlock;
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
True when this is a textblock node, a block node with inline
|
|
1126
|
-
content.
|
|
1127
|
-
*/
|
|
1128
|
-
get isTextblock() {
|
|
1129
|
-
return this.type.isTextblock;
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
True when this node allows inline content.
|
|
1133
|
-
*/
|
|
1134
|
-
get inlineContent() {
|
|
1135
|
-
return this.type.inlineContent;
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
True when this is an inline node (a text node or a node that can
|
|
1139
|
-
appear among text).
|
|
1140
|
-
*/
|
|
1141
|
-
get isInline() {
|
|
1142
|
-
return this.type.isInline;
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
True when this is a text node.
|
|
1146
|
-
*/
|
|
1147
|
-
get isText() {
|
|
1148
|
-
return this.type.isText;
|
|
1149
|
-
}
|
|
1150
|
-
/**
|
|
1151
|
-
True when this is a leaf node.
|
|
1152
|
-
*/
|
|
1153
|
-
get isLeaf() {
|
|
1154
|
-
return this.type.isLeaf;
|
|
1155
|
-
}
|
|
1156
|
-
/**
|
|
1157
|
-
True when this is an atom, i.e. when it does not have directly
|
|
1158
|
-
editable content. This is usually the same as `isLeaf`, but can
|
|
1159
|
-
be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
|
|
1160
|
-
on a node's spec (typically used when the node is displayed as
|
|
1161
|
-
an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
|
|
1162
|
-
*/
|
|
1163
|
-
get isAtom() {
|
|
1164
|
-
return this.type.isAtom;
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
Return a string representation of this node for debugging
|
|
1168
|
-
purposes.
|
|
1169
|
-
*/
|
|
1170
|
-
toString() {
|
|
1171
|
-
if (this.type.spec.toDebugString)
|
|
1172
|
-
return this.type.spec.toDebugString(this);
|
|
1173
|
-
let t = this.type.name;
|
|
1174
|
-
return this.content.size && (t += "(" + this.content.toStringInner() + ")"), it(this.marks, t);
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
Get the content match in this node at the given index.
|
|
1178
|
-
*/
|
|
1179
|
-
contentMatchAt(t) {
|
|
1180
|
-
let e = this.type.contentMatch.matchFragment(this.content, 0, t);
|
|
1181
|
-
if (!e)
|
|
1182
|
-
throw new Error("Called contentMatchAt on a node with invalid content");
|
|
1183
|
-
return e;
|
|
1184
|
-
}
|
|
1185
|
-
/**
|
|
1186
|
-
Test whether replacing the range between `from` and `to` (by
|
|
1187
|
-
child index) with the given replacement fragment (which defaults
|
|
1188
|
-
to the empty fragment) would leave the node's content valid. You
|
|
1189
|
-
can optionally pass `start` and `end` indices into the
|
|
1190
|
-
replacement fragment.
|
|
1191
|
-
*/
|
|
1192
|
-
canReplace(t, e, n = c.empty, i = 0, r = n.childCount) {
|
|
1193
|
-
let s = this.contentMatchAt(t).matchFragment(n, i, r), o = s && s.matchFragment(this.content, e);
|
|
1194
|
-
if (!o || !o.validEnd)
|
|
1195
|
-
return !1;
|
|
1196
|
-
for (let h = i; h < r; h++)
|
|
1197
|
-
if (!this.type.allowsMarks(n.child(h).marks))
|
|
1198
|
-
return !1;
|
|
1199
|
-
return !0;
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
Test whether replacing the range `from` to `to` (by index) with
|
|
1203
|
-
a node of the given type would leave the node's content valid.
|
|
1204
|
-
*/
|
|
1205
|
-
canReplaceWith(t, e, n, i) {
|
|
1206
|
-
if (i && !this.type.allowsMarks(i))
|
|
1207
|
-
return !1;
|
|
1208
|
-
let r = this.contentMatchAt(t).matchType(n), s = r && r.matchFragment(this.content, e);
|
|
1209
|
-
return s ? s.validEnd : !1;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
Test whether the given node's content could be appended to this
|
|
1213
|
-
node. If that node is empty, this will only return true if there
|
|
1214
|
-
is at least one node type that can appear in both nodes (to avoid
|
|
1215
|
-
merging completely incompatible nodes).
|
|
1216
|
-
*/
|
|
1217
|
-
canAppend(t) {
|
|
1218
|
-
return t.content.size ? this.canReplace(this.childCount, this.childCount, t.content) : this.type.compatibleContent(t.type);
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
Check whether this node and its descendants conform to the
|
|
1222
|
-
schema, and raise an exception when they do not.
|
|
1223
|
-
*/
|
|
1224
|
-
check() {
|
|
1225
|
-
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1226
|
-
let t = u.none;
|
|
1227
|
-
for (let e = 0; e < this.marks.length; e++) {
|
|
1228
|
-
let n = this.marks[e];
|
|
1229
|
-
n.type.checkAttrs(n.attrs), t = n.addToSet(t);
|
|
1230
|
-
}
|
|
1231
|
-
if (!u.sameSet(t, this.marks))
|
|
1232
|
-
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
|
|
1233
|
-
this.content.forEach((e) => e.check());
|
|
1234
|
-
}
|
|
1235
|
-
/**
|
|
1236
|
-
Return a JSON-serializeable representation of this node.
|
|
1237
|
-
*/
|
|
1238
|
-
toJSON() {
|
|
1239
|
-
let t = { type: this.type.name };
|
|
1240
|
-
for (let e in this.attrs) {
|
|
1241
|
-
t.attrs = this.attrs;
|
|
1242
|
-
break;
|
|
1243
|
-
}
|
|
1244
|
-
return this.content.size && (t.content = this.content.toJSON()), this.marks.length && (t.marks = this.marks.map((e) => e.toJSON())), t;
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
Deserialize a node from its JSON representation.
|
|
1248
|
-
*/
|
|
1249
|
-
static fromJSON(t, e) {
|
|
1250
|
-
if (!e)
|
|
1251
|
-
throw new RangeError("Invalid input for Node.fromJSON");
|
|
1252
|
-
let n;
|
|
1253
|
-
if (e.marks) {
|
|
1254
|
-
if (!Array.isArray(e.marks))
|
|
1255
|
-
throw new RangeError("Invalid mark data for Node.fromJSON");
|
|
1256
|
-
n = e.marks.map(t.markFromJSON);
|
|
1257
|
-
}
|
|
1258
|
-
if (e.type == "text") {
|
|
1259
|
-
if (typeof e.text != "string")
|
|
1260
|
-
throw new RangeError("Invalid text node in JSON");
|
|
1261
|
-
return t.text(e.text, n);
|
|
1262
|
-
}
|
|
1263
|
-
let i = c.fromJSON(t, e.content), r = t.nodeType(e.type).create(e.attrs, i, n);
|
|
1264
|
-
return r.type.checkAttrs(r.attrs), r;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
g.prototype.text = void 0;
|
|
1268
|
-
class z extends g {
|
|
1269
|
-
/**
|
|
1270
|
-
@internal
|
|
1271
|
-
*/
|
|
1272
|
-
constructor(t, e, n, i) {
|
|
1273
|
-
if (super(t, e, null, i), !n)
|
|
1274
|
-
throw new RangeError("Empty text nodes are not allowed");
|
|
1275
|
-
this.text = n;
|
|
1276
|
-
}
|
|
1277
|
-
toString() {
|
|
1278
|
-
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : it(this.marks, JSON.stringify(this.text));
|
|
1279
|
-
}
|
|
1280
|
-
get textContent() {
|
|
1281
|
-
return this.text;
|
|
1282
|
-
}
|
|
1283
|
-
textBetween(t, e) {
|
|
1284
|
-
return this.text.slice(t, e);
|
|
1285
|
-
}
|
|
1286
|
-
get nodeSize() {
|
|
1287
|
-
return this.text.length;
|
|
1288
|
-
}
|
|
1289
|
-
mark(t) {
|
|
1290
|
-
return t == this.marks ? this : new z(this.type, this.attrs, this.text, t);
|
|
1291
|
-
}
|
|
1292
|
-
withText(t) {
|
|
1293
|
-
return t == this.text ? this : new z(this.type, this.attrs, t, this.marks);
|
|
1294
|
-
}
|
|
1295
|
-
cut(t = 0, e = this.text.length) {
|
|
1296
|
-
return t == 0 && e == this.text.length ? this : this.withText(this.text.slice(t, e));
|
|
1297
|
-
}
|
|
1298
|
-
eq(t) {
|
|
1299
|
-
return this.sameMarkup(t) && this.text == t.text;
|
|
1300
|
-
}
|
|
1301
|
-
toJSON() {
|
|
1302
|
-
let t = super.toJSON();
|
|
1303
|
-
return t.text = this.text, t;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
function it(l, t) {
|
|
1307
|
-
for (let e = l.length - 1; e >= 0; e--)
|
|
1308
|
-
t = l[e].type.name + "(" + t + ")";
|
|
1309
|
-
return t;
|
|
1310
|
-
}
|
|
1311
|
-
class w {
|
|
1312
|
-
/**
|
|
1313
|
-
@internal
|
|
1314
|
-
*/
|
|
1315
|
-
constructor(t) {
|
|
1316
|
-
this.validEnd = t, this.next = [], this.wrapCache = [];
|
|
1317
|
-
}
|
|
1318
|
-
/**
|
|
1319
|
-
@internal
|
|
1320
|
-
*/
|
|
1321
|
-
static parse(t, e) {
|
|
1322
|
-
let n = new kt(t, e);
|
|
1323
|
-
if (n.next == null)
|
|
1324
|
-
return w.empty;
|
|
1325
|
-
let i = rt(n);
|
|
1326
|
-
n.next && n.err("Unexpected trailing text");
|
|
1327
|
-
let r = Mt(Tt(i));
|
|
1328
|
-
return At(r, n), r;
|
|
1329
|
-
}
|
|
1330
|
-
/**
|
|
1331
|
-
Match a node type, returning a match after that node if
|
|
1332
|
-
successful.
|
|
1333
|
-
*/
|
|
1334
|
-
matchType(t) {
|
|
1335
|
-
for (let e = 0; e < this.next.length; e++)
|
|
1336
|
-
if (this.next[e].type == t)
|
|
1337
|
-
return this.next[e].next;
|
|
1338
|
-
return null;
|
|
1339
|
-
}
|
|
1340
|
-
/**
|
|
1341
|
-
Try to match a fragment. Returns the resulting match when
|
|
1342
|
-
successful.
|
|
1343
|
-
*/
|
|
1344
|
-
matchFragment(t, e = 0, n = t.childCount) {
|
|
1345
|
-
let i = this;
|
|
1346
|
-
for (let r = e; i && r < n; r++)
|
|
1347
|
-
i = i.matchType(t.child(r).type);
|
|
1348
|
-
return i;
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
@internal
|
|
1352
|
-
*/
|
|
1353
|
-
get inlineContent() {
|
|
1354
|
-
return this.next.length != 0 && this.next[0].type.isInline;
|
|
1355
|
-
}
|
|
1356
|
-
/**
|
|
1357
|
-
Get the first matching node type at this match position that can
|
|
1358
|
-
be generated.
|
|
1359
|
-
*/
|
|
1360
|
-
get defaultType() {
|
|
1361
|
-
for (let t = 0; t < this.next.length; t++) {
|
|
1362
|
-
let { type: e } = this.next[t];
|
|
1363
|
-
if (!(e.isText || e.hasRequiredAttrs()))
|
|
1364
|
-
return e;
|
|
1365
|
-
}
|
|
1366
|
-
return null;
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
@internal
|
|
1370
|
-
*/
|
|
1371
|
-
compatible(t) {
|
|
1372
|
-
for (let e = 0; e < this.next.length; e++)
|
|
1373
|
-
for (let n = 0; n < t.next.length; n++)
|
|
1374
|
-
if (this.next[e].type == t.next[n].type)
|
|
1375
|
-
return !0;
|
|
1376
|
-
return !1;
|
|
1377
|
-
}
|
|
1378
|
-
/**
|
|
1379
|
-
Try to match the given fragment, and if that fails, see if it can
|
|
1380
|
-
be made to match by inserting nodes in front of it. When
|
|
1381
|
-
successful, return a fragment of inserted nodes (which may be
|
|
1382
|
-
empty if nothing had to be inserted). When `toEnd` is true, only
|
|
1383
|
-
return a fragment if the resulting match goes to the end of the
|
|
1384
|
-
content expression.
|
|
1385
|
-
*/
|
|
1386
|
-
fillBefore(t, e = !1, n = 0) {
|
|
1387
|
-
let i = [this];
|
|
1388
|
-
function r(s, o) {
|
|
1389
|
-
let h = s.matchFragment(t, n);
|
|
1390
|
-
if (h && (!e || h.validEnd))
|
|
1391
|
-
return c.from(o.map((a) => a.createAndFill()));
|
|
1392
|
-
for (let a = 0; a < s.next.length; a++) {
|
|
1393
|
-
let { type: f, next: p } = s.next[a];
|
|
1394
|
-
if (!(f.isText || f.hasRequiredAttrs()) && i.indexOf(p) == -1) {
|
|
1395
|
-
i.push(p);
|
|
1396
|
-
let y = r(p, o.concat(f));
|
|
1397
|
-
if (y)
|
|
1398
|
-
return y;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
return null;
|
|
1402
|
-
}
|
|
1403
|
-
return r(this, []);
|
|
1404
|
-
}
|
|
1405
|
-
/**
|
|
1406
|
-
Find a set of wrapping node types that would allow a node of the
|
|
1407
|
-
given type to appear at this position. The result may be empty
|
|
1408
|
-
(when it fits directly) and will be null when no such wrapping
|
|
1409
|
-
exists.
|
|
1410
|
-
*/
|
|
1411
|
-
findWrapping(t) {
|
|
1412
|
-
for (let n = 0; n < this.wrapCache.length; n += 2)
|
|
1413
|
-
if (this.wrapCache[n] == t)
|
|
1414
|
-
return this.wrapCache[n + 1];
|
|
1415
|
-
let e = this.computeWrapping(t);
|
|
1416
|
-
return this.wrapCache.push(t, e), e;
|
|
1417
|
-
}
|
|
1418
|
-
/**
|
|
1419
|
-
@internal
|
|
1420
|
-
*/
|
|
1421
|
-
computeWrapping(t) {
|
|
1422
|
-
let e = /* @__PURE__ */ Object.create(null), n = [{ match: this, type: null, via: null }];
|
|
1423
|
-
for (; n.length; ) {
|
|
1424
|
-
let i = n.shift(), r = i.match;
|
|
1425
|
-
if (r.matchType(t)) {
|
|
1426
|
-
let s = [];
|
|
1427
|
-
for (let o = i; o.type; o = o.via)
|
|
1428
|
-
s.push(o.type);
|
|
1429
|
-
return s.reverse();
|
|
1430
|
-
}
|
|
1431
|
-
for (let s = 0; s < r.next.length; s++) {
|
|
1432
|
-
let { type: o, next: h } = r.next[s];
|
|
1433
|
-
!o.isLeaf && !o.hasRequiredAttrs() && !(o.name in e) && (!i.type || h.validEnd) && (n.push({ match: o.contentMatch, type: o, via: i }), e[o.name] = !0);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
return null;
|
|
1437
|
-
}
|
|
1438
|
-
/**
|
|
1439
|
-
The number of outgoing edges this node has in the finite
|
|
1440
|
-
automaton that describes the content expression.
|
|
1441
|
-
*/
|
|
1442
|
-
get edgeCount() {
|
|
1443
|
-
return this.next.length;
|
|
1444
|
-
}
|
|
1445
|
-
/**
|
|
1446
|
-
Get the _n_th outgoing edge from this node in the finite
|
|
1447
|
-
automaton that describes the content expression.
|
|
1448
|
-
*/
|
|
1449
|
-
edge(t) {
|
|
1450
|
-
if (t >= this.next.length)
|
|
1451
|
-
throw new RangeError(`There's no ${t}th edge in this content match`);
|
|
1452
|
-
return this.next[t];
|
|
1453
|
-
}
|
|
1454
|
-
/**
|
|
1455
|
-
@internal
|
|
1456
|
-
*/
|
|
1457
|
-
toString() {
|
|
1458
|
-
let t = [];
|
|
1459
|
-
function e(n) {
|
|
1460
|
-
t.push(n);
|
|
1461
|
-
for (let i = 0; i < n.next.length; i++)
|
|
1462
|
-
t.indexOf(n.next[i].next) == -1 && e(n.next[i].next);
|
|
1463
|
-
}
|
|
1464
|
-
return e(this), t.map((n, i) => {
|
|
1465
|
-
let r = i + (n.validEnd ? "*" : " ") + " ";
|
|
1466
|
-
for (let s = 0; s < n.next.length; s++)
|
|
1467
|
-
r += (s ? ", " : "") + n.next[s].type.name + "->" + t.indexOf(n.next[s].next);
|
|
1468
|
-
return r;
|
|
1469
|
-
}).join(`
|
|
1470
|
-
`);
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
w.empty = new w(!0);
|
|
1474
|
-
class kt {
|
|
1475
|
-
constructor(t, e) {
|
|
1476
|
-
this.string = t, this.nodeTypes = e, this.inline = null, this.pos = 0, this.tokens = t.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
|
|
1477
|
-
}
|
|
1478
|
-
get next() {
|
|
1479
|
-
return this.tokens[this.pos];
|
|
1480
|
-
}
|
|
1481
|
-
eat(t) {
|
|
1482
|
-
return this.next == t && (this.pos++ || !0);
|
|
1483
|
-
}
|
|
1484
|
-
err(t) {
|
|
1485
|
-
throw new SyntaxError(t + " (in content expression '" + this.string + "')");
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
function rt(l) {
|
|
1489
|
-
let t = [];
|
|
1490
|
-
do
|
|
1491
|
-
t.push(St(l));
|
|
1492
|
-
while (l.eat("|"));
|
|
1493
|
-
return t.length == 1 ? t[0] : { type: "choice", exprs: t };
|
|
1494
|
-
}
|
|
1495
|
-
function St(l) {
|
|
1496
|
-
let t = [];
|
|
1497
|
-
do
|
|
1498
|
-
t.push(Et(l));
|
|
1499
|
-
while (l.next && l.next != ")" && l.next != "|");
|
|
1500
|
-
return t.length == 1 ? t[0] : { type: "seq", exprs: t };
|
|
1501
|
-
}
|
|
1502
|
-
function Et(l) {
|
|
1503
|
-
let t = bt(l);
|
|
1504
|
-
for (; ; )
|
|
1505
|
-
if (l.eat("+"))
|
|
1506
|
-
t = { type: "plus", expr: t };
|
|
1507
|
-
else if (l.eat("*"))
|
|
1508
|
-
t = { type: "star", expr: t };
|
|
1509
|
-
else if (l.eat("?"))
|
|
1510
|
-
t = { type: "opt", expr: t };
|
|
1511
|
-
else if (l.eat("{"))
|
|
1512
|
-
t = Ct(l, t);
|
|
1513
|
-
else
|
|
1514
|
-
break;
|
|
1515
|
-
return t;
|
|
1516
|
-
}
|
|
1517
|
-
function W(l) {
|
|
1518
|
-
/\D/.test(l.next) && l.err("Expected number, got '" + l.next + "'");
|
|
1519
|
-
let t = Number(l.next);
|
|
1520
|
-
return l.pos++, t;
|
|
1521
|
-
}
|
|
1522
|
-
function Ct(l, t) {
|
|
1523
|
-
let e = W(l), n = e;
|
|
1524
|
-
return l.eat(",") && (l.next != "}" ? n = W(l) : n = -1), l.eat("}") || l.err("Unclosed braced range"), { type: "range", min: e, max: n, expr: t };
|
|
1525
|
-
}
|
|
1526
|
-
function Ot(l, t) {
|
|
1527
|
-
let e = l.nodeTypes, n = e[t];
|
|
1528
|
-
if (n)
|
|
1529
|
-
return [n];
|
|
1530
|
-
let i = [];
|
|
1531
|
-
for (let r in e) {
|
|
1532
|
-
let s = e[r];
|
|
1533
|
-
s.isInGroup(t) && i.push(s);
|
|
1534
|
-
}
|
|
1535
|
-
return i.length == 0 && l.err("No node type or group '" + t + "' found"), i;
|
|
1536
|
-
}
|
|
1537
|
-
function bt(l) {
|
|
1538
|
-
if (l.eat("(")) {
|
|
1539
|
-
let t = rt(l);
|
|
1540
|
-
return l.eat(")") || l.err("Missing closing paren"), t;
|
|
1541
|
-
} else if (/\W/.test(l.next))
|
|
1542
|
-
l.err("Unexpected token '" + l.next + "'");
|
|
1543
|
-
else {
|
|
1544
|
-
let t = Ot(l, l.next).map((e) => (l.inline == null ? l.inline = e.isInline : l.inline != e.isInline && l.err("Mixing inline and block content"), { type: "name", value: e }));
|
|
1545
|
-
return l.pos++, t.length == 1 ? t[0] : { type: "choice", exprs: t };
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
function Tt(l) {
|
|
1549
|
-
let t = [[]];
|
|
1550
|
-
return i(r(l, 0), e()), t;
|
|
1551
|
-
function e() {
|
|
1552
|
-
return t.push([]) - 1;
|
|
1553
|
-
}
|
|
1554
|
-
function n(s, o, h) {
|
|
1555
|
-
let a = { term: h, to: o };
|
|
1556
|
-
return t[s].push(a), a;
|
|
1557
|
-
}
|
|
1558
|
-
function i(s, o) {
|
|
1559
|
-
s.forEach((h) => h.to = o);
|
|
1560
|
-
}
|
|
1561
|
-
function r(s, o) {
|
|
1562
|
-
if (s.type == "choice")
|
|
1563
|
-
return s.exprs.reduce((h, a) => h.concat(r(a, o)), []);
|
|
1564
|
-
if (s.type == "seq")
|
|
1565
|
-
for (let h = 0; ; h++) {
|
|
1566
|
-
let a = r(s.exprs[h], o);
|
|
1567
|
-
if (h == s.exprs.length - 1)
|
|
1568
|
-
return a;
|
|
1569
|
-
i(a, o = e());
|
|
1570
|
-
}
|
|
1571
|
-
else if (s.type == "star") {
|
|
1572
|
-
let h = e();
|
|
1573
|
-
return n(o, h), i(r(s.expr, h), h), [n(h)];
|
|
1574
|
-
} else if (s.type == "plus") {
|
|
1575
|
-
let h = e();
|
|
1576
|
-
return i(r(s.expr, o), h), i(r(s.expr, h), h), [n(h)];
|
|
1577
|
-
} else {
|
|
1578
|
-
if (s.type == "opt")
|
|
1579
|
-
return [n(o)].concat(r(s.expr, o));
|
|
1580
|
-
if (s.type == "range") {
|
|
1581
|
-
let h = o;
|
|
1582
|
-
for (let a = 0; a < s.min; a++) {
|
|
1583
|
-
let f = e();
|
|
1584
|
-
i(r(s.expr, h), f), h = f;
|
|
1585
|
-
}
|
|
1586
|
-
if (s.max == -1)
|
|
1587
|
-
i(r(s.expr, h), h);
|
|
1588
|
-
else
|
|
1589
|
-
for (let a = s.min; a < s.max; a++) {
|
|
1590
|
-
let f = e();
|
|
1591
|
-
n(h, f), i(r(s.expr, h), f), h = f;
|
|
1592
|
-
}
|
|
1593
|
-
return [n(h)];
|
|
1594
|
-
} else {
|
|
1595
|
-
if (s.type == "name")
|
|
1596
|
-
return [n(o, void 0, s.value)];
|
|
1597
|
-
throw new Error("Unknown expr type");
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
function st(l, t) {
|
|
1603
|
-
return t - l;
|
|
1604
|
-
}
|
|
1605
|
-
function j(l, t) {
|
|
1606
|
-
let e = [];
|
|
1607
|
-
return n(t), e.sort(st);
|
|
1608
|
-
function n(i) {
|
|
1609
|
-
let r = l[i];
|
|
1610
|
-
if (r.length == 1 && !r[0].term)
|
|
1611
|
-
return n(r[0].to);
|
|
1612
|
-
e.push(i);
|
|
1613
|
-
for (let s = 0; s < r.length; s++) {
|
|
1614
|
-
let { term: o, to: h } = r[s];
|
|
1615
|
-
!o && e.indexOf(h) == -1 && n(h);
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
function Mt(l) {
|
|
1620
|
-
let t = /* @__PURE__ */ Object.create(null);
|
|
1621
|
-
return e(j(l, 0));
|
|
1622
|
-
function e(n) {
|
|
1623
|
-
let i = [];
|
|
1624
|
-
n.forEach((s) => {
|
|
1625
|
-
l[s].forEach(({ term: o, to: h }) => {
|
|
1626
|
-
if (!o)
|
|
1627
|
-
return;
|
|
1628
|
-
let a;
|
|
1629
|
-
for (let f = 0; f < i.length; f++)
|
|
1630
|
-
i[f][0] == o && (a = i[f][1]);
|
|
1631
|
-
j(l, h).forEach((f) => {
|
|
1632
|
-
a || i.push([o, a = []]), a.indexOf(f) == -1 && a.push(f);
|
|
1633
|
-
});
|
|
1634
|
-
});
|
|
1635
|
-
});
|
|
1636
|
-
let r = t[n.join(",")] = new w(n.indexOf(l.length - 1) > -1);
|
|
1637
|
-
for (let s = 0; s < i.length; s++) {
|
|
1638
|
-
let o = i[s][1].sort(st);
|
|
1639
|
-
r.next.push({ type: i[s][0], next: t[o.join(",")] || e(o) });
|
|
1640
|
-
}
|
|
1641
|
-
return r;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
function At(l, t) {
|
|
1645
|
-
for (let e = 0, n = [l]; e < n.length; e++) {
|
|
1646
|
-
let i = n[e], r = !i.validEnd, s = [];
|
|
1647
|
-
for (let o = 0; o < i.next.length; o++) {
|
|
1648
|
-
let { type: h, next: a } = i.next[o];
|
|
1649
|
-
s.push(h.name), r && !(h.isText || h.hasRequiredAttrs()) && (r = !1), n.indexOf(a) == -1 && n.push(a);
|
|
1650
|
-
}
|
|
1651
|
-
r && t.err("Only non-generatable nodes (" + s.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
function lt(l) {
|
|
1655
|
-
let t = /* @__PURE__ */ Object.create(null);
|
|
1656
|
-
for (let e in l) {
|
|
1657
|
-
let n = l[e];
|
|
1658
|
-
if (!n.hasDefault)
|
|
1659
|
-
return null;
|
|
1660
|
-
t[e] = n.default;
|
|
1661
|
-
}
|
|
1662
|
-
return t;
|
|
1663
|
-
}
|
|
1664
|
-
function ot(l, t) {
|
|
1665
|
-
let e = /* @__PURE__ */ Object.create(null);
|
|
1666
|
-
for (let n in l) {
|
|
1667
|
-
let i = t && t[n];
|
|
1668
|
-
if (i === void 0) {
|
|
1669
|
-
let r = l[n];
|
|
1670
|
-
if (r.hasDefault)
|
|
1671
|
-
i = r.default;
|
|
1672
|
-
else
|
|
1673
|
-
throw new RangeError("No value supplied for attribute " + n);
|
|
1674
|
-
}
|
|
1675
|
-
e[n] = i;
|
|
1676
|
-
}
|
|
1677
|
-
return e;
|
|
1678
|
-
}
|
|
1679
|
-
function ht(l, t, e, n) {
|
|
1680
|
-
for (let i in t)
|
|
1681
|
-
if (!(i in l))
|
|
1682
|
-
throw new RangeError(`Unsupported attribute ${i} for ${e} of type ${i}`);
|
|
1683
|
-
for (let i in l) {
|
|
1684
|
-
let r = l[i];
|
|
1685
|
-
r.validate && r.validate(t[i]);
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
function at(l, t) {
|
|
1689
|
-
let e = /* @__PURE__ */ Object.create(null);
|
|
1690
|
-
if (t)
|
|
1691
|
-
for (let n in t)
|
|
1692
|
-
e[n] = new Nt(l, n, t[n]);
|
|
1693
|
-
return e;
|
|
1694
|
-
}
|
|
1695
|
-
class N {
|
|
1696
|
-
/**
|
|
1697
|
-
@internal
|
|
1698
|
-
*/
|
|
1699
|
-
constructor(t, e, n) {
|
|
1700
|
-
this.name = t, this.schema = e, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = at(t, n.attrs), this.defaultAttrs = lt(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || t == "text"), this.isText = t == "text";
|
|
1701
|
-
}
|
|
1702
|
-
/**
|
|
1703
|
-
True if this is an inline type.
|
|
1704
|
-
*/
|
|
1705
|
-
get isInline() {
|
|
1706
|
-
return !this.isBlock;
|
|
1707
|
-
}
|
|
1708
|
-
/**
|
|
1709
|
-
True if this is a textblock type, a block that contains inline
|
|
1710
|
-
content.
|
|
1711
|
-
*/
|
|
1712
|
-
get isTextblock() {
|
|
1713
|
-
return this.isBlock && this.inlineContent;
|
|
1714
|
-
}
|
|
1715
|
-
/**
|
|
1716
|
-
True for node types that allow no content.
|
|
1717
|
-
*/
|
|
1718
|
-
get isLeaf() {
|
|
1719
|
-
return this.contentMatch == w.empty;
|
|
1720
|
-
}
|
|
1721
|
-
/**
|
|
1722
|
-
True when this node is an atom, i.e. when it does not have
|
|
1723
|
-
directly editable content.
|
|
1724
|
-
*/
|
|
1725
|
-
get isAtom() {
|
|
1726
|
-
return this.isLeaf || !!this.spec.atom;
|
|
1727
|
-
}
|
|
1728
|
-
/**
|
|
1729
|
-
Return true when this node type is part of the given
|
|
1730
|
-
[group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
|
|
1731
|
-
*/
|
|
1732
|
-
isInGroup(t) {
|
|
1733
|
-
return this.groups.indexOf(t) > -1;
|
|
1734
|
-
}
|
|
1735
|
-
/**
|
|
1736
|
-
The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
|
|
1737
|
-
*/
|
|
1738
|
-
get whitespace() {
|
|
1739
|
-
return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
|
|
1740
|
-
}
|
|
1741
|
-
/**
|
|
1742
|
-
Tells you whether this node type has any required attributes.
|
|
1743
|
-
*/
|
|
1744
|
-
hasRequiredAttrs() {
|
|
1745
|
-
for (let t in this.attrs)
|
|
1746
|
-
if (this.attrs[t].isRequired)
|
|
1747
|
-
return !0;
|
|
1748
|
-
return !1;
|
|
1749
|
-
}
|
|
1750
|
-
/**
|
|
1751
|
-
Indicates whether this node allows some of the same content as
|
|
1752
|
-
the given node type.
|
|
1753
|
-
*/
|
|
1754
|
-
compatibleContent(t) {
|
|
1755
|
-
return this == t || this.contentMatch.compatible(t.contentMatch);
|
|
1756
|
-
}
|
|
1757
|
-
/**
|
|
1758
|
-
@internal
|
|
1759
|
-
*/
|
|
1760
|
-
computeAttrs(t) {
|
|
1761
|
-
return !t && this.defaultAttrs ? this.defaultAttrs : ot(this.attrs, t);
|
|
1762
|
-
}
|
|
1763
|
-
/**
|
|
1764
|
-
Create a `Node` of this type. The given attributes are
|
|
1765
|
-
checked and defaulted (you can pass `null` to use the type's
|
|
1766
|
-
defaults entirely, if no required attributes exist). `content`
|
|
1767
|
-
may be a `Fragment`, a node, an array of nodes, or
|
|
1768
|
-
`null`. Similarly `marks` may be `null` to default to the empty
|
|
1769
|
-
set of marks.
|
|
1770
|
-
*/
|
|
1771
|
-
create(t = null, e, n) {
|
|
1772
|
-
if (this.isText)
|
|
1773
|
-
throw new Error("NodeType.create can't construct text nodes");
|
|
1774
|
-
return new g(this, this.computeAttrs(t), c.from(e), u.setFrom(n));
|
|
1775
|
-
}
|
|
1776
|
-
/**
|
|
1777
|
-
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
1778
|
-
against the node type's content restrictions, and throw an error
|
|
1779
|
-
if it doesn't match.
|
|
1780
|
-
*/
|
|
1781
|
-
createChecked(t = null, e, n) {
|
|
1782
|
-
return e = c.from(e), this.checkContent(e), new g(this, this.computeAttrs(t), e, u.setFrom(n));
|
|
1783
|
-
}
|
|
1784
|
-
/**
|
|
1785
|
-
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
1786
|
-
necessary to add nodes to the start or end of the given fragment
|
|
1787
|
-
to make it fit the node. If no fitting wrapping can be found,
|
|
1788
|
-
return null. Note that, due to the fact that required nodes can
|
|
1789
|
-
always be created, this will always succeed if you pass null or
|
|
1790
|
-
`Fragment.empty` as content.
|
|
1791
|
-
*/
|
|
1792
|
-
createAndFill(t = null, e, n) {
|
|
1793
|
-
if (t = this.computeAttrs(t), e = c.from(e), e.size) {
|
|
1794
|
-
let s = this.contentMatch.fillBefore(e);
|
|
1795
|
-
if (!s)
|
|
1796
|
-
return null;
|
|
1797
|
-
e = s.append(e);
|
|
1798
|
-
}
|
|
1799
|
-
let i = this.contentMatch.matchFragment(e), r = i && i.fillBefore(c.empty, !0);
|
|
1800
|
-
return r ? new g(this, t, e.append(r), u.setFrom(n)) : null;
|
|
1801
|
-
}
|
|
1802
|
-
/**
|
|
1803
|
-
Returns true if the given fragment is valid content for this node
|
|
1804
|
-
type.
|
|
1805
|
-
*/
|
|
1806
|
-
validContent(t) {
|
|
1807
|
-
let e = this.contentMatch.matchFragment(t);
|
|
1808
|
-
if (!e || !e.validEnd)
|
|
1809
|
-
return !1;
|
|
1810
|
-
for (let n = 0; n < t.childCount; n++)
|
|
1811
|
-
if (!this.allowsMarks(t.child(n).marks))
|
|
1812
|
-
return !1;
|
|
1813
|
-
return !0;
|
|
1814
|
-
}
|
|
1815
|
-
/**
|
|
1816
|
-
Throws a RangeError if the given fragment is not valid content for this
|
|
1817
|
-
node type.
|
|
1818
|
-
@internal
|
|
1819
|
-
*/
|
|
1820
|
-
checkContent(t) {
|
|
1821
|
-
if (!this.validContent(t))
|
|
1822
|
-
throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0, 50)}`);
|
|
1823
|
-
}
|
|
1824
|
-
/**
|
|
1825
|
-
@internal
|
|
1826
|
-
*/
|
|
1827
|
-
checkAttrs(t) {
|
|
1828
|
-
ht(this.attrs, t, "node", this.name);
|
|
1829
|
-
}
|
|
1830
|
-
/**
|
|
1831
|
-
Check whether the given mark type is allowed in this node.
|
|
1832
|
-
*/
|
|
1833
|
-
allowsMarkType(t) {
|
|
1834
|
-
return this.markSet == null || this.markSet.indexOf(t) > -1;
|
|
1835
|
-
}
|
|
1836
|
-
/**
|
|
1837
|
-
Test whether the given set of marks are allowed in this node.
|
|
1838
|
-
*/
|
|
1839
|
-
allowsMarks(t) {
|
|
1840
|
-
if (this.markSet == null)
|
|
1841
|
-
return !0;
|
|
1842
|
-
for (let e = 0; e < t.length; e++)
|
|
1843
|
-
if (!this.allowsMarkType(t[e].type))
|
|
1844
|
-
return !1;
|
|
1845
|
-
return !0;
|
|
1846
|
-
}
|
|
1847
|
-
/**
|
|
1848
|
-
Removes the marks that are not allowed in this node from the given set.
|
|
1849
|
-
*/
|
|
1850
|
-
allowedMarks(t) {
|
|
1851
|
-
if (this.markSet == null)
|
|
1852
|
-
return t;
|
|
1853
|
-
let e;
|
|
1854
|
-
for (let n = 0; n < t.length; n++)
|
|
1855
|
-
this.allowsMarkType(t[n].type) ? e && e.push(t[n]) : e || (e = t.slice(0, n));
|
|
1856
|
-
return e ? e.length ? e : u.none : t;
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
@internal
|
|
1860
|
-
*/
|
|
1861
|
-
static compile(t, e) {
|
|
1862
|
-
let n = /* @__PURE__ */ Object.create(null);
|
|
1863
|
-
t.forEach((r, s) => n[r] = new N(r, e, s));
|
|
1864
|
-
let i = e.spec.topNode || "doc";
|
|
1865
|
-
if (!n[i])
|
|
1866
|
-
throw new RangeError("Schema is missing its top node type ('" + i + "')");
|
|
1867
|
-
if (!n.text)
|
|
1868
|
-
throw new RangeError("Every schema needs a 'text' type");
|
|
1869
|
-
for (let r in n.text.attrs)
|
|
1870
|
-
throw new RangeError("The text node type should not have attributes");
|
|
1871
|
-
return n;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
function zt(l, t, e) {
|
|
1875
|
-
let n = e.split("|");
|
|
1876
|
-
return (i) => {
|
|
1877
|
-
let r = i === null ? "null" : typeof i;
|
|
1878
|
-
if (n.indexOf(r) < 0)
|
|
1879
|
-
throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${l}, got ${r}`);
|
|
1880
|
-
};
|
|
1881
|
-
}
|
|
1882
|
-
class Nt {
|
|
1883
|
-
constructor(t, e, n) {
|
|
1884
|
-
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? zt(t, e, n.validate) : n.validate;
|
|
1885
|
-
}
|
|
1886
|
-
get isRequired() {
|
|
1887
|
-
return !this.hasDefault;
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
class F {
|
|
1891
|
-
/**
|
|
1892
|
-
@internal
|
|
1893
|
-
*/
|
|
1894
|
-
constructor(t, e, n, i) {
|
|
1895
|
-
this.name = t, this.rank = e, this.schema = n, this.spec = i, this.attrs = at(t, i.attrs), this.excluded = null;
|
|
1896
|
-
let r = lt(this.attrs);
|
|
1897
|
-
this.instance = r ? new u(this, r) : null;
|
|
1898
|
-
}
|
|
1899
|
-
/**
|
|
1900
|
-
Create a mark of this type. `attrs` may be `null` or an object
|
|
1901
|
-
containing only some of the mark's attributes. The others, if
|
|
1902
|
-
they have defaults, will be added.
|
|
1903
|
-
*/
|
|
1904
|
-
create(t = null) {
|
|
1905
|
-
return !t && this.instance ? this.instance : new u(this, ot(this.attrs, t));
|
|
1906
|
-
}
|
|
1907
|
-
/**
|
|
1908
|
-
@internal
|
|
1909
|
-
*/
|
|
1910
|
-
static compile(t, e) {
|
|
1911
|
-
let n = /* @__PURE__ */ Object.create(null), i = 0;
|
|
1912
|
-
return t.forEach((r, s) => n[r] = new F(r, i++, e, s)), n;
|
|
1913
|
-
}
|
|
1914
|
-
/**
|
|
1915
|
-
When there is a mark of this type in the given set, a new set
|
|
1916
|
-
without it is returned. Otherwise, the input set is returned.
|
|
1917
|
-
*/
|
|
1918
|
-
removeFromSet(t) {
|
|
1919
|
-
for (var e = 0; e < t.length; e++)
|
|
1920
|
-
t[e].type == this && (t = t.slice(0, e).concat(t.slice(e + 1)), e--);
|
|
1921
|
-
return t;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
Tests whether there is a mark of this type in the given set.
|
|
1925
|
-
*/
|
|
1926
|
-
isInSet(t) {
|
|
1927
|
-
for (let e = 0; e < t.length; e++)
|
|
1928
|
-
if (t[e].type == this)
|
|
1929
|
-
return t[e];
|
|
1930
|
-
}
|
|
1931
|
-
/**
|
|
1932
|
-
@internal
|
|
1933
|
-
*/
|
|
1934
|
-
checkAttrs(t) {
|
|
1935
|
-
ht(this.attrs, t, "mark", this.name);
|
|
1936
|
-
}
|
|
1937
|
-
/**
|
|
1938
|
-
Queries whether a given mark type is
|
|
1939
|
-
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
1940
|
-
*/
|
|
1941
|
-
excludes(t) {
|
|
1942
|
-
return this.excluded.indexOf(t) > -1;
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
class qt {
|
|
1946
|
-
/**
|
|
1947
|
-
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
1948
|
-
*/
|
|
1949
|
-
constructor(t) {
|
|
1950
|
-
this.linebreakReplacement = null, this.cached = /* @__PURE__ */ Object.create(null);
|
|
1951
|
-
let e = this.spec = {};
|
|
1952
|
-
for (let i in t)
|
|
1953
|
-
e[i] = t[i];
|
|
1954
|
-
e.nodes = q.from(t.nodes), e.marks = q.from(t.marks || {}), this.nodes = N.compile(this.spec.nodes, this), this.marks = F.compile(this.spec.marks, this);
|
|
1955
|
-
let n = /* @__PURE__ */ Object.create(null);
|
|
1956
|
-
for (let i in this.nodes) {
|
|
1957
|
-
if (i in this.marks)
|
|
1958
|
-
throw new RangeError(i + " can not be both a node and a mark");
|
|
1959
|
-
let r = this.nodes[i], s = r.spec.content || "", o = r.spec.marks;
|
|
1960
|
-
if (r.contentMatch = n[s] || (n[s] = w.parse(s, this.nodes)), r.inlineContent = r.contentMatch.inlineContent, r.spec.linebreakReplacement) {
|
|
1961
|
-
if (this.linebreakReplacement)
|
|
1962
|
-
throw new RangeError("Multiple linebreak nodes defined");
|
|
1963
|
-
if (!r.isInline || !r.isLeaf)
|
|
1964
|
-
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
1965
|
-
this.linebreakReplacement = r;
|
|
1966
|
-
}
|
|
1967
|
-
r.markSet = o == "_" ? null : o ? U(this, o.split(" ")) : o == "" || !r.inlineContent ? [] : null;
|
|
1968
|
-
}
|
|
1969
|
-
for (let i in this.marks) {
|
|
1970
|
-
let r = this.marks[i], s = r.spec.excludes;
|
|
1971
|
-
r.excluded = s == null ? [r] : s == "" ? [] : U(this, s.split(" "));
|
|
1972
|
-
}
|
|
1973
|
-
this.nodeFromJSON = (i) => g.fromJSON(this, i), this.markFromJSON = (i) => u.fromJSON(this, i), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
|
|
1974
|
-
}
|
|
1975
|
-
/**
|
|
1976
|
-
Create a node in this schema. The `type` may be a string or a
|
|
1977
|
-
`NodeType` instance. Attributes will be extended with defaults,
|
|
1978
|
-
`content` may be a `Fragment`, `null`, a `Node`, or an array of
|
|
1979
|
-
nodes.
|
|
1980
|
-
*/
|
|
1981
|
-
node(t, e = null, n, i) {
|
|
1982
|
-
if (typeof t == "string")
|
|
1983
|
-
t = this.nodeType(t);
|
|
1984
|
-
else if (t instanceof N) {
|
|
1985
|
-
if (t.schema != this)
|
|
1986
|
-
throw new RangeError("Node type from different schema used (" + t.name + ")");
|
|
1987
|
-
} else throw new RangeError("Invalid node type: " + t);
|
|
1988
|
-
return t.createChecked(e, n, i);
|
|
1989
|
-
}
|
|
1990
|
-
/**
|
|
1991
|
-
Create a text node in the schema. Empty text nodes are not
|
|
1992
|
-
allowed.
|
|
1993
|
-
*/
|
|
1994
|
-
text(t, e) {
|
|
1995
|
-
let n = this.nodes.text;
|
|
1996
|
-
return new z(n, n.defaultAttrs, t, u.setFrom(e));
|
|
1997
|
-
}
|
|
1998
|
-
/**
|
|
1999
|
-
Create a mark with the given type and attributes.
|
|
2000
|
-
*/
|
|
2001
|
-
mark(t, e) {
|
|
2002
|
-
return typeof t == "string" && (t = this.marks[t]), t.create(e);
|
|
2003
|
-
}
|
|
2004
|
-
/**
|
|
2005
|
-
@internal
|
|
2006
|
-
*/
|
|
2007
|
-
nodeType(t) {
|
|
2008
|
-
let e = this.nodes[t];
|
|
2009
|
-
if (!e)
|
|
2010
|
-
throw new RangeError("Unknown node type: " + t);
|
|
2011
|
-
return e;
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
function U(l, t) {
|
|
2015
|
-
let e = [];
|
|
2016
|
-
for (let n = 0; n < t.length; n++) {
|
|
2017
|
-
let i = t[n], r = l.marks[i], s = r;
|
|
2018
|
-
if (r)
|
|
2019
|
-
e.push(r);
|
|
2020
|
-
else
|
|
2021
|
-
for (let o in l.marks) {
|
|
2022
|
-
let h = l.marks[o];
|
|
2023
|
-
(i == "_" || h.spec.group && h.spec.group.split(" ").indexOf(i) > -1) && e.push(s = h);
|
|
2024
|
-
}
|
|
2025
|
-
if (!s)
|
|
2026
|
-
throw new SyntaxError("Unknown mark type: '" + t[n] + "'");
|
|
2027
|
-
}
|
|
2028
|
-
return e;
|
|
2029
|
-
}
|
|
2030
|
-
function Rt(l) {
|
|
2031
|
-
return l.tag != null;
|
|
2032
|
-
}
|
|
2033
|
-
function vt(l) {
|
|
2034
|
-
return l.style != null;
|
|
2035
|
-
}
|
|
2036
|
-
class P {
|
|
2037
|
-
/**
|
|
2038
|
-
Create a parser that targets the given schema, using the given
|
|
2039
|
-
parsing rules.
|
|
2040
|
-
*/
|
|
2041
|
-
constructor(t, e) {
|
|
2042
|
-
this.schema = t, this.rules = e, this.tags = [], this.styles = [];
|
|
2043
|
-
let n = this.matchedStyles = [];
|
|
2044
|
-
e.forEach((i) => {
|
|
2045
|
-
if (Rt(i))
|
|
2046
|
-
this.tags.push(i);
|
|
2047
|
-
else if (vt(i)) {
|
|
2048
|
-
let r = /[^=]*/.exec(i.style)[0];
|
|
2049
|
-
n.indexOf(r) < 0 && n.push(r), this.styles.push(i);
|
|
2050
|
-
}
|
|
2051
|
-
}), this.normalizeLists = !this.tags.some((i) => {
|
|
2052
|
-
if (!/^(ul|ol)\b/.test(i.tag) || !i.node)
|
|
2053
|
-
return !1;
|
|
2054
|
-
let r = t.nodes[i.node];
|
|
2055
|
-
return r.contentMatch.matchType(r);
|
|
2056
|
-
});
|
|
2057
|
-
}
|
|
2058
|
-
/**
|
|
2059
|
-
Parse a document from the content of a DOM node.
|
|
2060
|
-
*/
|
|
2061
|
-
parse(t, e = {}) {
|
|
2062
|
-
let n = new G(this, e, !1);
|
|
2063
|
-
return n.addAll(t, u.none, e.from, e.to), n.finish();
|
|
2064
|
-
}
|
|
2065
|
-
/**
|
|
2066
|
-
Parses the content of the given DOM node, like
|
|
2067
|
-
[`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
|
|
2068
|
-
options. But unlike that method, which produces a whole node,
|
|
2069
|
-
this one returns a slice that is open at the sides, meaning that
|
|
2070
|
-
the schema constraints aren't applied to the start of nodes to
|
|
2071
|
-
the left of the input and the end of nodes at the end.
|
|
2072
|
-
*/
|
|
2073
|
-
parseSlice(t, e = {}) {
|
|
2074
|
-
let n = new G(this, e, !0);
|
|
2075
|
-
return n.addAll(t, u.none, e.from, e.to), d.maxOpen(n.finish());
|
|
2076
|
-
}
|
|
2077
|
-
/**
|
|
2078
|
-
@internal
|
|
2079
|
-
*/
|
|
2080
|
-
matchTag(t, e, n) {
|
|
2081
|
-
for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
|
|
2082
|
-
let r = this.tags[i];
|
|
2083
|
-
if (Pt(t, r.tag) && (r.namespace === void 0 || t.namespaceURI == r.namespace) && (!r.context || e.matchesContext(r.context))) {
|
|
2084
|
-
if (r.getAttrs) {
|
|
2085
|
-
let s = r.getAttrs(t);
|
|
2086
|
-
if (s === !1)
|
|
2087
|
-
continue;
|
|
2088
|
-
r.attrs = s || void 0;
|
|
2089
|
-
}
|
|
2090
|
-
return r;
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
/**
|
|
2095
|
-
@internal
|
|
2096
|
-
*/
|
|
2097
|
-
matchStyle(t, e, n, i) {
|
|
2098
|
-
for (let r = i ? this.styles.indexOf(i) + 1 : 0; r < this.styles.length; r++) {
|
|
2099
|
-
let s = this.styles[r], o = s.style;
|
|
2100
|
-
if (!(o.indexOf(t) != 0 || s.context && !n.matchesContext(s.context) || // Test that the style string either precisely matches the prop,
|
|
2101
|
-
// or has an '=' sign after the prop, followed by the given
|
|
2102
|
-
// value.
|
|
2103
|
-
o.length > t.length && (o.charCodeAt(t.length) != 61 || o.slice(t.length + 1) != e))) {
|
|
2104
|
-
if (s.getAttrs) {
|
|
2105
|
-
let h = s.getAttrs(e);
|
|
2106
|
-
if (h === !1)
|
|
2107
|
-
continue;
|
|
2108
|
-
s.attrs = h || void 0;
|
|
2109
|
-
}
|
|
2110
|
-
return s;
|
|
2111
|
-
}
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
@internal
|
|
2116
|
-
*/
|
|
2117
|
-
static schemaRules(t) {
|
|
2118
|
-
let e = [];
|
|
2119
|
-
function n(i) {
|
|
2120
|
-
let r = i.priority == null ? 50 : i.priority, s = 0;
|
|
2121
|
-
for (; s < e.length; s++) {
|
|
2122
|
-
let o = e[s];
|
|
2123
|
-
if ((o.priority == null ? 50 : o.priority) < r)
|
|
2124
|
-
break;
|
|
2125
|
-
}
|
|
2126
|
-
e.splice(s, 0, i);
|
|
2127
|
-
}
|
|
2128
|
-
for (let i in t.marks) {
|
|
2129
|
-
let r = t.marks[i].spec.parseDOM;
|
|
2130
|
-
r && r.forEach((s) => {
|
|
2131
|
-
n(s = H(s)), s.mark || s.ignore || s.clearMark || (s.mark = i);
|
|
2132
|
-
});
|
|
2133
|
-
}
|
|
2134
|
-
for (let i in t.nodes) {
|
|
2135
|
-
let r = t.nodes[i].spec.parseDOM;
|
|
2136
|
-
r && r.forEach((s) => {
|
|
2137
|
-
n(s = H(s)), s.node || s.ignore || s.mark || (s.node = i);
|
|
2138
|
-
});
|
|
2139
|
-
}
|
|
2140
|
-
return e;
|
|
2141
|
-
}
|
|
2142
|
-
/**
|
|
2143
|
-
Construct a DOM parser using the parsing rules listed in a
|
|
2144
|
-
schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
|
|
2145
|
-
[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
|
|
2146
|
-
*/
|
|
2147
|
-
static fromSchema(t) {
|
|
2148
|
-
return t.cached.domParser || (t.cached.domParser = new P(t, P.schemaRules(t)));
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
const ft = {
|
|
2152
|
-
address: !0,
|
|
2153
|
-
article: !0,
|
|
2154
|
-
aside: !0,
|
|
2155
|
-
blockquote: !0,
|
|
2156
|
-
canvas: !0,
|
|
2157
|
-
dd: !0,
|
|
2158
|
-
div: !0,
|
|
2159
|
-
dl: !0,
|
|
2160
|
-
fieldset: !0,
|
|
2161
|
-
figcaption: !0,
|
|
2162
|
-
figure: !0,
|
|
2163
|
-
footer: !0,
|
|
2164
|
-
form: !0,
|
|
2165
|
-
h1: !0,
|
|
2166
|
-
h2: !0,
|
|
2167
|
-
h3: !0,
|
|
2168
|
-
h4: !0,
|
|
2169
|
-
h5: !0,
|
|
2170
|
-
h6: !0,
|
|
2171
|
-
header: !0,
|
|
2172
|
-
hgroup: !0,
|
|
2173
|
-
hr: !0,
|
|
2174
|
-
li: !0,
|
|
2175
|
-
noscript: !0,
|
|
2176
|
-
ol: !0,
|
|
2177
|
-
output: !0,
|
|
2178
|
-
p: !0,
|
|
2179
|
-
pre: !0,
|
|
2180
|
-
section: !0,
|
|
2181
|
-
table: !0,
|
|
2182
|
-
tfoot: !0,
|
|
2183
|
-
ul: !0
|
|
2184
|
-
}, It = {
|
|
2185
|
-
head: !0,
|
|
2186
|
-
noscript: !0,
|
|
2187
|
-
object: !0,
|
|
2188
|
-
script: !0,
|
|
2189
|
-
style: !0,
|
|
2190
|
-
title: !0
|
|
2191
|
-
}, ct = { ol: !0, ul: !0 }, C = 1, B = 2, S = 4;
|
|
2192
|
-
function V(l, t, e) {
|
|
2193
|
-
return t != null ? (t ? C : 0) | (t === "full" ? B : 0) : l && l.whitespace == "pre" ? C | B : e & ~S;
|
|
2194
|
-
}
|
|
2195
|
-
class b {
|
|
2196
|
-
constructor(t, e, n, i, r, s) {
|
|
2197
|
-
this.type = t, this.attrs = e, this.marks = n, this.solid = i, this.options = s, this.content = [], this.activeMarks = u.none, this.match = r || (s & S ? null : t.contentMatch);
|
|
2198
|
-
}
|
|
2199
|
-
findWrapping(t) {
|
|
2200
|
-
if (!this.match) {
|
|
2201
|
-
if (!this.type)
|
|
2202
|
-
return [];
|
|
2203
|
-
let e = this.type.contentMatch.fillBefore(c.from(t));
|
|
2204
|
-
if (e)
|
|
2205
|
-
this.match = this.type.contentMatch.matchFragment(e);
|
|
2206
|
-
else {
|
|
2207
|
-
let n = this.type.contentMatch, i;
|
|
2208
|
-
return (i = n.findWrapping(t.type)) ? (this.match = n, i) : null;
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
return this.match.findWrapping(t.type);
|
|
2212
|
-
}
|
|
2213
|
-
finish(t) {
|
|
2214
|
-
if (!(this.options & C)) {
|
|
2215
|
-
let n = this.content[this.content.length - 1], i;
|
|
2216
|
-
if (n && n.isText && (i = /[ \t\r\n\u000c]+$/.exec(n.text))) {
|
|
2217
|
-
let r = n;
|
|
2218
|
-
n.text.length == i[0].length ? this.content.pop() : this.content[this.content.length - 1] = r.withText(r.text.slice(0, r.text.length - i[0].length));
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
let e = c.from(this.content);
|
|
2222
|
-
return !t && this.match && (e = e.append(this.match.fillBefore(c.empty, !0))), this.type ? this.type.create(this.attrs, e, this.marks) : e;
|
|
2223
|
-
}
|
|
2224
|
-
inlineContext(t) {
|
|
2225
|
-
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : t.parentNode && !ft.hasOwnProperty(t.parentNode.nodeName.toLowerCase());
|
|
2226
|
-
}
|
|
2227
|
-
}
|
|
2228
|
-
class G {
|
|
2229
|
-
constructor(t, e, n) {
|
|
2230
|
-
this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2231
|
-
let i = e.topNode, r, s = V(null, e.preserveWhitespace, 0) | (n ? S : 0);
|
|
2232
|
-
i ? r = new b(i.type, i.attrs, u.none, !0, e.topMatch || i.type.contentMatch, s) : n ? r = new b(null, null, u.none, !0, null, s) : r = new b(t.schema.topNodeType, null, u.none, !0, null, s), this.nodes = [r], this.find = e.findPositions, this.needsBlock = !1;
|
|
2233
|
-
}
|
|
2234
|
-
get top() {
|
|
2235
|
-
return this.nodes[this.open];
|
|
2236
|
-
}
|
|
2237
|
-
// Add a DOM node to the content. Text is inserted as text node,
|
|
2238
|
-
// otherwise, the node is passed to `addElement` or, if it has a
|
|
2239
|
-
// `style` attribute, `addElementWithStyles`.
|
|
2240
|
-
addDOM(t, e) {
|
|
2241
|
-
t.nodeType == 3 ? this.addTextNode(t, e) : t.nodeType == 1 && this.addElement(t, e);
|
|
2242
|
-
}
|
|
2243
|
-
addTextNode(t, e) {
|
|
2244
|
-
let n = t.nodeValue, i = this.top, r = i.options & B ? "full" : this.localPreserveWS || (i.options & C) > 0, { schema: s } = this.parser;
|
|
2245
|
-
if (r === "full" || i.inlineContext(t) || /[^ \t\r\n\u000c]/.test(n)) {
|
|
2246
|
-
if (r)
|
|
2247
|
-
if (r === "full")
|
|
2248
|
-
n = n.replace(/\r\n?/g, `
|
|
2249
|
-
`);
|
|
2250
|
-
else if (s.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(s.linebreakReplacement.create())) {
|
|
2251
|
-
let o = n.split(/\r?\n|\r/);
|
|
2252
|
-
for (let h = 0; h < o.length; h++)
|
|
2253
|
-
h && this.insertNode(s.linebreakReplacement.create(), e, !0), o[h] && this.insertNode(s.text(o[h]), e, !/\S/.test(o[h]));
|
|
2254
|
-
n = "";
|
|
2255
|
-
} else
|
|
2256
|
-
n = n.replace(/\r?\n|\r/g, " ");
|
|
2257
|
-
else if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
|
|
2258
|
-
let o = i.content[i.content.length - 1], h = t.previousSibling;
|
|
2259
|
-
(!o || h && h.nodeName == "BR" || o.isText && /[ \t\r\n\u000c]$/.test(o.text)) && (n = n.slice(1));
|
|
2260
|
-
}
|
|
2261
|
-
n && this.insertNode(s.text(n), e, !/\S/.test(n)), this.findInText(t);
|
|
2262
|
-
} else
|
|
2263
|
-
this.findInside(t);
|
|
2264
|
-
}
|
|
2265
|
-
// Try to find a handler for the given tag and use that to parse. If
|
|
2266
|
-
// none is found, the element's content nodes are added directly.
|
|
2267
|
-
addElement(t, e, n) {
|
|
2268
|
-
let i = this.localPreserveWS, r = this.top;
|
|
2269
|
-
(t.tagName == "PRE" || /pre/.test(t.style && t.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
2270
|
-
let s = t.nodeName.toLowerCase(), o;
|
|
2271
|
-
ct.hasOwnProperty(s) && this.parser.normalizeLists && Dt(t);
|
|
2272
|
-
let h = this.options.ruleFromNode && this.options.ruleFromNode(t) || (o = this.parser.matchTag(t, this, n));
|
|
2273
|
-
t: if (h ? h.ignore : It.hasOwnProperty(s))
|
|
2274
|
-
this.findInside(t), this.ignoreFallback(t, e);
|
|
2275
|
-
else if (!h || h.skip || h.closeParent) {
|
|
2276
|
-
h && h.closeParent ? this.open = Math.max(0, this.open - 1) : h && h.skip.nodeType && (t = h.skip);
|
|
2277
|
-
let a, f = this.needsBlock;
|
|
2278
|
-
if (ft.hasOwnProperty(s))
|
|
2279
|
-
r.content.length && r.content[0].isInline && this.open && (this.open--, r = this.top), a = !0, r.type || (this.needsBlock = !0);
|
|
2280
|
-
else if (!t.firstChild) {
|
|
2281
|
-
this.leafFallback(t, e);
|
|
2282
|
-
break t;
|
|
2283
|
-
}
|
|
2284
|
-
let p = h && h.skip ? e : this.readStyles(t, e);
|
|
2285
|
-
p && this.addAll(t, p), a && this.sync(r), this.needsBlock = f;
|
|
2286
|
-
} else {
|
|
2287
|
-
let a = this.readStyles(t, e);
|
|
2288
|
-
a && this.addElementByRule(t, h, a, h.consuming === !1 ? o : void 0);
|
|
2289
|
-
}
|
|
2290
|
-
this.localPreserveWS = i;
|
|
2291
|
-
}
|
|
2292
|
-
// Called for leaf DOM nodes that would otherwise be ignored
|
|
2293
|
-
leafFallback(t, e) {
|
|
2294
|
-
t.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(t.ownerDocument.createTextNode(`
|
|
2295
|
-
`), e);
|
|
2296
|
-
}
|
|
2297
|
-
// Called for ignored nodes
|
|
2298
|
-
ignoreFallback(t, e) {
|
|
2299
|
-
t.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), e, !0);
|
|
2300
|
-
}
|
|
2301
|
-
// Run any style parser associated with the node's styles. Either
|
|
2302
|
-
// return an updated array of marks, or null to indicate some of the
|
|
2303
|
-
// styles had a rule with `ignore` set.
|
|
2304
|
-
readStyles(t, e) {
|
|
2305
|
-
let n = t.style;
|
|
2306
|
-
if (n && n.length)
|
|
2307
|
-
for (let i = 0; i < this.parser.matchedStyles.length; i++) {
|
|
2308
|
-
let r = this.parser.matchedStyles[i], s = n.getPropertyValue(r);
|
|
2309
|
-
if (s)
|
|
2310
|
-
for (let o = void 0; ; ) {
|
|
2311
|
-
let h = this.parser.matchStyle(r, s, this, o);
|
|
2312
|
-
if (!h)
|
|
2313
|
-
break;
|
|
2314
|
-
if (h.ignore)
|
|
2315
|
-
return null;
|
|
2316
|
-
if (h.clearMark ? e = e.filter((a) => !h.clearMark(a)) : e = e.concat(this.parser.schema.marks[h.mark].create(h.attrs)), h.consuming === !1)
|
|
2317
|
-
o = h;
|
|
2318
|
-
else
|
|
2319
|
-
break;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
return e;
|
|
2323
|
-
}
|
|
2324
|
-
// Look up a handler for the given node. If none are found, return
|
|
2325
|
-
// false. Otherwise, apply it, use its return value to drive the way
|
|
2326
|
-
// the node's content is wrapped, and return true.
|
|
2327
|
-
addElementByRule(t, e, n, i) {
|
|
2328
|
-
let r, s;
|
|
2329
|
-
if (e.node)
|
|
2330
|
-
if (s = this.parser.schema.nodes[e.node], s.isLeaf)
|
|
2331
|
-
this.insertNode(s.create(e.attrs), n, t.nodeName == "BR") || this.leafFallback(t, n);
|
|
2332
|
-
else {
|
|
2333
|
-
let h = this.enter(s, e.attrs || null, n, e.preserveWhitespace);
|
|
2334
|
-
h && (r = !0, n = h);
|
|
2335
|
-
}
|
|
2336
|
-
else {
|
|
2337
|
-
let h = this.parser.schema.marks[e.mark];
|
|
2338
|
-
n = n.concat(h.create(e.attrs));
|
|
2339
|
-
}
|
|
2340
|
-
let o = this.top;
|
|
2341
|
-
if (s && s.isLeaf)
|
|
2342
|
-
this.findInside(t);
|
|
2343
|
-
else if (i)
|
|
2344
|
-
this.addElement(t, n, i);
|
|
2345
|
-
else if (e.getContent)
|
|
2346
|
-
this.findInside(t), e.getContent(t, this.parser.schema).forEach((h) => this.insertNode(h, n, !1));
|
|
2347
|
-
else {
|
|
2348
|
-
let h = t;
|
|
2349
|
-
typeof e.contentElement == "string" ? h = t.querySelector(e.contentElement) : typeof e.contentElement == "function" ? h = e.contentElement(t) : e.contentElement && (h = e.contentElement), this.findAround(t, h, !0), this.addAll(h, n), this.findAround(t, h, !1);
|
|
2350
|
-
}
|
|
2351
|
-
r && this.sync(o) && this.open--;
|
|
2352
|
-
}
|
|
2353
|
-
// Add all child nodes between `startIndex` and `endIndex` (or the
|
|
2354
|
-
// whole node, if not given). If `sync` is passed, use it to
|
|
2355
|
-
// synchronize after every block element.
|
|
2356
|
-
addAll(t, e, n, i) {
|
|
2357
|
-
let r = n || 0;
|
|
2358
|
-
for (let s = n ? t.childNodes[n] : t.firstChild, o = i == null ? null : t.childNodes[i]; s != o; s = s.nextSibling, ++r)
|
|
2359
|
-
this.findAtPoint(t, r), this.addDOM(s, e);
|
|
2360
|
-
this.findAtPoint(t, r);
|
|
2361
|
-
}
|
|
2362
|
-
// Try to find a way to fit the given node type into the current
|
|
2363
|
-
// context. May add intermediate wrappers and/or leave non-solid
|
|
2364
|
-
// nodes that we're in.
|
|
2365
|
-
findPlace(t, e, n) {
|
|
2366
|
-
let i, r;
|
|
2367
|
-
for (let s = this.open, o = 0; s >= 0; s--) {
|
|
2368
|
-
let h = this.nodes[s], a = h.findWrapping(t);
|
|
2369
|
-
if (a && (!i || i.length > a.length + o) && (i = a, r = h, !a.length))
|
|
2370
|
-
break;
|
|
2371
|
-
if (h.solid) {
|
|
2372
|
-
if (n)
|
|
2373
|
-
break;
|
|
2374
|
-
o += 2;
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
if (!i)
|
|
2378
|
-
return null;
|
|
2379
|
-
this.sync(r);
|
|
2380
|
-
for (let s = 0; s < i.length; s++)
|
|
2381
|
-
e = this.enterInner(i[s], null, e, !1);
|
|
2382
|
-
return e;
|
|
2383
|
-
}
|
|
2384
|
-
// Try to insert the given node, adjusting the context when needed.
|
|
2385
|
-
insertNode(t, e, n) {
|
|
2386
|
-
if (t.isInline && this.needsBlock && !this.top.type) {
|
|
2387
|
-
let r = this.textblockFromContext();
|
|
2388
|
-
r && (e = this.enterInner(r, null, e));
|
|
2389
|
-
}
|
|
2390
|
-
let i = this.findPlace(t, e, n);
|
|
2391
|
-
if (i) {
|
|
2392
|
-
this.closeExtra();
|
|
2393
|
-
let r = this.top;
|
|
2394
|
-
r.match && (r.match = r.match.matchType(t.type));
|
|
2395
|
-
let s = u.none;
|
|
2396
|
-
for (let o of i.concat(t.marks))
|
|
2397
|
-
(r.type ? r.type.allowsMarkType(o.type) : K(o.type, t.type)) && (s = o.addToSet(s));
|
|
2398
|
-
return r.content.push(t.mark(s)), !0;
|
|
2399
|
-
}
|
|
2400
|
-
return !1;
|
|
2401
|
-
}
|
|
2402
|
-
// Try to start a node of the given type, adjusting the context when
|
|
2403
|
-
// necessary.
|
|
2404
|
-
enter(t, e, n, i) {
|
|
2405
|
-
let r = this.findPlace(t.create(e), n, !1);
|
|
2406
|
-
return r && (r = this.enterInner(t, e, n, !0, i)), r;
|
|
2407
|
-
}
|
|
2408
|
-
// Open a node of the given type
|
|
2409
|
-
enterInner(t, e, n, i = !1, r) {
|
|
2410
|
-
this.closeExtra();
|
|
2411
|
-
let s = this.top;
|
|
2412
|
-
s.match = s.match && s.match.matchType(t);
|
|
2413
|
-
let o = V(t, r, s.options);
|
|
2414
|
-
s.options & S && s.content.length == 0 && (o |= S);
|
|
2415
|
-
let h = u.none;
|
|
2416
|
-
return n = n.filter((a) => (s.type ? s.type.allowsMarkType(a.type) : K(a.type, t)) ? (h = a.addToSet(h), !1) : !0), this.nodes.push(new b(t, e, h, i, null, o)), this.open++, n;
|
|
2417
|
-
}
|
|
2418
|
-
// Make sure all nodes above this.open are finished and added to
|
|
2419
|
-
// their parents
|
|
2420
|
-
closeExtra(t = !1) {
|
|
2421
|
-
let e = this.nodes.length - 1;
|
|
2422
|
-
if (e > this.open) {
|
|
2423
|
-
for (; e > this.open; e--)
|
|
2424
|
-
this.nodes[e - 1].content.push(this.nodes[e].finish(t));
|
|
2425
|
-
this.nodes.length = this.open + 1;
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
finish() {
|
|
2429
|
-
return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
|
|
2430
|
-
}
|
|
2431
|
-
sync(t) {
|
|
2432
|
-
for (let e = this.open; e >= 0; e--) {
|
|
2433
|
-
if (this.nodes[e] == t)
|
|
2434
|
-
return this.open = e, !0;
|
|
2435
|
-
this.localPreserveWS && (this.nodes[e].options |= C);
|
|
2436
|
-
}
|
|
2437
|
-
return !1;
|
|
2438
|
-
}
|
|
2439
|
-
get currentPos() {
|
|
2440
|
-
this.closeExtra();
|
|
2441
|
-
let t = 0;
|
|
2442
|
-
for (let e = this.open; e >= 0; e--) {
|
|
2443
|
-
let n = this.nodes[e].content;
|
|
2444
|
-
for (let i = n.length - 1; i >= 0; i--)
|
|
2445
|
-
t += n[i].nodeSize;
|
|
2446
|
-
e && t++;
|
|
2447
|
-
}
|
|
2448
|
-
return t;
|
|
2449
|
-
}
|
|
2450
|
-
findAtPoint(t, e) {
|
|
2451
|
-
if (this.find)
|
|
2452
|
-
for (let n = 0; n < this.find.length; n++)
|
|
2453
|
-
this.find[n].node == t && this.find[n].offset == e && (this.find[n].pos = this.currentPos);
|
|
2454
|
-
}
|
|
2455
|
-
findInside(t) {
|
|
2456
|
-
if (this.find)
|
|
2457
|
-
for (let e = 0; e < this.find.length; e++)
|
|
2458
|
-
this.find[e].pos == null && t.nodeType == 1 && t.contains(this.find[e].node) && (this.find[e].pos = this.currentPos);
|
|
2459
|
-
}
|
|
2460
|
-
findAround(t, e, n) {
|
|
2461
|
-
if (t != e && this.find)
|
|
2462
|
-
for (let i = 0; i < this.find.length; i++)
|
|
2463
|
-
this.find[i].pos == null && t.nodeType == 1 && t.contains(this.find[i].node) && e.compareDocumentPosition(this.find[i].node) & (n ? 2 : 4) && (this.find[i].pos = this.currentPos);
|
|
2464
|
-
}
|
|
2465
|
-
findInText(t) {
|
|
2466
|
-
if (this.find)
|
|
2467
|
-
for (let e = 0; e < this.find.length; e++)
|
|
2468
|
-
this.find[e].node == t && (this.find[e].pos = this.currentPos - (t.nodeValue.length - this.find[e].offset));
|
|
2469
|
-
}
|
|
2470
|
-
// Determines whether the given context string matches this context.
|
|
2471
|
-
matchesContext(t) {
|
|
2472
|
-
if (t.indexOf("|") > -1)
|
|
2473
|
-
return t.split(/\s*\|\s*/).some(this.matchesContext, this);
|
|
2474
|
-
let e = t.split("/"), n = this.options.context, i = !this.isOpen && (!n || n.parent.type == this.nodes[0].type), r = -(n ? n.depth + 1 : 0) + (i ? 0 : 1), s = (o, h) => {
|
|
2475
|
-
for (; o >= 0; o--) {
|
|
2476
|
-
let a = e[o];
|
|
2477
|
-
if (a == "") {
|
|
2478
|
-
if (o == e.length - 1 || o == 0)
|
|
2479
|
-
continue;
|
|
2480
|
-
for (; h >= r; h--)
|
|
2481
|
-
if (s(o - 1, h))
|
|
2482
|
-
return !0;
|
|
2483
|
-
return !1;
|
|
2484
|
-
} else {
|
|
2485
|
-
let f = h > 0 || h == 0 && i ? this.nodes[h].type : n && h >= r ? n.node(h - r).type : null;
|
|
2486
|
-
if (!f || f.name != a && !f.isInGroup(a))
|
|
2487
|
-
return !1;
|
|
2488
|
-
h--;
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
return !0;
|
|
2492
|
-
};
|
|
2493
|
-
return s(e.length - 1, this.open);
|
|
2494
|
-
}
|
|
2495
|
-
textblockFromContext() {
|
|
2496
|
-
let t = this.options.context;
|
|
2497
|
-
if (t)
|
|
2498
|
-
for (let e = t.depth; e >= 0; e--) {
|
|
2499
|
-
let n = t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;
|
|
2500
|
-
if (n && n.isTextblock && n.defaultAttrs)
|
|
2501
|
-
return n;
|
|
2502
|
-
}
|
|
2503
|
-
for (let e in this.parser.schema.nodes) {
|
|
2504
|
-
let n = this.parser.schema.nodes[e];
|
|
2505
|
-
if (n.isTextblock && n.defaultAttrs)
|
|
2506
|
-
return n;
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2510
|
-
function Dt(l) {
|
|
2511
|
-
for (let t = l.firstChild, e = null; t; t = t.nextSibling) {
|
|
2512
|
-
let n = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
|
|
2513
|
-
n && ct.hasOwnProperty(n) && e ? (e.appendChild(t), t = e) : n == "li" ? e = t : n && (e = null);
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
function Pt(l, t) {
|
|
2517
|
-
return (l.matches || l.msMatchesSelector || l.webkitMatchesSelector || l.mozMatchesSelector).call(l, t);
|
|
2518
|
-
}
|
|
2519
|
-
function H(l) {
|
|
2520
|
-
let t = {};
|
|
2521
|
-
for (let e in l)
|
|
2522
|
-
t[e] = l[e];
|
|
2523
|
-
return t;
|
|
2524
|
-
}
|
|
2525
|
-
function K(l, t) {
|
|
2526
|
-
let e = t.schema.nodes;
|
|
2527
|
-
for (let n in e) {
|
|
2528
|
-
let i = e[n];
|
|
2529
|
-
if (!i.allowsMarkType(l))
|
|
2530
|
-
continue;
|
|
2531
|
-
let r = [], s = (o) => {
|
|
2532
|
-
r.push(o);
|
|
2533
|
-
for (let h = 0; h < o.edgeCount; h++) {
|
|
2534
|
-
let { type: a, next: f } = o.edge(h);
|
|
2535
|
-
if (a == t || r.indexOf(f) < 0 && s(f))
|
|
2536
|
-
return !0;
|
|
2537
|
-
}
|
|
2538
|
-
};
|
|
2539
|
-
if (s(i.contentMatch))
|
|
2540
|
-
return !0;
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
class ut {
|
|
2544
|
-
/**
|
|
2545
|
-
Create a serializer. `nodes` should map node names to functions
|
|
2546
|
-
that take a node and return a description of the corresponding
|
|
2547
|
-
DOM. `marks` does the same for mark names, but also gets an
|
|
2548
|
-
argument that tells it whether the mark's content is block or
|
|
2549
|
-
inline content (for typical use, it'll always be inline). A mark
|
|
2550
|
-
serializer may be `null` to indicate that marks of that type
|
|
2551
|
-
should not be serialized.
|
|
2552
|
-
*/
|
|
2553
|
-
constructor(t, e) {
|
|
2554
|
-
this.nodes = t, this.marks = e;
|
|
2555
|
-
}
|
|
2556
|
-
/**
|
|
2557
|
-
Serialize the content of this fragment to a DOM fragment. When
|
|
2558
|
-
not in the browser, the `document` option, containing a DOM
|
|
2559
|
-
document, should be passed so that the serializer can create
|
|
2560
|
-
nodes.
|
|
2561
|
-
*/
|
|
2562
|
-
serializeFragment(t, e = {}, n) {
|
|
2563
|
-
n || (n = v(e).createDocumentFragment());
|
|
2564
|
-
let i = n, r = [];
|
|
2565
|
-
return t.forEach((s) => {
|
|
2566
|
-
if (r.length || s.marks.length) {
|
|
2567
|
-
let o = 0, h = 0;
|
|
2568
|
-
for (; o < r.length && h < s.marks.length; ) {
|
|
2569
|
-
let a = s.marks[h];
|
|
2570
|
-
if (!this.marks[a.type.name]) {
|
|
2571
|
-
h++;
|
|
2572
|
-
continue;
|
|
2573
|
-
}
|
|
2574
|
-
if (!a.eq(r[o][0]) || a.type.spec.spanning === !1)
|
|
2575
|
-
break;
|
|
2576
|
-
o++, h++;
|
|
2577
|
-
}
|
|
2578
|
-
for (; o < r.length; )
|
|
2579
|
-
i = r.pop()[1];
|
|
2580
|
-
for (; h < s.marks.length; ) {
|
|
2581
|
-
let a = s.marks[h++], f = this.serializeMark(a, s.isInline, e);
|
|
2582
|
-
f && (r.push([a, i]), i.appendChild(f.dom), i = f.contentDOM || f.dom);
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
|
-
i.appendChild(this.serializeNodeInner(s, e));
|
|
2586
|
-
}), n;
|
|
2587
|
-
}
|
|
2588
|
-
/**
|
|
2589
|
-
@internal
|
|
2590
|
-
*/
|
|
2591
|
-
serializeNodeInner(t, e) {
|
|
2592
|
-
let { dom: n, contentDOM: i } = T(v(e), this.nodes[t.type.name](t), null, t.attrs);
|
|
2593
|
-
if (i) {
|
|
2594
|
-
if (t.isLeaf)
|
|
2595
|
-
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
2596
|
-
this.serializeFragment(t.content, e, i);
|
|
2597
|
-
}
|
|
2598
|
-
return n;
|
|
2599
|
-
}
|
|
2600
|
-
/**
|
|
2601
|
-
Serialize this node to a DOM node. This can be useful when you
|
|
2602
|
-
need to serialize a part of a document, as opposed to the whole
|
|
2603
|
-
document. To serialize a whole document, use
|
|
2604
|
-
[`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
|
|
2605
|
-
its [content](https://prosemirror.net/docs/ref/#model.Node.content).
|
|
2606
|
-
*/
|
|
2607
|
-
serializeNode(t, e = {}) {
|
|
2608
|
-
let n = this.serializeNodeInner(t, e);
|
|
2609
|
-
for (let i = t.marks.length - 1; i >= 0; i--) {
|
|
2610
|
-
let r = this.serializeMark(t.marks[i], t.isInline, e);
|
|
2611
|
-
r && ((r.contentDOM || r.dom).appendChild(n), n = r.dom);
|
|
2612
|
-
}
|
|
2613
|
-
return n;
|
|
2614
|
-
}
|
|
2615
|
-
/**
|
|
2616
|
-
@internal
|
|
2617
|
-
*/
|
|
2618
|
-
serializeMark(t, e, n = {}) {
|
|
2619
|
-
let i = this.marks[t.type.name];
|
|
2620
|
-
return i && T(v(n), i(t, e), null, t.attrs);
|
|
2621
|
-
}
|
|
2622
|
-
static renderSpec(t, e, n = null, i) {
|
|
2623
|
-
return T(t, e, n, i);
|
|
2624
|
-
}
|
|
2625
|
-
/**
|
|
2626
|
-
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
2627
|
-
properties in a schema's node and mark specs.
|
|
2628
|
-
*/
|
|
2629
|
-
static fromSchema(t) {
|
|
2630
|
-
return t.cached.domSerializer || (t.cached.domSerializer = new ut(this.nodesFromSchema(t), this.marksFromSchema(t)));
|
|
2631
|
-
}
|
|
2632
|
-
/**
|
|
2633
|
-
Gather the serializers in a schema's node specs into an object.
|
|
2634
|
-
This can be useful as a base to build a custom serializer from.
|
|
2635
|
-
*/
|
|
2636
|
-
static nodesFromSchema(t) {
|
|
2637
|
-
let e = Q(t.nodes);
|
|
2638
|
-
return e.text || (e.text = (n) => n.text), e;
|
|
2639
|
-
}
|
|
2640
|
-
/**
|
|
2641
|
-
Gather the serializers in a schema's mark specs into an object.
|
|
2642
|
-
*/
|
|
2643
|
-
static marksFromSchema(t) {
|
|
2644
|
-
return Q(t.marks);
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
function Q(l) {
|
|
2648
|
-
let t = {};
|
|
2649
|
-
for (let e in l) {
|
|
2650
|
-
let n = l[e].spec.toDOM;
|
|
2651
|
-
n && (t[e] = n);
|
|
2652
|
-
}
|
|
2653
|
-
return t;
|
|
2654
|
-
}
|
|
2655
|
-
function v(l) {
|
|
2656
|
-
return l.document || window.document;
|
|
2657
|
-
}
|
|
2658
|
-
const X = /* @__PURE__ */ new WeakMap();
|
|
2659
|
-
function Bt(l) {
|
|
2660
|
-
let t = X.get(l);
|
|
2661
|
-
return t === void 0 && X.set(l, t = Ft(l)), t;
|
|
2662
|
-
}
|
|
2663
|
-
function Ft(l) {
|
|
2664
|
-
let t = null;
|
|
2665
|
-
function e(n) {
|
|
2666
|
-
if (n && typeof n == "object")
|
|
2667
|
-
if (Array.isArray(n))
|
|
2668
|
-
if (typeof n[0] == "string")
|
|
2669
|
-
t || (t = []), t.push(n);
|
|
2670
|
-
else
|
|
2671
|
-
for (let i = 0; i < n.length; i++)
|
|
2672
|
-
e(n[i]);
|
|
2673
|
-
else
|
|
2674
|
-
for (let i in n)
|
|
2675
|
-
e(n[i]);
|
|
2676
|
-
}
|
|
2677
|
-
return e(l), t;
|
|
2678
|
-
}
|
|
2679
|
-
function T(l, t, e, n) {
|
|
2680
|
-
if (typeof t == "string")
|
|
2681
|
-
return { dom: l.createTextNode(t) };
|
|
2682
|
-
if (t.nodeType != null)
|
|
2683
|
-
return { dom: t };
|
|
2684
|
-
if (t.dom && t.dom.nodeType != null)
|
|
2685
|
-
return t;
|
|
2686
|
-
let i = t[0], r;
|
|
2687
|
-
if (typeof i != "string")
|
|
2688
|
-
throw new RangeError("Invalid array passed to renderSpec");
|
|
2689
|
-
if (n && (r = Bt(n)) && r.indexOf(t) > -1)
|
|
2690
|
-
throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
2691
|
-
let s = i.indexOf(" ");
|
|
2692
|
-
s > 0 && (e = i.slice(0, s), i = i.slice(s + 1));
|
|
2693
|
-
let o, h = e ? l.createElementNS(e, i) : l.createElement(i), a = t[1], f = 1;
|
|
2694
|
-
if (a && typeof a == "object" && a.nodeType == null && !Array.isArray(a)) {
|
|
2695
|
-
f = 2;
|
|
2696
|
-
for (let p in a)
|
|
2697
|
-
if (a[p] != null) {
|
|
2698
|
-
let y = p.indexOf(" ");
|
|
2699
|
-
y > 0 ? h.setAttributeNS(p.slice(0, y), p.slice(y + 1), a[p]) : p == "style" && h.style ? h.style.cssText = a[p] : h.setAttribute(p, a[p]);
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
for (let p = f; p < t.length; p++) {
|
|
2703
|
-
let y = t[p];
|
|
2704
|
-
if (y === 0) {
|
|
2705
|
-
if (p < t.length - 1 || p > f)
|
|
2706
|
-
throw new RangeError("Content hole must be the only child of its parent node");
|
|
2707
|
-
return { dom: h, contentDOM: h };
|
|
2708
|
-
} else {
|
|
2709
|
-
let { dom: pt, contentDOM: J } = T(l, y, e, n);
|
|
2710
|
-
if (h.appendChild(pt), J) {
|
|
2711
|
-
if (o)
|
|
2712
|
-
throw new RangeError("Multiple content holes");
|
|
2713
|
-
o = J;
|
|
2714
|
-
}
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
return { dom: h, contentDOM: o };
|
|
2718
|
-
}
|
|
2719
|
-
export {
|
|
2720
|
-
ut as D,
|
|
2721
|
-
c as F,
|
|
2722
|
-
u as M,
|
|
2723
|
-
mt as N,
|
|
2724
|
-
I as R,
|
|
2725
|
-
d as S,
|
|
2726
|
-
qt as a,
|
|
2727
|
-
g as b,
|
|
2728
|
-
F as c,
|
|
2729
|
-
P as d
|
|
2730
|
-
};
|