@ecomcx/ecomweb-editor 0.0.0-stage → 1.17.1
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/README.md +107 -2
- package/node_modules/@floating-ui/core/LICENSE +20 -0
- package/node_modules/@floating-ui/core/README.md +4 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs +1 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs +1164 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +535 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +535 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.esm.js +1038 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +1038 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.js +1183 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.min.js +1 -0
- package/node_modules/@floating-ui/core/package.json +63 -0
- package/node_modules/@floating-ui/dom/LICENSE +20 -0
- package/node_modules/@floating-ui/dom/README.md +4 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs +1 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs +964 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts +362 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.ts +362 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js +789 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +789 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.js +983 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.min.js +1 -0
- package/node_modules/@floating-ui/dom/package.json +72 -0
- package/node_modules/@floating-ui/utils/LICENSE +20 -0
- package/node_modules/@floating-ui/utils/README.md +4 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +105 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +105 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.esm.js +165 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +165 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.js +192 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js +1 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.esm.js +136 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +136 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.js +167 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.min.js +1 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.esm.js +165 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.umd.js +192 -0
- package/node_modules/@floating-ui/utils/dom/package.json +6 -0
- package/node_modules/@floating-ui/utils/package.json +70 -0
- package/node_modules/@tiptap/core/LICENSE.md +21 -0
- package/node_modules/@tiptap/core/README.md +18 -0
- package/node_modules/@tiptap/core/dist/index.cjs +8463 -0
- package/node_modules/@tiptap/core/dist/index.d.cts +5798 -0
- package/node_modules/@tiptap/core/dist/index.d.ts +5797 -0
- package/node_modules/@tiptap/core/dist/index.js +8288 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs +70 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts +28 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts +28 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +64 -0
- package/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.cjs +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.cts +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.ts +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.js +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.cjs +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.d.cts +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.d.ts +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.js +1 -0
- package/node_modules/@tiptap/core/package.json +74 -0
- package/node_modules/@tiptap/extension-blockquote/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-blockquote/README.md +18 -0
- package/node_modules/@tiptap/extension-blockquote/dist/index.cjs +132 -0
- package/node_modules/@tiptap/extension-blockquote/dist/index.d.cts +40 -0
- package/node_modules/@tiptap/extension-blockquote/dist/index.d.ts +40 -0
- package/node_modules/@tiptap/extension-blockquote/dist/index.js +126 -0
- package/node_modules/@tiptap/extension-blockquote/package.json +52 -0
- package/node_modules/@tiptap/extension-bold/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-bold/README.md +18 -0
- package/node_modules/@tiptap/extension-bold/dist/index.cjs +117 -0
- package/node_modules/@tiptap/extension-bold/dist/index.d.cts +52 -0
- package/node_modules/@tiptap/extension-bold/dist/index.d.ts +52 -0
- package/node_modules/@tiptap/extension-bold/dist/index.js +108 -0
- package/node_modules/@tiptap/extension-bold/package.json +50 -0
- package/node_modules/@tiptap/extension-bubble-menu/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-bubble-menu/README.md +18 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs +333 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts +170 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts +170 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js +326 -0
- package/node_modules/@tiptap/extension-bubble-menu/package.json +56 -0
- package/node_modules/@tiptap/extension-bullet-list/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-bullet-list/README.md +18 -0
- package/node_modules/@tiptap/extension-bullet-list/dist/index.cjs +17 -0
- package/node_modules/@tiptap/extension-bullet-list/dist/index.d.cts +2 -0
- package/node_modules/@tiptap/extension-bullet-list/dist/index.d.ts +2 -0
- package/node_modules/@tiptap/extension-bullet-list/dist/index.js +7 -0
- package/node_modules/@tiptap/extension-bullet-list/package.json +50 -0
- package/node_modules/@tiptap/extension-code/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-code/README.md +18 -0
- package/node_modules/@tiptap/extension-code/dist/index.cjs +136 -0
- package/node_modules/@tiptap/extension-code/dist/index.d.cts +60 -0
- package/node_modules/@tiptap/extension-code/dist/index.d.ts +60 -0
- package/node_modules/@tiptap/extension-code/dist/index.js +127 -0
- package/node_modules/@tiptap/extension-code/package.json +50 -0
- package/node_modules/@tiptap/extension-code-block/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-code-block/README.md +18 -0
- package/node_modules/@tiptap/extension-code-block/dist/index.cjs +255 -0
- package/node_modules/@tiptap/extension-code-block/dist/index.d.cts +84 -0
- package/node_modules/@tiptap/extension-code-block/dist/index.d.ts +84 -0
- package/node_modules/@tiptap/extension-code-block/dist/index.js +248 -0
- package/node_modules/@tiptap/extension-code-block/package.json +52 -0
- package/node_modules/@tiptap/extension-document/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-document/README.md +18 -0
- package/node_modules/@tiptap/extension-document/dist/index.cjs +26 -0
- package/node_modules/@tiptap/extension-document/dist/index.d.cts +10 -0
- package/node_modules/@tiptap/extension-document/dist/index.d.ts +10 -0
- package/node_modules/@tiptap/extension-document/dist/index.js +22 -0
- package/node_modules/@tiptap/extension-document/package.json +50 -0
- package/node_modules/@tiptap/extension-dropcursor/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-dropcursor/README.md +18 -0
- package/node_modules/@tiptap/extension-dropcursor/dist/index.cjs +17 -0
- package/node_modules/@tiptap/extension-dropcursor/dist/index.d.cts +2 -0
- package/node_modules/@tiptap/extension-dropcursor/dist/index.d.ts +2 -0
- package/node_modules/@tiptap/extension-dropcursor/dist/index.js +7 -0
- package/node_modules/@tiptap/extension-dropcursor/package.json +50 -0
- package/node_modules/@tiptap/extension-floating-menu/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-floating-menu/README.md +18 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs +272 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts +180 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts +180 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js +265 -0
- package/node_modules/@tiptap/extension-floating-menu/package.json +55 -0
- package/node_modules/@tiptap/extension-gapcursor/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-gapcursor/README.md +18 -0
- package/node_modules/@tiptap/extension-gapcursor/dist/index.cjs +17 -0
- package/node_modules/@tiptap/extension-gapcursor/dist/index.d.cts +2 -0
- package/node_modules/@tiptap/extension-gapcursor/dist/index.d.ts +2 -0
- package/node_modules/@tiptap/extension-gapcursor/dist/index.js +7 -0
- package/node_modules/@tiptap/extension-gapcursor/package.json +50 -0
- package/node_modules/@tiptap/extension-hard-break/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-hard-break/README.md +18 -0
- package/node_modules/@tiptap/extension-hard-break/dist/index.cjs +69 -0
- package/node_modules/@tiptap/extension-hard-break/dist/index.d.cts +35 -0
- package/node_modules/@tiptap/extension-hard-break/dist/index.d.ts +35 -0
- package/node_modules/@tiptap/extension-hard-break/dist/index.js +64 -0
- package/node_modules/@tiptap/extension-hard-break/package.json +50 -0
- package/node_modules/@tiptap/extension-heading/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-heading/README.md +18 -0
- package/node_modules/@tiptap/extension-heading/dist/index.cjs +93 -0
- package/node_modules/@tiptap/extension-heading/dist/index.d.cts +50 -0
- package/node_modules/@tiptap/extension-heading/dist/index.d.ts +50 -0
- package/node_modules/@tiptap/extension-heading/dist/index.js +88 -0
- package/node_modules/@tiptap/extension-heading/package.json +50 -0
- package/node_modules/@tiptap/extension-highlight/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-highlight/README.md +18 -0
- package/node_modules/@tiptap/extension-highlight/dist/index.cjs +113 -0
- package/node_modules/@tiptap/extension-highlight/dist/index.d.cts +59 -0
- package/node_modules/@tiptap/extension-highlight/dist/index.d.ts +59 -0
- package/node_modules/@tiptap/extension-highlight/dist/index.js +106 -0
- package/node_modules/@tiptap/extension-highlight/package.json +50 -0
- package/node_modules/@tiptap/extension-horizontal-rule/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-horizontal-rule/README.md +18 -0
- package/node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs +78 -0
- package/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.cts +35 -0
- package/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts +35 -0
- package/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +73 -0
- package/node_modules/@tiptap/extension-horizontal-rule/package.json +52 -0
- package/node_modules/@tiptap/extension-image/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-image/README.md +18 -0
- package/node_modules/@tiptap/extension-image/dist/index.cjs +181 -0
- package/node_modules/@tiptap/extension-image/dist/index.d.cts +69 -0
- package/node_modules/@tiptap/extension-image/dist/index.d.ts +69 -0
- package/node_modules/@tiptap/extension-image/dist/index.js +175 -0
- package/node_modules/@tiptap/extension-image/package.json +50 -0
- package/node_modules/@tiptap/extension-italic/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-italic/README.md +18 -0
- package/node_modules/@tiptap/extension-italic/dist/index.cjs +113 -0
- package/node_modules/@tiptap/extension-italic/dist/index.d.cts +55 -0
- package/node_modules/@tiptap/extension-italic/dist/index.d.ts +55 -0
- package/node_modules/@tiptap/extension-italic/dist/index.js +104 -0
- package/node_modules/@tiptap/extension-italic/package.json +50 -0
- package/node_modules/@tiptap/extension-link/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-link/README.md +18 -0
- package/node_modules/@tiptap/extension-link/dist/index.cjs +560 -0
- package/node_modules/@tiptap/extension-link/dist/index.d.cts +159 -0
- package/node_modules/@tiptap/extension-link/dist/index.d.ts +159 -0
- package/node_modules/@tiptap/extension-link/dist/index.js +553 -0
- package/node_modules/@tiptap/extension-link/package.json +56 -0
- package/node_modules/@tiptap/extension-list/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-list/README.md +18 -0
- package/node_modules/@tiptap/extension-list/dist/bullet-list/index.cjs +84 -0
- package/node_modules/@tiptap/extension-list/dist/bullet-list/index.d.cts +52 -0
- package/node_modules/@tiptap/extension-list/dist/bullet-list/index.d.ts +52 -0
- package/node_modules/@tiptap/extension-list/dist/bullet-list/index.js +82 -0
- package/node_modules/@tiptap/extension-list/dist/index.cjs +1570 -0
- package/node_modules/@tiptap/extension-list/dist/index.d.cts +391 -0
- package/node_modules/@tiptap/extension-list/dist/index.d.ts +390 -0
- package/node_modules/@tiptap/extension-list/dist/index.js +1533 -0
- package/node_modules/@tiptap/extension-list/dist/item/index.cjs +308 -0
- package/node_modules/@tiptap/extension-list/dist/item/index.d.cts +30 -0
- package/node_modules/@tiptap/extension-list/dist/item/index.d.ts +30 -0
- package/node_modules/@tiptap/extension-list/dist/item/index.js +307 -0
- package/node_modules/@tiptap/extension-list/dist/keymap/index.cjs +263 -0
- package/node_modules/@tiptap/extension-list/dist/keymap/index.d.cts +66 -0
- package/node_modules/@tiptap/extension-list/dist/keymap/index.d.ts +65 -0
- package/node_modules/@tiptap/extension-list/dist/keymap/index.js +245 -0
- package/node_modules/@tiptap/extension-list/dist/keymap/rolldown-runtime-D7D4PA-g.js +13 -0
- package/node_modules/@tiptap/extension-list/dist/kit/index.cjs +1487 -0
- package/node_modules/@tiptap/extension-list/dist/kit/index.d.cts +235 -0
- package/node_modules/@tiptap/extension-list/dist/kit/index.d.ts +235 -0
- package/node_modules/@tiptap/extension-list/dist/kit/index.js +1486 -0
- package/node_modules/@tiptap/extension-list/dist/ordered-list/index.cjs +671 -0
- package/node_modules/@tiptap/extension-list/dist/ordered-list/index.d.cts +120 -0
- package/node_modules/@tiptap/extension-list/dist/ordered-list/index.d.ts +120 -0
- package/node_modules/@tiptap/extension-list/dist/ordered-list/index.js +659 -0
- package/node_modules/@tiptap/extension-list/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/node_modules/@tiptap/extension-list/dist/task-item/index.cjs +327 -0
- package/node_modules/@tiptap/extension-list/dist/task-item/index.d.cts +69 -0
- package/node_modules/@tiptap/extension-list/dist/task-item/index.d.ts +69 -0
- package/node_modules/@tiptap/extension-list/dist/task-item/index.js +325 -0
- package/node_modules/@tiptap/extension-list/dist/task-list/index.cjs +121 -0
- package/node_modules/@tiptap/extension-list/dist/task-list/index.d.cts +35 -0
- package/node_modules/@tiptap/extension-list/dist/task-list/index.d.ts +35 -0
- package/node_modules/@tiptap/extension-list/dist/task-list/index.js +120 -0
- package/node_modules/@tiptap/extension-list/package.json +108 -0
- package/node_modules/@tiptap/extension-list-item/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-list-item/README.md +18 -0
- package/node_modules/@tiptap/extension-list-item/dist/index.cjs +17 -0
- package/node_modules/@tiptap/extension-list-item/dist/index.d.cts +2 -0
- package/node_modules/@tiptap/extension-list-item/dist/index.d.ts +2 -0
- package/node_modules/@tiptap/extension-list-item/dist/index.js +7 -0
- package/node_modules/@tiptap/extension-list-item/package.json +50 -0
- package/node_modules/@tiptap/extension-list-keymap/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-list-keymap/README.md +18 -0
- package/node_modules/@tiptap/extension-list-keymap/dist/index.cjs +23 -0
- package/node_modules/@tiptap/extension-list-keymap/dist/index.d.cts +2 -0
- package/node_modules/@tiptap/extension-list-keymap/dist/index.d.ts +2 -0
- package/node_modules/@tiptap/extension-list-keymap/dist/index.js +7 -0
- package/node_modules/@tiptap/extension-list-keymap/package.json +50 -0
- package/node_modules/@tiptap/extension-ordered-list/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-ordered-list/README.md +18 -0
- package/node_modules/@tiptap/extension-ordered-list/dist/index.cjs +17 -0
- package/node_modules/@tiptap/extension-ordered-list/dist/index.d.cts +2 -0
- package/node_modules/@tiptap/extension-ordered-list/dist/index.d.ts +2 -0
- package/node_modules/@tiptap/extension-ordered-list/dist/index.js +7 -0
- package/node_modules/@tiptap/extension-ordered-list/package.json +50 -0
- package/node_modules/@tiptap/extension-paragraph/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-paragraph/README.md +18 -0
- package/node_modules/@tiptap/extension-paragraph/dist/index.cjs +73 -0
- package/node_modules/@tiptap/extension-paragraph/dist/index.d.cts +29 -0
- package/node_modules/@tiptap/extension-paragraph/dist/index.d.ts +29 -0
- package/node_modules/@tiptap/extension-paragraph/dist/index.js +68 -0
- package/node_modules/@tiptap/extension-paragraph/package.json +50 -0
- package/node_modules/@tiptap/extension-strike/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-strike/README.md +18 -0
- package/node_modules/@tiptap/extension-strike/dist/index.cjs +88 -0
- package/node_modules/@tiptap/extension-strike/dist/index.d.cts +47 -0
- package/node_modules/@tiptap/extension-strike/dist/index.d.ts +47 -0
- package/node_modules/@tiptap/extension-strike/dist/index.js +81 -0
- package/node_modules/@tiptap/extension-strike/package.json +50 -0
- package/node_modules/@tiptap/extension-subscript/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-subscript/README.md +18 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.cjs +56 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.d.cts +39 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.d.ts +39 -0
- package/node_modules/@tiptap/extension-subscript/dist/index.js +51 -0
- package/node_modules/@tiptap/extension-subscript/package.json +52 -0
- package/node_modules/@tiptap/extension-superscript/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-superscript/README.md +18 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.cjs +56 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.d.cts +39 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.d.ts +39 -0
- package/node_modules/@tiptap/extension-superscript/dist/index.js +51 -0
- package/node_modules/@tiptap/extension-superscript/package.json +52 -0
- package/node_modules/@tiptap/extension-table/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-table/README.md +18 -0
- package/node_modules/@tiptap/extension-table/dist/cell/index.cjs +142 -0
- package/node_modules/@tiptap/extension-table/dist/cell/index.d.cts +35 -0
- package/node_modules/@tiptap/extension-table/dist/cell/index.d.ts +35 -0
- package/node_modules/@tiptap/extension-table/dist/cell/index.js +141 -0
- package/node_modules/@tiptap/extension-table/dist/header/index.cjs +142 -0
- package/node_modules/@tiptap/extension-table/dist/header/index.d.cts +35 -0
- package/node_modules/@tiptap/extension-table/dist/header/index.d.ts +35 -0
- package/node_modules/@tiptap/extension-table/dist/header/index.js +141 -0
- package/node_modules/@tiptap/extension-table/dist/index.cjs +832 -0
- package/node_modules/@tiptap/extension-table/dist/index.d.cts +344 -0
- package/node_modules/@tiptap/extension-table/dist/index.d.ts +344 -0
- package/node_modules/@tiptap/extension-table/dist/index.js +819 -0
- package/node_modules/@tiptap/extension-table/dist/kit/index.cjs +817 -0
- package/node_modules/@tiptap/extension-table/dist/kit/index.d.cts +265 -0
- package/node_modules/@tiptap/extension-table/dist/kit/index.d.ts +265 -0
- package/node_modules/@tiptap/extension-table/dist/kit/index.js +816 -0
- package/node_modules/@tiptap/extension-table/dist/row/index.cjs +29 -0
- package/node_modules/@tiptap/extension-table/dist/row/index.d.cts +35 -0
- package/node_modules/@tiptap/extension-table/dist/row/index.d.ts +35 -0
- package/node_modules/@tiptap/extension-table/dist/row/index.js +28 -0
- package/node_modules/@tiptap/extension-table/dist/table/index.cjs +616 -0
- package/node_modules/@tiptap/extension-table/dist/table/index.d.cts +254 -0
- package/node_modules/@tiptap/extension-table/dist/table/index.d.ts +254 -0
- package/node_modules/@tiptap/extension-table/dist/table/index.js +609 -0
- package/node_modules/@tiptap/extension-table/package.json +92 -0
- package/node_modules/@tiptap/extension-text/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-text/README.md +18 -0
- package/node_modules/@tiptap/extension-text/dist/index.cjs +28 -0
- package/node_modules/@tiptap/extension-text/dist/index.d.cts +10 -0
- package/node_modules/@tiptap/extension-text/dist/index.d.ts +10 -0
- package/node_modules/@tiptap/extension-text/dist/index.js +24 -0
- package/node_modules/@tiptap/extension-text/package.json +50 -0
- package/node_modules/@tiptap/extension-text-align/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-text-align/README.md +18 -0
- package/node_modules/@tiptap/extension-text-align/dist/index.cjs +73 -0
- package/node_modules/@tiptap/extension-text-align/dist/index.d.cts +53 -0
- package/node_modules/@tiptap/extension-text-align/dist/index.d.ts +53 -0
- package/node_modules/@tiptap/extension-text-align/dist/index.js +68 -0
- package/node_modules/@tiptap/extension-text-align/package.json +50 -0
- package/node_modules/@tiptap/extension-text-style/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-text-style/README.md +18 -0
- package/node_modules/@tiptap/extension-text-style/dist/background-color/index.cjs +121 -0
- package/node_modules/@tiptap/extension-text-style/dist/background-color/index.d.cts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/background-color/index.d.ts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/background-color/index.js +116 -0
- package/node_modules/@tiptap/extension-text-style/dist/color/index.cjs +121 -0
- package/node_modules/@tiptap/extension-text-style/dist/color/index.d.cts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/color/index.d.ts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/color/index.js +116 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-family/index.cjs +120 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-family/index.d.cts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-family/index.d.ts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-family/index.js +115 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-size/index.cjs +120 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-size/index.d.cts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-size/index.d.ts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/font-size/index.js +115 -0
- package/node_modules/@tiptap/extension-text-style/dist/index.cjs +298 -0
- package/node_modules/@tiptap/extension-text-style/dist/index.d.cts +275 -0
- package/node_modules/@tiptap/extension-text-style/dist/index.d.ts +275 -0
- package/node_modules/@tiptap/extension-text-style/dist/index.js +291 -0
- package/node_modules/@tiptap/extension-text-style/dist/line-height/index.cjs +120 -0
- package/node_modules/@tiptap/extension-text-style/dist/line-height/index.d.cts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/line-height/index.d.ts +161 -0
- package/node_modules/@tiptap/extension-text-style/dist/line-height/index.js +115 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style/index.cjs +80 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style/index.d.cts +170 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style/index.d.ts +170 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style/index.js +79 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.cjs +292 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.d.cts +244 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.d.ts +244 -0
- package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.js +291 -0
- package/node_modules/@tiptap/extension-text-style/package.json +106 -0
- package/node_modules/@tiptap/extension-underline/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-underline/README.md +18 -0
- package/node_modules/@tiptap/extension-underline/dist/index.cjs +81 -0
- package/node_modules/@tiptap/extension-underline/dist/index.d.cts +39 -0
- package/node_modules/@tiptap/extension-underline/dist/index.d.ts +39 -0
- package/node_modules/@tiptap/extension-underline/dist/index.js +76 -0
- package/node_modules/@tiptap/extension-underline/package.json +50 -0
- package/node_modules/@tiptap/extension-youtube/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-youtube/README.md +18 -0
- package/node_modules/@tiptap/extension-youtube/dist/index.cjs +254 -0
- package/node_modules/@tiptap/extension-youtube/dist/index.d.cts +204 -0
- package/node_modules/@tiptap/extension-youtube/dist/index.d.ts +204 -0
- package/node_modules/@tiptap/extension-youtube/dist/index.js +246 -0
- package/node_modules/@tiptap/extension-youtube/package.json +50 -0
- package/node_modules/@tiptap/extensions/LICENSE.md +21 -0
- package/node_modules/@tiptap/extensions/README.md +18 -0
- package/node_modules/@tiptap/extensions/dist/character-count/index.cjs +87 -0
- package/node_modules/@tiptap/extensions/dist/character-count/index.d.cts +70 -0
- package/node_modules/@tiptap/extensions/dist/character-count/index.d.ts +70 -0
- package/node_modules/@tiptap/extensions/dist/character-count/index.js +86 -0
- package/node_modules/@tiptap/extensions/dist/drop-cursor/index.cjs +27 -0
- package/node_modules/@tiptap/extensions/dist/drop-cursor/index.d.cts +32 -0
- package/node_modules/@tiptap/extensions/dist/drop-cursor/index.d.ts +32 -0
- package/node_modules/@tiptap/extensions/dist/drop-cursor/index.js +26 -0
- package/node_modules/@tiptap/extensions/dist/focus/index.cjs +48 -0
- package/node_modules/@tiptap/extensions/dist/focus/index.d.cts +29 -0
- package/node_modules/@tiptap/extensions/dist/focus/index.d.ts +29 -0
- package/node_modules/@tiptap/extensions/dist/focus/index.js +47 -0
- package/node_modules/@tiptap/extensions/dist/gap-cursor/index.cjs +29 -0
- package/node_modules/@tiptap/extensions/dist/gap-cursor/index.d.cts +26 -0
- package/node_modules/@tiptap/extensions/dist/gap-cursor/index.d.ts +26 -0
- package/node_modules/@tiptap/extensions/dist/gap-cursor/index.js +28 -0
- package/node_modules/@tiptap/extensions/dist/index.cjs +711 -0
- package/node_modules/@tiptap/extensions/dist/index.d.cts +321 -0
- package/node_modules/@tiptap/extensions/dist/index.d.ts +321 -0
- package/node_modules/@tiptap/extensions/dist/index.js +699 -0
- package/node_modules/@tiptap/extensions/dist/placeholder/index.cjs +372 -0
- package/node_modules/@tiptap/extensions/dist/placeholder/index.d.cts +91 -0
- package/node_modules/@tiptap/extensions/dist/placeholder/index.d.ts +91 -0
- package/node_modules/@tiptap/extensions/dist/placeholder/index.js +368 -0
- package/node_modules/@tiptap/extensions/dist/selection/index.cjs +72 -0
- package/node_modules/@tiptap/extensions/dist/selection/index.d.cts +20 -0
- package/node_modules/@tiptap/extensions/dist/selection/index.d.ts +20 -0
- package/node_modules/@tiptap/extensions/dist/selection/index.js +71 -0
- package/node_modules/@tiptap/extensions/dist/trailing-node/index.cjs +62 -0
- package/node_modules/@tiptap/extensions/dist/trailing-node/index.d.cts +30 -0
- package/node_modules/@tiptap/extensions/dist/trailing-node/index.d.ts +30 -0
- package/node_modules/@tiptap/extensions/dist/trailing-node/index.js +60 -0
- package/node_modules/@tiptap/extensions/dist/undo-redo/index.cjs +48 -0
- package/node_modules/@tiptap/extensions/dist/undo-redo/index.d.cts +45 -0
- package/node_modules/@tiptap/extensions/dist/undo-redo/index.d.ts +45 -0
- package/node_modules/@tiptap/extensions/dist/undo-redo/index.js +47 -0
- package/node_modules/@tiptap/extensions/package.json +116 -0
- package/node_modules/@tiptap/pm/LICENSE +21 -0
- package/node_modules/@tiptap/pm/README.md +22 -0
- package/node_modules/@tiptap/pm/THIRD_PARTY_LICENSES.md +47 -0
- package/node_modules/@tiptap/pm/changeset/index.ts +1 -0
- package/node_modules/@tiptap/pm/commands/index.ts +1 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/commands/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/commands/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/commands/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/commands/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/history/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/history/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/history/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/history/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/model/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/model/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/model/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/model/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/state/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/state/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/state/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/state/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/tables/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/tables/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/tables/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/tables/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/transform/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/transform/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/transform/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/transform/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/view/index.cjs +9 -0
- package/node_modules/@tiptap/pm/dist/view/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/view/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/view/index.js +2 -0
- package/node_modules/@tiptap/pm/dropcursor/index.ts +1 -0
- package/node_modules/@tiptap/pm/gapcursor/index.ts +1 -0
- package/node_modules/@tiptap/pm/history/index.ts +1 -0
- package/node_modules/@tiptap/pm/inputrules/index.ts +1 -0
- package/node_modules/@tiptap/pm/keymap/index.ts +1 -0
- package/node_modules/@tiptap/pm/model/index.ts +1 -0
- package/node_modules/@tiptap/pm/package.json +166 -0
- package/node_modules/@tiptap/pm/schema-list/index.ts +1 -0
- package/node_modules/@tiptap/pm/state/index.ts +1 -0
- package/node_modules/@tiptap/pm/tables/index.ts +1 -0
- package/node_modules/@tiptap/pm/transform/index.ts +1 -0
- package/node_modules/@tiptap/pm/view/index.ts +1 -0
- package/node_modules/@tiptap/react/LICENSE.md +21 -0
- package/node_modules/@tiptap/react/README.md +18 -0
- package/node_modules/@tiptap/react/dist/index.cjs +1396 -0
- package/node_modules/@tiptap/react/dist/index.d.cts +632 -0
- package/node_modules/@tiptap/react/dist/index.d.ts +632 -0
- package/node_modules/@tiptap/react/dist/index.js +1337 -0
- package/node_modules/@tiptap/react/dist/menus/index.cjs +469 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.cts +21 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.ts +21 -0
- package/node_modules/@tiptap/react/dist/menus/index.js +444 -0
- package/node_modules/@tiptap/react/package.json +80 -0
- package/node_modules/@tiptap/starter-kit/LICENSE.md +21 -0
- package/node_modules/@tiptap/starter-kit/README.md +18 -0
- package/node_modules/@tiptap/starter-kit/dist/index.cjs +76 -0
- package/node_modules/@tiptap/starter-kit/dist/index.d.cts +137 -0
- package/node_modules/@tiptap/starter-kit/dist/index.d.ts +137 -0
- package/node_modules/@tiptap/starter-kit/dist/index.js +71 -0
- package/node_modules/@tiptap/starter-kit/package.json +70 -0
- package/node_modules/@tiptap/suggestion/LICENSE.md +21 -0
- package/node_modules/@tiptap/suggestion/README.md +18 -0
- package/node_modules/@tiptap/suggestion/dist/index.cjs +665 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.cts +419 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.ts +419 -0
- package/node_modules/@tiptap/suggestion/dist/index.js +657 -0
- package/node_modules/@tiptap/suggestion/package.json +54 -0
- package/node_modules/@types/use-sync-external-store/LICENSE +21 -0
- package/node_modules/@types/use-sync-external-store/README.md +15 -0
- package/node_modules/@types/use-sync-external-store/index.d.ts +5 -0
- package/node_modules/@types/use-sync-external-store/package.json +30 -0
- package/node_modules/@types/use-sync-external-store/shim/index.d.ts +1 -0
- package/node_modules/@types/use-sync-external-store/shim/with-selector.d.ts +1 -0
- package/node_modules/@types/use-sync-external-store/with-selector.d.ts +7 -0
- package/node_modules/fast-equals/LICENSE +21 -0
- package/node_modules/fast-equals/README.md +479 -0
- package/node_modules/fast-equals/dist/cjs/index.cjs +796 -0
- package/node_modules/fast-equals/dist/cjs/index.d.cts +211 -0
- package/node_modules/fast-equals/dist/es/index.d.mts +211 -0
- package/node_modules/fast-equals/dist/es/index.mjs +785 -0
- package/node_modules/fast-equals/dist/umd/index.d.ts +211 -0
- package/node_modules/fast-equals/dist/umd/index.js +802 -0
- package/node_modules/fast-equals/index.d.ts +211 -0
- package/node_modules/fast-equals/package.json +120 -0
- package/node_modules/linkifyjs/LICENSE +19 -0
- package/node_modules/linkifyjs/README.md +47 -0
- package/node_modules/linkifyjs/dist/linkify.cjs +1854 -0
- package/node_modules/linkifyjs/dist/linkify.d.cts +637 -0
- package/node_modules/linkifyjs/dist/linkify.d.mts +637 -0
- package/node_modules/linkifyjs/dist/linkify.js +1859 -0
- package/node_modules/linkifyjs/dist/linkify.min.js +1 -0
- package/node_modules/linkifyjs/dist/linkify.mjs +1836 -0
- package/node_modules/linkifyjs/package.json +38 -0
- package/node_modules/orderedmap/LICENSE +19 -0
- package/node_modules/orderedmap/README.md +69 -0
- package/node_modules/orderedmap/dist/index.cjs +139 -0
- package/node_modules/orderedmap/dist/index.d.cts +33 -0
- package/node_modules/orderedmap/dist/index.d.ts +33 -0
- package/node_modules/orderedmap/dist/index.js +137 -0
- package/node_modules/orderedmap/package.json +39 -0
- package/node_modules/prosemirror-changeset/CHANGELOG.md +171 -0
- package/node_modules/prosemirror-changeset/LICENSE +19 -0
- package/node_modules/prosemirror-changeset/README.md +175 -0
- package/node_modules/prosemirror-changeset/dist/index.cjs +588 -0
- package/node_modules/prosemirror-changeset/dist/index.d.cts +187 -0
- package/node_modules/prosemirror-changeset/dist/index.d.ts +187 -0
- package/node_modules/prosemirror-changeset/dist/index.js +722 -0
- package/node_modules/prosemirror-changeset/package.json +40 -0
- package/node_modules/prosemirror-changeset/test/test-changed-range.ts +48 -0
- package/node_modules/prosemirror-changeset/test/test-changes.ts +211 -0
- package/node_modules/prosemirror-changeset/test/test-diff.ts +77 -0
- package/node_modules/prosemirror-changeset/test/test-merge.ts +56 -0
- package/node_modules/prosemirror-changeset/test/test-simplify.ts +74 -0
- package/node_modules/prosemirror-commands/.tern-project +8 -0
- package/node_modules/prosemirror-commands/CHANGELOG.md +328 -0
- package/node_modules/prosemirror-commands/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-commands/LICENSE +19 -0
- package/node_modules/prosemirror-commands/README.md +28 -0
- package/node_modules/prosemirror-commands/dist/index.cjs +688 -0
- package/node_modules/prosemirror-commands/dist/index.d.cts +215 -0
- package/node_modules/prosemirror-commands/dist/index.d.ts +215 -0
- package/node_modules/prosemirror-commands/dist/index.js +852 -0
- package/node_modules/prosemirror-commands/package.json +39 -0
- package/node_modules/prosemirror-dropcursor/CHANGELOG.md +149 -0
- package/node_modules/prosemirror-dropcursor/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-dropcursor/LICENSE +19 -0
- package/node_modules/prosemirror-dropcursor/README.md +50 -0
- package/node_modules/prosemirror-dropcursor/dist/index.cjs +200 -0
- package/node_modules/prosemirror-dropcursor/dist/index.d.cts +38 -0
- package/node_modules/prosemirror-dropcursor/dist/index.d.ts +38 -0
- package/node_modules/prosemirror-dropcursor/dist/index.js +163 -0
- package/node_modules/prosemirror-dropcursor/package.json +38 -0
- package/node_modules/prosemirror-gapcursor/CHANGELOG.md +122 -0
- package/node_modules/prosemirror-gapcursor/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-gapcursor/LICENSE +19 -0
- package/node_modules/prosemirror-gapcursor/README.md +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.cjs +239 -0
- package/node_modules/prosemirror-gapcursor/dist/index.d.cts +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.d.ts +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.js +239 -0
- package/node_modules/prosemirror-gapcursor/package.json +43 -0
- package/node_modules/prosemirror-gapcursor/style/gapcursor.css +25 -0
- package/node_modules/prosemirror-history/.tern-project +8 -0
- package/node_modules/prosemirror-history/CHANGELOG.md +176 -0
- package/node_modules/prosemirror-history/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-history/LICENSE +19 -0
- package/node_modules/prosemirror-history/README.md +27 -0
- package/node_modules/prosemirror-history/dist/index.cjs +383 -0
- package/node_modules/prosemirror-history/dist/index.d.cts +64 -0
- package/node_modules/prosemirror-history/dist/index.d.ts +64 -0
- package/node_modules/prosemirror-history/dist/index.js +454 -0
- package/node_modules/prosemirror-history/package.json +40 -0
- package/node_modules/prosemirror-inputrules/.tern-project +8 -0
- package/node_modules/prosemirror-inputrules/CHANGELOG.md +127 -0
- package/node_modules/prosemirror-inputrules/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-inputrules/LICENSE +19 -0
- package/node_modules/prosemirror-inputrules/README.md +29 -0
- package/node_modules/prosemirror-inputrules/dist/index.cjs +194 -0
- package/node_modules/prosemirror-inputrules/dist/index.d.cts +131 -0
- package/node_modules/prosemirror-inputrules/dist/index.d.ts +131 -0
- package/node_modules/prosemirror-inputrules/dist/index.js +239 -0
- package/node_modules/prosemirror-inputrules/package.json +36 -0
- package/node_modules/prosemirror-keymap/.tern-project +8 -0
- package/node_modules/prosemirror-keymap/CHANGELOG.md +104 -0
- package/node_modules/prosemirror-keymap/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-keymap/LICENSE +19 -0
- package/node_modules/prosemirror-keymap/README.md +27 -0
- package/node_modules/prosemirror-keymap/dist/index.cjs +65 -0
- package/node_modules/prosemirror-keymap/dist/index.d.cts +47 -0
- package/node_modules/prosemirror-keymap/dist/index.d.ts +47 -0
- package/node_modules/prosemirror-keymap/dist/index.js +128 -0
- package/node_modules/prosemirror-keymap/package.json +38 -0
- package/node_modules/prosemirror-model/.tern-project +8 -0
- package/node_modules/prosemirror-model/CHANGELOG.md +782 -0
- package/node_modules/prosemirror-model/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-model/LICENSE +19 -0
- package/node_modules/prosemirror-model/README.md +29 -0
- package/node_modules/prosemirror-model/dist/index.cjs +2911 -0
- package/node_modules/prosemirror-model/dist/index.d.cts +1683 -0
- package/node_modules/prosemirror-model/dist/index.d.ts +1683 -0
- package/node_modules/prosemirror-model/dist/index.js +3463 -0
- package/node_modules/prosemirror-model/package.json +38 -0
- package/node_modules/prosemirror-schema-list/.tern-project +8 -0
- package/node_modules/prosemirror-schema-list/CHANGELOG.md +140 -0
- package/node_modules/prosemirror-schema-list/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-schema-list/LICENSE +19 -0
- package/node_modules/prosemirror-schema-list/README.md +28 -0
- package/node_modules/prosemirror-schema-list/dist/index.cjs +253 -0
- package/node_modules/prosemirror-schema-list/dist/index.d.cts +71 -0
- package/node_modules/prosemirror-schema-list/dist/index.d.ts +71 -0
- package/node_modules/prosemirror-schema-list/dist/index.js +289 -0
- package/node_modules/prosemirror-schema-list/package.json +40 -0
- package/node_modules/prosemirror-state/.tern-project +8 -0
- package/node_modules/prosemirror-state/CHANGELOG.md +296 -0
- package/node_modules/prosemirror-state/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-state/LICENSE +19 -0
- package/node_modules/prosemirror-state/README.md +28 -0
- package/node_modules/prosemirror-state/dist/index.cjs +884 -0
- package/node_modules/prosemirror-state/dist/index.d.cts +709 -0
- package/node_modules/prosemirror-state/dist/index.d.ts +709 -0
- package/node_modules/prosemirror-state/dist/index.js +1002 -0
- package/node_modules/prosemirror-state/package.json +39 -0
- package/node_modules/prosemirror-tables/LICENSE +19 -0
- package/node_modules/prosemirror-tables/README.md +254 -0
- package/node_modules/prosemirror-tables/dist/index.cjs +2683 -0
- package/node_modules/prosemirror-tables/dist/index.d.cts +751 -0
- package/node_modules/prosemirror-tables/dist/index.d.ts +751 -0
- package/node_modules/prosemirror-tables/dist/index.js +2626 -0
- package/node_modules/prosemirror-tables/package.json +80 -0
- package/node_modules/prosemirror-tables/style/tables.css +48 -0
- package/node_modules/prosemirror-transform/.tern-project +8 -0
- package/node_modules/prosemirror-transform/CHANGELOG.md +530 -0
- package/node_modules/prosemirror-transform/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-transform/LICENSE +19 -0
- package/node_modules/prosemirror-transform/README.md +29 -0
- package/node_modules/prosemirror-transform/dist/index.cjs +2014 -0
- package/node_modules/prosemirror-transform/dist/index.d.cts +857 -0
- package/node_modules/prosemirror-transform/dist/index.d.ts +857 -0
- package/node_modules/prosemirror-transform/dist/index.js +2272 -0
- package/node_modules/prosemirror-transform/package.json +37 -0
- package/node_modules/prosemirror-view/.tern-project +8 -0
- package/node_modules/prosemirror-view/CHANGELOG.md +2543 -0
- package/node_modules/prosemirror-view/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-view/LICENSE +19 -0
- package/node_modules/prosemirror-view/README.md +28 -0
- package/node_modules/prosemirror-view/dist/index.cjs +5549 -0
- package/node_modules/prosemirror-view/dist/index.d.cts +913 -0
- package/node_modules/prosemirror-view/dist/index.d.ts +913 -0
- package/node_modules/prosemirror-view/dist/index.js +6053 -0
- package/node_modules/prosemirror-view/package.json +43 -0
- package/node_modules/prosemirror-view/style/prosemirror.css +54 -0
- package/node_modules/rope-sequence/LICENSE +19 -0
- package/node_modules/rope-sequence/README.md +63 -0
- package/node_modules/rope-sequence/dist/index.cjs +209 -0
- package/node_modules/rope-sequence/dist/index.d.cts +11 -0
- package/node_modules/rope-sequence/dist/index.d.ts +11 -0
- package/node_modules/rope-sequence/dist/index.js +207 -0
- package/node_modules/rope-sequence/index.js +190 -0
- package/node_modules/rope-sequence/package.json +34 -0
- package/node_modules/rope-sequence/test.js +78 -0
- package/node_modules/use-sync-external-store/LICENSE +21 -0
- package/node_modules/use-sync-external-store/README.md +5 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +97 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +85 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +95 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +88 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.js +59 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +66 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +96 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +84 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js +27 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.js +13 -0
- package/node_modules/use-sync-external-store/index.js +7 -0
- package/node_modules/use-sync-external-store/package.json +43 -0
- package/node_modules/use-sync-external-store/shim/index.js +7 -0
- package/node_modules/use-sync-external-store/shim/index.native.js +7 -0
- package/node_modules/use-sync-external-store/shim/with-selector.js +7 -0
- package/node_modules/use-sync-external-store/with-selector.js +7 -0
- package/node_modules/w3c-keyname/.tern-port +1 -0
- package/node_modules/w3c-keyname/LICENSE +19 -0
- package/node_modules/w3c-keyname/README.md +18 -0
- package/node_modules/w3c-keyname/index.cjs +127 -0
- package/node_modules/w3c-keyname/index.d.cts +5 -0
- package/node_modules/w3c-keyname/index.d.ts +5 -0
- package/node_modules/w3c-keyname/index.js +119 -0
- package/node_modules/w3c-keyname/package.json +37 -0
- package/package.json +79 -4
- package/src/Editor.tsx +425 -0
- package/src/ask.tsx +154 -0
- package/src/basic.tsx +149 -0
- package/src/blockMeta.ts +42 -0
- package/src/blockops.ts +179 -0
- package/src/blocks.tsx +189 -0
- package/src/boundary.tsx +17 -0
- package/src/content.ts +22 -0
- package/src/dynamic.tsx +105 -0
- package/src/editor.css +345 -0
- package/src/extensions.ts +78 -0
- package/src/handle.tsx +188 -0
- package/src/handles.tsx +149 -0
- package/src/index.ts +29 -0
- package/src/insert.ts +9 -0
- package/src/inserter.tsx +163 -0
- package/src/inspector.tsx +237 -0
- package/src/labels.ts +135 -0
- package/src/layout.tsx +174 -0
- package/src/layoutUi.tsx +226 -0
- package/src/media.ts +31 -0
- package/src/nodes.tsx +107 -0
- package/src/outline.tsx +124 -0
- package/src/panels.ts +59 -0
- package/src/paste.ts +100 -0
- package/src/patterns.ts +129 -0
- package/src/rank.ts +22 -0
- package/src/registry.ts +20 -0
- package/src/styleattr.ts +55 -0
- package/src/stylepanel.tsx +275 -0
- package/src/synced.tsx +128 -0
- package/src/toolbar.tsx +238 -0
- package/src/types.ts +55 -0
- package/src/unknown.tsx +74 -0
- package/src/util.ts +3 -0
|
@@ -0,0 +1,1396 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
//#endregion
|
|
25
|
+
let react = require("react");
|
|
26
|
+
react = __toESM(react, 1);
|
|
27
|
+
let _tiptap_pm_state = require("@tiptap/pm/state");
|
|
28
|
+
let react_dom = require("react-dom");
|
|
29
|
+
react_dom = __toESM(react_dom, 1);
|
|
30
|
+
let use_sync_external_store_shim_index_js = require("use-sync-external-store/shim/index.js");
|
|
31
|
+
let _tiptap_core = require("@tiptap/core");
|
|
32
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
let fast_equals = require("fast-equals");
|
|
34
|
+
let use_sync_external_store_shim_with_selector_js = require("use-sync-external-store/shim/with-selector.js");
|
|
35
|
+
//#region src/handleMobileEnter.ts
|
|
36
|
+
function handleMobileEnter(editor, event) {
|
|
37
|
+
var _root$getSelection, _root$getSelection2;
|
|
38
|
+
if (editor.isDestroyed || event.defaultPrevented || !event.cancelable || !editor.isEditable || event.inputType !== "insertParagraph" && event.inputType !== "insertLineBreak" || !(0, _tiptap_core.isiOS)() && !(0, _tiptap_core.isAndroid)()) return;
|
|
39
|
+
const view = editor.view;
|
|
40
|
+
const root = view.root;
|
|
41
|
+
const selection = (_root$getSelection = (_root$getSelection2 = root.getSelection) === null || _root$getSelection2 === void 0 ? void 0 : _root$getSelection2.call(root)) !== null && _root$getSelection !== void 0 ? _root$getSelection : view.dom.ownerDocument.getSelection();
|
|
42
|
+
const anchor = selection === null || selection === void 0 ? void 0 : selection.anchorNode;
|
|
43
|
+
const element = (anchor === null || anchor === void 0 ? void 0 : anchor.nodeType) === 1 ? anchor : anchor === null || anchor === void 0 ? void 0 : anchor.parentElement;
|
|
44
|
+
const contentDOM = element === null || element === void 0 ? void 0 : element.closest("[data-node-view-content-react]");
|
|
45
|
+
if (!contentDOM || !view.dom.contains(contentDOM)) return;
|
|
46
|
+
const lastKeyCode = view.input.lastKeyCode;
|
|
47
|
+
if (lastKeyCode === 13) view.input.lastKeyCode = null;
|
|
48
|
+
view.domObserver.forceFlush();
|
|
49
|
+
view.domObserver.flush();
|
|
50
|
+
const keyEvent = new KeyboardEvent("keydown", {
|
|
51
|
+
key: "Enter",
|
|
52
|
+
code: "Enter",
|
|
53
|
+
keyCode: 13,
|
|
54
|
+
shiftKey: event.inputType === "insertLineBreak",
|
|
55
|
+
bubbles: true,
|
|
56
|
+
cancelable: true
|
|
57
|
+
});
|
|
58
|
+
if (view.someProp("handleKeyDown", (handleKeyDown) => handleKeyDown(view, keyEvent))) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
view.input.lastIOSEnter = 0;
|
|
61
|
+
clearTimeout(view.input.lastIOSEnterFallbackTimeout);
|
|
62
|
+
} else if (lastKeyCode === 13) view.input.lastKeyCode = lastKeyCode;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/EditorContent.tsx
|
|
66
|
+
const mobileEnterPluginKey = new _tiptap_pm_state.PluginKey("reactMobileEnter");
|
|
67
|
+
const mergeRefs = (...refs) => {
|
|
68
|
+
return (node) => {
|
|
69
|
+
refs.forEach((ref) => {
|
|
70
|
+
if (typeof ref === "function") ref(node);
|
|
71
|
+
else if (ref) ref.current = node;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* This component renders all of the editor's node views.
|
|
77
|
+
*/
|
|
78
|
+
const Portals = ({ contentComponent }) => {
|
|
79
|
+
const renderers = (0, use_sync_external_store_shim_index_js.useSyncExternalStore)(contentComponent.subscribe, contentComponent.getSnapshot, contentComponent.getServerSnapshot);
|
|
80
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Object.values(renderers) });
|
|
81
|
+
};
|
|
82
|
+
function createContentComponent() {
|
|
83
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
84
|
+
let renderers = {};
|
|
85
|
+
let isNotificationQueued = false;
|
|
86
|
+
const notifySubscribers = () => {
|
|
87
|
+
if (isNotificationQueued || !subscribers.size) return;
|
|
88
|
+
isNotificationQueued = true;
|
|
89
|
+
queueMicrotask(() => {
|
|
90
|
+
isNotificationQueued = false;
|
|
91
|
+
subscribers.forEach((subscriber) => subscriber());
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
/**
|
|
96
|
+
* Subscribe to the editor instance's changes.
|
|
97
|
+
*/
|
|
98
|
+
subscribe(callback) {
|
|
99
|
+
subscribers.add(callback);
|
|
100
|
+
return () => {
|
|
101
|
+
subscribers.delete(callback);
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
getSnapshot() {
|
|
105
|
+
return renderers;
|
|
106
|
+
},
|
|
107
|
+
getServerSnapshot() {
|
|
108
|
+
return renderers;
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Adds a new NodeView Renderer to the editor.
|
|
112
|
+
*/
|
|
113
|
+
setRenderer(id, renderer) {
|
|
114
|
+
renderers = {
|
|
115
|
+
...renderers,
|
|
116
|
+
[id]: react_dom.default.createPortal(renderer.reactElement, renderer.element, id)
|
|
117
|
+
};
|
|
118
|
+
notifySubscribers();
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Removes a NodeView Renderer from the editor.
|
|
122
|
+
*/
|
|
123
|
+
removeRenderer(id) {
|
|
124
|
+
const nextRenderers = { ...renderers };
|
|
125
|
+
delete nextRenderers[id];
|
|
126
|
+
renderers = nextRenderers;
|
|
127
|
+
notifySubscribers();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
var PureEditorContent = class extends react.default.Component {
|
|
132
|
+
constructor(props) {
|
|
133
|
+
super(props);
|
|
134
|
+
this.editorContentRef = react.default.createRef();
|
|
135
|
+
}
|
|
136
|
+
componentDidMount() {
|
|
137
|
+
this.init();
|
|
138
|
+
}
|
|
139
|
+
componentDidUpdate() {
|
|
140
|
+
this.init();
|
|
141
|
+
}
|
|
142
|
+
init() {
|
|
143
|
+
var _editor$view$dom;
|
|
144
|
+
const editor = this.props.editor;
|
|
145
|
+
if (editor && !editor.isDestroyed && ((_editor$view$dom = editor.view.dom) === null || _editor$view$dom === void 0 ? void 0 : _editor$view$dom.parentNode)) {
|
|
146
|
+
if (editor.contentComponent) return;
|
|
147
|
+
const element = this.editorContentRef.current;
|
|
148
|
+
element.append(...editor.view.dom.parentNode.childNodes);
|
|
149
|
+
editor.setOptions({ element });
|
|
150
|
+
editor.contentComponent = createContentComponent();
|
|
151
|
+
editor.createNodeViews();
|
|
152
|
+
editor.registerPlugin(new _tiptap_pm_state.Plugin({
|
|
153
|
+
key: mobileEnterPluginKey,
|
|
154
|
+
props: { handleDOMEvents: { beforeinput: (_view, event) => handleMobileEnter(editor, event) } }
|
|
155
|
+
}));
|
|
156
|
+
editor.isEditorContentInitialized = true;
|
|
157
|
+
this.forceUpdate();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
componentWillUnmount() {
|
|
161
|
+
const editor = this.props.editor;
|
|
162
|
+
if (!editor) return;
|
|
163
|
+
editor.isEditorContentInitialized = false;
|
|
164
|
+
if (!editor.isDestroyed) {
|
|
165
|
+
editor.unregisterPlugin(mobileEnterPluginKey);
|
|
166
|
+
editor.view.setProps({ nodeViews: {} });
|
|
167
|
+
}
|
|
168
|
+
editor.contentComponent = null;
|
|
169
|
+
try {
|
|
170
|
+
var _editor$view$dom2;
|
|
171
|
+
if (!((_editor$view$dom2 = editor.view.dom) === null || _editor$view$dom2 === void 0 ? void 0 : _editor$view$dom2.parentNode)) return;
|
|
172
|
+
const newElement = document.createElement("div");
|
|
173
|
+
newElement.append(...editor.view.dom.parentNode.childNodes);
|
|
174
|
+
editor.setOptions({ element: newElement });
|
|
175
|
+
} catch {}
|
|
176
|
+
}
|
|
177
|
+
render() {
|
|
178
|
+
const { editor, innerRef, ...rest } = this.props;
|
|
179
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
180
|
+
ref: mergeRefs(innerRef, this.editorContentRef),
|
|
181
|
+
...rest
|
|
182
|
+
}), (editor === null || editor === void 0 ? void 0 : editor.contentComponent) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Portals, { contentComponent: editor.contentComponent })] });
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const EditorContentWithKey = (0, react.forwardRef)((props, ref) => {
|
|
186
|
+
const key = react.default.useMemo(() => {
|
|
187
|
+
return Math.floor(Math.random() * 4294967295).toString();
|
|
188
|
+
}, [props.editor]);
|
|
189
|
+
return react.default.createElement(PureEditorContent, {
|
|
190
|
+
key,
|
|
191
|
+
innerRef: ref,
|
|
192
|
+
...props
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
const EditorContent = react.default.memo(EditorContentWithKey);
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/useEditorState.ts
|
|
198
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
199
|
+
/**
|
|
200
|
+
* To synchronize the editor instance with the component state,
|
|
201
|
+
* we need to create a separate instance that is not affected by the component re-renders.
|
|
202
|
+
*/
|
|
203
|
+
var EditorStateManager = class {
|
|
204
|
+
constructor(initialEditor) {
|
|
205
|
+
this.transactionNumber = 0;
|
|
206
|
+
this.lastTransactionNumber = 0;
|
|
207
|
+
this.subscribers = /* @__PURE__ */ new Set();
|
|
208
|
+
this.editor = initialEditor;
|
|
209
|
+
this.lastSnapshot = {
|
|
210
|
+
editor: initialEditor,
|
|
211
|
+
transactionNumber: 0
|
|
212
|
+
};
|
|
213
|
+
this.getSnapshot = this.getSnapshot.bind(this);
|
|
214
|
+
this.getServerSnapshot = this.getServerSnapshot.bind(this);
|
|
215
|
+
this.watch = this.watch.bind(this);
|
|
216
|
+
this.subscribe = this.subscribe.bind(this);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Get the current editor instance.
|
|
220
|
+
*/
|
|
221
|
+
getSnapshot() {
|
|
222
|
+
if (this.transactionNumber === this.lastTransactionNumber) return this.lastSnapshot;
|
|
223
|
+
this.lastTransactionNumber = this.transactionNumber;
|
|
224
|
+
this.lastSnapshot = {
|
|
225
|
+
editor: this.editor,
|
|
226
|
+
transactionNumber: this.transactionNumber
|
|
227
|
+
};
|
|
228
|
+
return this.lastSnapshot;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Always disable the editor on the server-side.
|
|
232
|
+
*/
|
|
233
|
+
getServerSnapshot() {
|
|
234
|
+
return {
|
|
235
|
+
editor: null,
|
|
236
|
+
transactionNumber: 0
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Subscribe to the editor instance's changes.
|
|
241
|
+
*/
|
|
242
|
+
subscribe(callback) {
|
|
243
|
+
this.subscribers.add(callback);
|
|
244
|
+
return () => {
|
|
245
|
+
this.subscribers.delete(callback);
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Watch the editor instance for changes.
|
|
250
|
+
*/
|
|
251
|
+
watch(nextEditor) {
|
|
252
|
+
this.editor = nextEditor;
|
|
253
|
+
if (this.editor) {
|
|
254
|
+
/**
|
|
255
|
+
* This will force a re-render when the editor state changes.
|
|
256
|
+
* This is to support things like `editor.can().toggleBold()` in components that `useEditor`.
|
|
257
|
+
* This could be more efficient, but it's a good trade-off for now.
|
|
258
|
+
*/
|
|
259
|
+
let lastTransaction;
|
|
260
|
+
const fn = (props) => {
|
|
261
|
+
if ((props === null || props === void 0 ? void 0 : props.transaction) !== void 0 && props.transaction === lastTransaction) return;
|
|
262
|
+
lastTransaction = props === null || props === void 0 ? void 0 : props.transaction;
|
|
263
|
+
this.transactionNumber += 1;
|
|
264
|
+
this.subscribers.forEach((callback) => callback());
|
|
265
|
+
};
|
|
266
|
+
const currentEditor = this.editor;
|
|
267
|
+
currentEditor.on("transaction", fn);
|
|
268
|
+
currentEditor.on("update", fn);
|
|
269
|
+
return () => {
|
|
270
|
+
currentEditor.off("transaction", fn);
|
|
271
|
+
currentEditor.off("update", fn);
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* This hook allows you to watch for changes on the editor instance.
|
|
278
|
+
* It will allow you to select a part of the editor state and re-render the component when it changes.
|
|
279
|
+
* @example
|
|
280
|
+
* ```tsx
|
|
281
|
+
* const editor = useEditor({...options})
|
|
282
|
+
* const { currentSelection } = useEditorState({
|
|
283
|
+
* editor,
|
|
284
|
+
* selector: snapshot => ({ currentSelection: snapshot.editor.state.selection }),
|
|
285
|
+
* })
|
|
286
|
+
*/
|
|
287
|
+
function useEditorState(options) {
|
|
288
|
+
var _options$equalityFn;
|
|
289
|
+
const [editorStateManager] = (0, react.useState)(() => new EditorStateManager(options.editor));
|
|
290
|
+
const selectedState = (0, use_sync_external_store_shim_with_selector_js.useSyncExternalStoreWithSelector)(editorStateManager.subscribe, editorStateManager.getSnapshot, editorStateManager.getServerSnapshot, options.selector, (_options$equalityFn = options.equalityFn) !== null && _options$equalityFn !== void 0 ? _options$equalityFn : fast_equals.circularDeepEqual);
|
|
291
|
+
useIsomorphicLayoutEffect(() => {
|
|
292
|
+
return editorStateManager.watch(options.editor);
|
|
293
|
+
}, [options.editor, editorStateManager]);
|
|
294
|
+
(0, react.useDebugValue)(selectedState);
|
|
295
|
+
return selectedState;
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/useEditor.ts
|
|
299
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
300
|
+
const isSSR = typeof window === "undefined";
|
|
301
|
+
const isNext = isSSR || Boolean(typeof window !== "undefined" && window.next);
|
|
302
|
+
/**
|
|
303
|
+
* This class handles the creation, destruction, and re-creation of the editor instance.
|
|
304
|
+
*/
|
|
305
|
+
var EditorInstanceManager = class EditorInstanceManager {
|
|
306
|
+
constructor(options) {
|
|
307
|
+
this.editor = null;
|
|
308
|
+
this.subscriptions = /* @__PURE__ */ new Set();
|
|
309
|
+
this.isComponentMounted = false;
|
|
310
|
+
this.previousDeps = null;
|
|
311
|
+
this.instanceId = "";
|
|
312
|
+
this.options = options;
|
|
313
|
+
this.subscriptions = /* @__PURE__ */ new Set();
|
|
314
|
+
this.setEditor(this.getInitialEditor());
|
|
315
|
+
this.scheduleDestroy();
|
|
316
|
+
this.getEditor = this.getEditor.bind(this);
|
|
317
|
+
this.getServerSnapshot = this.getServerSnapshot.bind(this);
|
|
318
|
+
this.subscribe = this.subscribe.bind(this);
|
|
319
|
+
this.refreshEditorInstance = this.refreshEditorInstance.bind(this);
|
|
320
|
+
this.scheduleDestroy = this.scheduleDestroy.bind(this);
|
|
321
|
+
this.onRender = this.onRender.bind(this);
|
|
322
|
+
this.createEditor = this.createEditor.bind(this);
|
|
323
|
+
}
|
|
324
|
+
setEditor(editor) {
|
|
325
|
+
this.editor = editor;
|
|
326
|
+
this.instanceId = Math.random().toString(36).slice(2, 9);
|
|
327
|
+
this.subscriptions.forEach((cb) => cb());
|
|
328
|
+
}
|
|
329
|
+
getInitialEditor() {
|
|
330
|
+
const explicit = this.options.current.immediatelyRender;
|
|
331
|
+
let immediatelyRender = explicit !== null && explicit !== void 0 ? explicit : true;
|
|
332
|
+
if (isSSR) {
|
|
333
|
+
if (immediatelyRender && isDev) console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches");
|
|
334
|
+
immediatelyRender = false;
|
|
335
|
+
} else if (isNext && explicit === void 0) {
|
|
336
|
+
immediatelyRender = false;
|
|
337
|
+
if (isDev) console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.");
|
|
338
|
+
}
|
|
339
|
+
return immediatelyRender ? this.createEditor() : null;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Create a new editor instance. And attach event listeners.
|
|
343
|
+
*/
|
|
344
|
+
createEditor() {
|
|
345
|
+
const optionsToApply = {
|
|
346
|
+
...this.options.current,
|
|
347
|
+
onBeforeCreate: (...args) => {
|
|
348
|
+
var _this$options$current, _this$options$current2;
|
|
349
|
+
return (_this$options$current = (_this$options$current2 = this.options.current).onBeforeCreate) === null || _this$options$current === void 0 ? void 0 : _this$options$current.call(_this$options$current2, ...args);
|
|
350
|
+
},
|
|
351
|
+
onBlur: (...args) => {
|
|
352
|
+
var _this$options$current3, _this$options$current4;
|
|
353
|
+
return (_this$options$current3 = (_this$options$current4 = this.options.current).onBlur) === null || _this$options$current3 === void 0 ? void 0 : _this$options$current3.call(_this$options$current4, ...args);
|
|
354
|
+
},
|
|
355
|
+
onCreate: (...args) => {
|
|
356
|
+
var _this$options$current5, _this$options$current6;
|
|
357
|
+
return (_this$options$current5 = (_this$options$current6 = this.options.current).onCreate) === null || _this$options$current5 === void 0 ? void 0 : _this$options$current5.call(_this$options$current6, ...args);
|
|
358
|
+
},
|
|
359
|
+
onDestroy: (...args) => {
|
|
360
|
+
var _this$options$current7, _this$options$current8;
|
|
361
|
+
return (_this$options$current7 = (_this$options$current8 = this.options.current).onDestroy) === null || _this$options$current7 === void 0 ? void 0 : _this$options$current7.call(_this$options$current8, ...args);
|
|
362
|
+
},
|
|
363
|
+
onFocus: (...args) => {
|
|
364
|
+
var _this$options$current9, _this$options$current10;
|
|
365
|
+
return (_this$options$current9 = (_this$options$current10 = this.options.current).onFocus) === null || _this$options$current9 === void 0 ? void 0 : _this$options$current9.call(_this$options$current10, ...args);
|
|
366
|
+
},
|
|
367
|
+
onSelectionUpdate: (...args) => {
|
|
368
|
+
var _this$options$current11, _this$options$current12;
|
|
369
|
+
return (_this$options$current11 = (_this$options$current12 = this.options.current).onSelectionUpdate) === null || _this$options$current11 === void 0 ? void 0 : _this$options$current11.call(_this$options$current12, ...args);
|
|
370
|
+
},
|
|
371
|
+
onTransaction: (...args) => {
|
|
372
|
+
var _this$options$current13, _this$options$current14;
|
|
373
|
+
return (_this$options$current13 = (_this$options$current14 = this.options.current).onTransaction) === null || _this$options$current13 === void 0 ? void 0 : _this$options$current13.call(_this$options$current14, ...args);
|
|
374
|
+
},
|
|
375
|
+
onUpdate: (...args) => {
|
|
376
|
+
var _this$options$current15, _this$options$current16;
|
|
377
|
+
return (_this$options$current15 = (_this$options$current16 = this.options.current).onUpdate) === null || _this$options$current15 === void 0 ? void 0 : _this$options$current15.call(_this$options$current16, ...args);
|
|
378
|
+
},
|
|
379
|
+
onContentError: (...args) => {
|
|
380
|
+
var _this$options$current17, _this$options$current18;
|
|
381
|
+
return (_this$options$current17 = (_this$options$current18 = this.options.current).onContentError) === null || _this$options$current17 === void 0 ? void 0 : _this$options$current17.call(_this$options$current18, ...args);
|
|
382
|
+
},
|
|
383
|
+
onDrop: (...args) => {
|
|
384
|
+
var _this$options$current19, _this$options$current20;
|
|
385
|
+
return (_this$options$current19 = (_this$options$current20 = this.options.current).onDrop) === null || _this$options$current19 === void 0 ? void 0 : _this$options$current19.call(_this$options$current20, ...args);
|
|
386
|
+
},
|
|
387
|
+
onPaste: (...args) => {
|
|
388
|
+
var _this$options$current21, _this$options$current22;
|
|
389
|
+
return (_this$options$current21 = (_this$options$current22 = this.options.current).onPaste) === null || _this$options$current21 === void 0 ? void 0 : _this$options$current21.call(_this$options$current22, ...args);
|
|
390
|
+
},
|
|
391
|
+
onDelete: (...args) => {
|
|
392
|
+
var _this$options$current23, _this$options$current24;
|
|
393
|
+
return (_this$options$current23 = (_this$options$current24 = this.options.current).onDelete) === null || _this$options$current23 === void 0 ? void 0 : _this$options$current23.call(_this$options$current24, ...args);
|
|
394
|
+
},
|
|
395
|
+
onMount: (...args) => {
|
|
396
|
+
var _this$options$current25, _this$options$current26;
|
|
397
|
+
return (_this$options$current25 = (_this$options$current26 = this.options.current).onMount) === null || _this$options$current25 === void 0 ? void 0 : _this$options$current25.call(_this$options$current26, ...args);
|
|
398
|
+
},
|
|
399
|
+
onUnmount: (...args) => {
|
|
400
|
+
var _this$options$current27, _this$options$current28;
|
|
401
|
+
return (_this$options$current27 = (_this$options$current28 = this.options.current).onUnmount) === null || _this$options$current27 === void 0 ? void 0 : _this$options$current27.call(_this$options$current28, ...args);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
return new _tiptap_core.Editor(optionsToApply);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Get the current editor instance.
|
|
408
|
+
*/
|
|
409
|
+
getEditor() {
|
|
410
|
+
return this.editor;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Always disable the editor on the server-side.
|
|
414
|
+
*/
|
|
415
|
+
getServerSnapshot() {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Subscribe to the editor instance's changes.
|
|
420
|
+
*/
|
|
421
|
+
subscribe(onStoreChange) {
|
|
422
|
+
this.subscriptions.add(onStoreChange);
|
|
423
|
+
return () => {
|
|
424
|
+
this.subscriptions.delete(onStoreChange);
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
static compareOptions(a, b) {
|
|
428
|
+
return Object.keys(a).every((key) => {
|
|
429
|
+
if ([
|
|
430
|
+
"onCreate",
|
|
431
|
+
"onBeforeCreate",
|
|
432
|
+
"onDestroy",
|
|
433
|
+
"onUpdate",
|
|
434
|
+
"onTransaction",
|
|
435
|
+
"onFocus",
|
|
436
|
+
"onBlur",
|
|
437
|
+
"onSelectionUpdate",
|
|
438
|
+
"onContentError",
|
|
439
|
+
"onDrop",
|
|
440
|
+
"onPaste"
|
|
441
|
+
].includes(key)) return true;
|
|
442
|
+
if (key === "extensions" && a.extensions && b.extensions) {
|
|
443
|
+
if (a.extensions.length !== b.extensions.length) return false;
|
|
444
|
+
return a.extensions.every((extension, index) => {
|
|
445
|
+
var _b$extensions;
|
|
446
|
+
if (extension !== ((_b$extensions = b.extensions) === null || _b$extensions === void 0 ? void 0 : _b$extensions[index])) return false;
|
|
447
|
+
return true;
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
if (a[key] !== b[key]) return false;
|
|
451
|
+
return true;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* On each render, we will create, update, or destroy the editor instance.
|
|
456
|
+
* @param deps The dependencies to watch for changes
|
|
457
|
+
* @returns A cleanup function
|
|
458
|
+
*/
|
|
459
|
+
onRender(deps) {
|
|
460
|
+
return () => {
|
|
461
|
+
this.isComponentMounted = true;
|
|
462
|
+
clearTimeout(this.scheduledDestructionTimeout);
|
|
463
|
+
if (this.editor && !this.editor.isDestroyed && deps.length === 0) {
|
|
464
|
+
if (!EditorInstanceManager.compareOptions(this.options.current, this.editor.options)) this.editor.setOptions({
|
|
465
|
+
...this.options.current,
|
|
466
|
+
editable: this.editor.isEditable
|
|
467
|
+
});
|
|
468
|
+
} else this.refreshEditorInstance(deps);
|
|
469
|
+
return () => {
|
|
470
|
+
this.isComponentMounted = false;
|
|
471
|
+
this.scheduleDestroy();
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Recreate the editor instance if the dependencies have changed.
|
|
477
|
+
*/
|
|
478
|
+
refreshEditorInstance(deps) {
|
|
479
|
+
if (this.editor && !this.editor.isDestroyed) {
|
|
480
|
+
if (this.previousDeps === null) {
|
|
481
|
+
this.previousDeps = deps;
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (this.previousDeps.length === deps.length && this.previousDeps.every((dep, index) => dep === deps[index])) return;
|
|
485
|
+
}
|
|
486
|
+
if (this.editor && !this.editor.isDestroyed) this.editor.destroy();
|
|
487
|
+
this.setEditor(this.createEditor());
|
|
488
|
+
this.previousDeps = deps;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Schedule the destruction of the editor instance.
|
|
492
|
+
* This will only destroy the editor if it was not mounted on the next tick.
|
|
493
|
+
* This is to avoid destroying the editor instance when it's actually still mounted.
|
|
494
|
+
*/
|
|
495
|
+
scheduleDestroy() {
|
|
496
|
+
const currentInstanceId = this.instanceId;
|
|
497
|
+
const currentEditor = this.editor;
|
|
498
|
+
this.scheduledDestructionTimeout = setTimeout(() => {
|
|
499
|
+
if (this.isComponentMounted && this.instanceId === currentInstanceId) {
|
|
500
|
+
if (currentEditor) currentEditor.setOptions(this.options.current);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (currentEditor && !currentEditor.isDestroyed) {
|
|
504
|
+
currentEditor.destroy();
|
|
505
|
+
if (this.instanceId === currentInstanceId) this.setEditor(null);
|
|
506
|
+
}
|
|
507
|
+
}, 1);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
function useEditor(options = {}, deps = []) {
|
|
511
|
+
const mostRecentOptions = (0, react.useRef)(options);
|
|
512
|
+
mostRecentOptions.current = options;
|
|
513
|
+
const [instanceManager] = (0, react.useState)(() => new EditorInstanceManager(mostRecentOptions));
|
|
514
|
+
const editor = (0, use_sync_external_store_shim_index_js.useSyncExternalStore)(instanceManager.subscribe, instanceManager.getEditor, instanceManager.getServerSnapshot);
|
|
515
|
+
(0, react.useDebugValue)(editor);
|
|
516
|
+
(0, react.useEffect)(instanceManager.onRender(deps));
|
|
517
|
+
useEditorState({
|
|
518
|
+
editor,
|
|
519
|
+
selector: ({ transactionNumber }) => {
|
|
520
|
+
if (options.shouldRerenderOnTransaction === false || options.shouldRerenderOnTransaction === void 0) return null;
|
|
521
|
+
if (options.immediatelyRender && transactionNumber === 0) return 0;
|
|
522
|
+
return transactionNumber + 1;
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
return editor;
|
|
526
|
+
}
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region src/Context.tsx
|
|
529
|
+
const EditorContext = (0, react.createContext)({ editor: null });
|
|
530
|
+
const EditorConsumer = EditorContext.Consumer;
|
|
531
|
+
/**
|
|
532
|
+
* A hook to get the current editor instance.
|
|
533
|
+
*/
|
|
534
|
+
const useCurrentEditor = () => (0, react.useContext)(EditorContext);
|
|
535
|
+
/**
|
|
536
|
+
* This is the provider component for the editor.
|
|
537
|
+
* It allows the editor to be accessible across the entire component tree
|
|
538
|
+
* with `useCurrentEditor`.
|
|
539
|
+
*/
|
|
540
|
+
function EditorProvider({ children, slotAfter, slotBefore, editorContainerProps = {}, ...editorOptions }) {
|
|
541
|
+
const editor = useEditor(editorOptions);
|
|
542
|
+
const contextValue = (0, react.useMemo)(() => ({ editor }), [editor]);
|
|
543
|
+
if (!editor) return null;
|
|
544
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(EditorContext.Provider, {
|
|
545
|
+
value: contextValue,
|
|
546
|
+
children: [
|
|
547
|
+
slotBefore,
|
|
548
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorConsumer, { children: ({ editor: currentEditor }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorContent, {
|
|
549
|
+
editor: currentEditor,
|
|
550
|
+
...editorContainerProps
|
|
551
|
+
}) }),
|
|
552
|
+
children,
|
|
553
|
+
slotAfter
|
|
554
|
+
]
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region src/useReactNodeView.ts
|
|
559
|
+
const ReactNodeViewContext = (0, react.createContext)({
|
|
560
|
+
onDragStart: () => {},
|
|
561
|
+
nodeViewContentChildren: void 0,
|
|
562
|
+
nodeViewContentRef: () => {}
|
|
563
|
+
});
|
|
564
|
+
const ReactNodeViewContentProvider = ({ children, content }) => {
|
|
565
|
+
return (0, react.createElement)(ReactNodeViewContext.Provider, { value: { nodeViewContentChildren: content } }, children);
|
|
566
|
+
};
|
|
567
|
+
const useReactNodeView = () => (0, react.useContext)(ReactNodeViewContext);
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region src/NodeViewContent.tsx
|
|
570
|
+
function NodeViewContent({ as: Tag = "div", ...props }) {
|
|
571
|
+
const { nodeViewContentRef, nodeViewContentChildren } = useReactNodeView();
|
|
572
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
573
|
+
...props,
|
|
574
|
+
ref: nodeViewContentRef,
|
|
575
|
+
"data-node-view-content": "",
|
|
576
|
+
style: {
|
|
577
|
+
whiteSpace: "pre-wrap",
|
|
578
|
+
...props.style
|
|
579
|
+
},
|
|
580
|
+
children: nodeViewContentChildren
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/NodeViewWrapper.tsx
|
|
585
|
+
const NodeViewWrapper = react.default.forwardRef((props, ref) => {
|
|
586
|
+
const { onDragStart } = useReactNodeView();
|
|
587
|
+
const Tag = props.as || "div";
|
|
588
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
589
|
+
...props,
|
|
590
|
+
ref,
|
|
591
|
+
"data-node-view-wrapper": "",
|
|
592
|
+
onDragStart,
|
|
593
|
+
style: {
|
|
594
|
+
whiteSpace: "normal",
|
|
595
|
+
...props.style
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/ReactRenderer.tsx
|
|
601
|
+
/**
|
|
602
|
+
* Check if a component is a class component.
|
|
603
|
+
* @param Component
|
|
604
|
+
* @returns {boolean}
|
|
605
|
+
*/
|
|
606
|
+
function isClassComponent(Component) {
|
|
607
|
+
return !!(typeof Component === "function" && Component.prototype && Component.prototype.isReactComponent);
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Check if a component is a forward ref component.
|
|
611
|
+
* @param Component
|
|
612
|
+
* @returns {boolean}
|
|
613
|
+
*/
|
|
614
|
+
function isForwardRefComponent(Component) {
|
|
615
|
+
return !!(typeof Component === "object" && Component.$$typeof && (Component.$$typeof.toString() === "Symbol(react.forward_ref)" || Component.$$typeof.description === "react.forward_ref"));
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Check if a component is a memoized component.
|
|
619
|
+
* @param Component
|
|
620
|
+
* @returns {boolean}
|
|
621
|
+
*/
|
|
622
|
+
function isMemoComponent(Component) {
|
|
623
|
+
return !!(typeof Component === "object" && Component.$$typeof && (Component.$$typeof.toString() === "Symbol(react.memo)" || Component.$$typeof.description === "react.memo"));
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Check if a component can safely receive a ref prop.
|
|
627
|
+
* This includes class components, forwardRef components, and memoized components
|
|
628
|
+
* that wrap forwardRef or class components.
|
|
629
|
+
* @param Component
|
|
630
|
+
* @returns {boolean}
|
|
631
|
+
*/
|
|
632
|
+
function canReceiveRef(Component) {
|
|
633
|
+
if (isClassComponent(Component)) return true;
|
|
634
|
+
if (isForwardRefComponent(Component)) return true;
|
|
635
|
+
if (isMemoComponent(Component)) {
|
|
636
|
+
const wrappedComponent = Component.type;
|
|
637
|
+
if (wrappedComponent) return isClassComponent(wrappedComponent) || isForwardRefComponent(wrappedComponent);
|
|
638
|
+
}
|
|
639
|
+
return false;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Check if we're running React 19+ by detecting if function components support ref props
|
|
643
|
+
* @returns {boolean}
|
|
644
|
+
*/
|
|
645
|
+
function isReact19Plus() {
|
|
646
|
+
try {
|
|
647
|
+
if (react.version) return parseInt(react.version.split(".")[0], 10) >= 19;
|
|
648
|
+
} catch {}
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* The ReactRenderer class. It's responsible for rendering React components inside the editor.
|
|
653
|
+
* @example
|
|
654
|
+
* new ReactRenderer(MyComponent, {
|
|
655
|
+
* editor,
|
|
656
|
+
* props: {
|
|
657
|
+
* foo: 'bar',
|
|
658
|
+
* },
|
|
659
|
+
* as: 'span',
|
|
660
|
+
* })
|
|
661
|
+
*/
|
|
662
|
+
var ReactRenderer = class {
|
|
663
|
+
/**
|
|
664
|
+
* Immediately creates element and renders the provided React component.
|
|
665
|
+
*/
|
|
666
|
+
constructor(component, { editor, props = {}, as = "div", className = "" }) {
|
|
667
|
+
this.ref = null;
|
|
668
|
+
this.destroyed = false;
|
|
669
|
+
this.id = Math.floor(Math.random() * 4294967295).toString();
|
|
670
|
+
this.component = component;
|
|
671
|
+
this.editor = editor;
|
|
672
|
+
this.props = props;
|
|
673
|
+
this.element = document.createElement(as);
|
|
674
|
+
this.element.classList.add("react-renderer");
|
|
675
|
+
if (className) this.element.classList.add(...className.split(" "));
|
|
676
|
+
if (this.editor.isEditorContentInitialized) (0, react_dom.flushSync)(() => {
|
|
677
|
+
this.render();
|
|
678
|
+
});
|
|
679
|
+
else queueMicrotask(() => {
|
|
680
|
+
if (this.destroyed) return;
|
|
681
|
+
this.render();
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Render the React component.
|
|
686
|
+
*/
|
|
687
|
+
render() {
|
|
688
|
+
var _editor$contentCompon;
|
|
689
|
+
if (this.destroyed) return;
|
|
690
|
+
const Component = this.component;
|
|
691
|
+
const props = this.props;
|
|
692
|
+
const editor = this.editor;
|
|
693
|
+
const isReact19 = isReact19Plus();
|
|
694
|
+
const componentCanReceiveRef = canReceiveRef(Component);
|
|
695
|
+
const elementProps = { ...props };
|
|
696
|
+
if (elementProps.ref && !(isReact19 || componentCanReceiveRef)) delete elementProps.ref;
|
|
697
|
+
if (!elementProps.ref && (isReact19 || componentCanReceiveRef)) elementProps.ref = (ref) => {
|
|
698
|
+
this.ref = ref;
|
|
699
|
+
};
|
|
700
|
+
this.reactElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, { ...elementProps });
|
|
701
|
+
editor === null || editor === void 0 || (_editor$contentCompon = editor.contentComponent) === null || _editor$contentCompon === void 0 || _editor$contentCompon.setRenderer(this.id, this);
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Re-renders the React component with new props.
|
|
705
|
+
* Skips the render if none of the supplied props actually changed,
|
|
706
|
+
* to avoid unnecessary portal re-creation.
|
|
707
|
+
*/
|
|
708
|
+
updateProps(props = {}) {
|
|
709
|
+
if (this.destroyed) return;
|
|
710
|
+
let changed = false;
|
|
711
|
+
const keys = Object.keys(props);
|
|
712
|
+
for (let i = 0; i < keys.length; i += 1) {
|
|
713
|
+
const key = keys[i];
|
|
714
|
+
if (props[key] !== this.props[key]) {
|
|
715
|
+
changed = true;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (!changed) return;
|
|
720
|
+
this.props = {
|
|
721
|
+
...this.props,
|
|
722
|
+
...props
|
|
723
|
+
};
|
|
724
|
+
this.render();
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Destroy the React component.
|
|
728
|
+
*/
|
|
729
|
+
destroy() {
|
|
730
|
+
var _editor$contentCompon2;
|
|
731
|
+
this.destroyed = true;
|
|
732
|
+
const editor = this.editor;
|
|
733
|
+
editor === null || editor === void 0 || (_editor$contentCompon2 = editor.contentComponent) === null || _editor$contentCompon2 === void 0 || _editor$contentCompon2.removeRenderer(this.id);
|
|
734
|
+
try {
|
|
735
|
+
if (this.element && this.element.parentNode) this.element.parentNode.removeChild(this.element);
|
|
736
|
+
} catch {}
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Update the attributes of the element that holds the React component.
|
|
740
|
+
*/
|
|
741
|
+
updateAttributes(attributes) {
|
|
742
|
+
Object.keys(attributes).forEach((key) => {
|
|
743
|
+
this.element.setAttribute(key, attributes[key]);
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/ReactMarkViewRenderer.tsx
|
|
749
|
+
const ReactMarkViewContext = react.default.createContext({ markViewContentRef: () => {} });
|
|
750
|
+
const MarkViewContent = (props) => {
|
|
751
|
+
const { as: Tag = "span", ...rest } = props;
|
|
752
|
+
const { markViewContentRef } = react.default.useContext(ReactMarkViewContext);
|
|
753
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
754
|
+
...rest,
|
|
755
|
+
ref: markViewContentRef,
|
|
756
|
+
"data-mark-view-content": ""
|
|
757
|
+
});
|
|
758
|
+
};
|
|
759
|
+
var ReactMarkView = class extends _tiptap_core.MarkView {
|
|
760
|
+
constructor(component, props, options) {
|
|
761
|
+
super(component, props, options);
|
|
762
|
+
const { as = "span", attrs, className = "" } = options || {};
|
|
763
|
+
const componentProps = {
|
|
764
|
+
...props,
|
|
765
|
+
updateAttributes: this.updateAttributes.bind(this)
|
|
766
|
+
};
|
|
767
|
+
this.contentDOMElement = document.createElement("span");
|
|
768
|
+
const markViewContentRef = (el) => {
|
|
769
|
+
if (el && !el.contains(this.contentDOMElement)) el.appendChild(this.contentDOMElement);
|
|
770
|
+
};
|
|
771
|
+
const context = { markViewContentRef };
|
|
772
|
+
const ReactMarkViewProvider = react.default.memo((componentProps) => {
|
|
773
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReactMarkViewContext.Provider, {
|
|
774
|
+
value: context,
|
|
775
|
+
children: react.default.createElement(component, componentProps)
|
|
776
|
+
});
|
|
777
|
+
});
|
|
778
|
+
ReactMarkViewProvider.displayName = "ReactMarkView";
|
|
779
|
+
this.renderer = new ReactRenderer(ReactMarkViewProvider, {
|
|
780
|
+
editor: props.editor,
|
|
781
|
+
props: componentProps,
|
|
782
|
+
as,
|
|
783
|
+
className: `mark-${props.mark.type.name} ${className}`.trim()
|
|
784
|
+
});
|
|
785
|
+
if (attrs) this.renderer.updateAttributes(attrs);
|
|
786
|
+
}
|
|
787
|
+
get dom() {
|
|
788
|
+
return this.renderer.element;
|
|
789
|
+
}
|
|
790
|
+
get contentDOM() {
|
|
791
|
+
return this.contentDOMElement;
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
function ReactMarkViewRenderer(component, options = {}) {
|
|
795
|
+
return (props) => new ReactMarkView(component, props, options);
|
|
796
|
+
}
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/captureDOMSelection.ts
|
|
799
|
+
/**
|
|
800
|
+
* Saves the DOM selection inside `element`, returns a function to put it back.
|
|
801
|
+
* Browsers drop the selection when an element moves, so restore it after the move.
|
|
802
|
+
*/
|
|
803
|
+
function captureDOMSelection(element) {
|
|
804
|
+
var _element$ownerDocumen;
|
|
805
|
+
const root = element.getRootNode();
|
|
806
|
+
const selection = typeof root.getSelection === "function" ? root.getSelection() : (_element$ownerDocumen = element.ownerDocument) === null || _element$ownerDocumen === void 0 || (_element$ownerDocumen = _element$ownerDocumen.defaultView) === null || _element$ownerDocumen === void 0 ? void 0 : _element$ownerDocumen.getSelection();
|
|
807
|
+
if (!selection || selection.rangeCount === 0) return null;
|
|
808
|
+
const { anchorNode, anchorOffset, focusNode, focusOffset } = selection;
|
|
809
|
+
if (!anchorNode || !focusNode) return null;
|
|
810
|
+
if (!element.contains(anchorNode) || !element.contains(focusNode)) return null;
|
|
811
|
+
return () => {
|
|
812
|
+
try {
|
|
813
|
+
selection.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
|
|
814
|
+
} catch {}
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region src/lib/utils/getTextSelectionAncestorPositions.ts
|
|
819
|
+
function isSameAncestor($from, $to, depth) {
|
|
820
|
+
return $from.node(depth) === $to.node(depth) && $from.before(depth) === $to.before(depth);
|
|
821
|
+
}
|
|
822
|
+
function getTextSelectionAncestorPositions(selection) {
|
|
823
|
+
if (!(0, _tiptap_core.isTextSelection)(selection)) return [];
|
|
824
|
+
const { $from, $to } = selection;
|
|
825
|
+
const positions = [];
|
|
826
|
+
const maxDepth = Math.min($from.depth, $to.depth);
|
|
827
|
+
for (let depth = 1; depth <= maxDepth; depth += 1) {
|
|
828
|
+
if (!isSameAncestor($from, $to, depth)) break;
|
|
829
|
+
positions.push($from.before(depth));
|
|
830
|
+
}
|
|
831
|
+
return positions;
|
|
832
|
+
}
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/ReactNodeViewSelectionTracker.ts
|
|
835
|
+
var ReactNodeViewSelectionTracker = class {
|
|
836
|
+
constructor(editor) {
|
|
837
|
+
this.views = /* @__PURE__ */ new WeakMap();
|
|
838
|
+
this.viewCount = 0;
|
|
839
|
+
this.insideViews = /* @__PURE__ */ new Set();
|
|
840
|
+
this.syncQueued = false;
|
|
841
|
+
this.scheduleSync = () => {
|
|
842
|
+
if (this.syncQueued) return;
|
|
843
|
+
this.syncQueued = true;
|
|
844
|
+
queueMicrotask(() => {
|
|
845
|
+
this.syncQueued = false;
|
|
846
|
+
this.sync();
|
|
847
|
+
});
|
|
848
|
+
};
|
|
849
|
+
this.handleTransaction = () => this.scheduleSync();
|
|
850
|
+
this.editor = editor;
|
|
851
|
+
}
|
|
852
|
+
register(view) {
|
|
853
|
+
if (this.viewCount === 0) this.editor.on("transaction", this.handleTransaction);
|
|
854
|
+
this.views.set(view.dom, view);
|
|
855
|
+
this.viewCount += 1;
|
|
856
|
+
this.scheduleSync();
|
|
857
|
+
}
|
|
858
|
+
unregister(view) {
|
|
859
|
+
this.views.delete(view.dom);
|
|
860
|
+
this.viewCount -= 1;
|
|
861
|
+
this.insideViews.delete(view);
|
|
862
|
+
if (this.viewCount === 0) this.editor.off("transaction", this.handleTransaction);
|
|
863
|
+
}
|
|
864
|
+
sync() {
|
|
865
|
+
if (this.viewCount === 0 || this.editor.isDestroyed) return;
|
|
866
|
+
const nextInsideViews = this.findInsideViews();
|
|
867
|
+
this.updateViews(this.insideViews, nextInsideViews, false);
|
|
868
|
+
this.updateViews(nextInsideViews, this.insideViews, true);
|
|
869
|
+
this.insideViews = nextInsideViews;
|
|
870
|
+
}
|
|
871
|
+
updateViews(views, unchangedViews, selectionInside) {
|
|
872
|
+
for (const view of views) if (!unchangedViews.has(view)) view.setSelectionInside(selectionInside);
|
|
873
|
+
}
|
|
874
|
+
findInsideViews() {
|
|
875
|
+
const insideViews = /* @__PURE__ */ new Set();
|
|
876
|
+
for (const position of getTextSelectionAncestorPositions(this.editor.state.selection)) {
|
|
877
|
+
const dom = this.editor.view.nodeDOM(position);
|
|
878
|
+
const view = dom ? this.views.get(dom) : void 0;
|
|
879
|
+
if (view) insideViews.add(view);
|
|
880
|
+
}
|
|
881
|
+
return insideViews;
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
const trackers = /* @__PURE__ */ new WeakMap();
|
|
885
|
+
function getReactNodeViewSelectionTracker(editor) {
|
|
886
|
+
let tracker = trackers.get(editor);
|
|
887
|
+
if (!tracker) {
|
|
888
|
+
tracker = new ReactNodeViewSelectionTracker(editor);
|
|
889
|
+
trackers.set(editor, tracker);
|
|
890
|
+
}
|
|
891
|
+
return tracker;
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/ReactNodeViewRenderer.tsx
|
|
895
|
+
var ReactNodeView = class extends _tiptap_core.NodeView {
|
|
896
|
+
constructor(component, props, options) {
|
|
897
|
+
super(component, props, options);
|
|
898
|
+
this.nodeSelected = false;
|
|
899
|
+
this.handlePositionUpdate = () => {
|
|
900
|
+
const newPos = this.getPos();
|
|
901
|
+
if (typeof newPos !== "number" || newPos === this.currentPos) return;
|
|
902
|
+
this.currentPos = newPos;
|
|
903
|
+
this.renderer.updateProps({ getPos: () => this.getPos() });
|
|
904
|
+
if (typeof this.options.attrs === "function") this.updateElementAttributes();
|
|
905
|
+
};
|
|
906
|
+
this.cachedExtensionWithSyncedStorage = null;
|
|
907
|
+
if (!this.node.isLeaf) {
|
|
908
|
+
if (this.options.contentDOMElementTag) this.contentDOMElement = document.createElement(this.options.contentDOMElementTag);
|
|
909
|
+
else this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div");
|
|
910
|
+
this.contentDOMElement.dataset.nodeViewContentReact = "";
|
|
911
|
+
this.contentDOMElement.dataset.nodeViewWrapper = "";
|
|
912
|
+
this.contentDOMElement.style.whiteSpace = "inherit";
|
|
913
|
+
const contentTarget = this.dom.querySelector("[data-node-view-content]");
|
|
914
|
+
if (contentTarget) contentTarget.appendChild(this.contentDOMElement);
|
|
915
|
+
else this.dom.appendChild(this.contentDOMElement);
|
|
916
|
+
}
|
|
917
|
+
if (this.options.trackNodeViewPosition) this.editor.on("update", this.handlePositionUpdate);
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Returns a proxy of the extension that redirects storage access to the editor's mutable storage.
|
|
921
|
+
* This preserves the original prototype chain (instanceof checks, methods like configure/extend work).
|
|
922
|
+
* Cached to avoid proxy creation on every update.
|
|
923
|
+
*/
|
|
924
|
+
get extensionWithSyncedStorage() {
|
|
925
|
+
if (!this.cachedExtensionWithSyncedStorage) {
|
|
926
|
+
const editor = this.editor;
|
|
927
|
+
const extension = this.extension;
|
|
928
|
+
this.cachedExtensionWithSyncedStorage = new Proxy(extension, { get(target, prop, receiver) {
|
|
929
|
+
if (prop === "storage") {
|
|
930
|
+
var _editor$storage;
|
|
931
|
+
return (_editor$storage = editor.storage[extension.name]) !== null && _editor$storage !== void 0 ? _editor$storage : {};
|
|
932
|
+
}
|
|
933
|
+
return Reflect.get(target, prop, receiver);
|
|
934
|
+
} });
|
|
935
|
+
}
|
|
936
|
+
return this.cachedExtensionWithSyncedStorage;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Setup the React component.
|
|
940
|
+
* Called on initialization.
|
|
941
|
+
*/
|
|
942
|
+
mount() {
|
|
943
|
+
const mountProps = {
|
|
944
|
+
editor: this.editor,
|
|
945
|
+
node: this.node,
|
|
946
|
+
decorations: this.decorations,
|
|
947
|
+
innerDecorations: this.innerDecorations,
|
|
948
|
+
view: this.view,
|
|
949
|
+
selected: false,
|
|
950
|
+
selectionInside: false,
|
|
951
|
+
extension: this.extensionWithSyncedStorage,
|
|
952
|
+
HTMLAttributes: this.HTMLAttributes,
|
|
953
|
+
getPos: () => this.getPos(),
|
|
954
|
+
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
955
|
+
deleteNode: () => this.deleteNode(),
|
|
956
|
+
ref: (0, react.createRef)()
|
|
957
|
+
};
|
|
958
|
+
if (!this.component.displayName) {
|
|
959
|
+
const capitalizeFirstChar = (string) => {
|
|
960
|
+
return string.charAt(0).toUpperCase() + string.substring(1);
|
|
961
|
+
};
|
|
962
|
+
this.component.displayName = capitalizeFirstChar(this.extension.name);
|
|
963
|
+
}
|
|
964
|
+
const onDragStart = this.onDragStart.bind(this);
|
|
965
|
+
const nodeViewContentRef = (element) => {
|
|
966
|
+
if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {
|
|
967
|
+
if (element.hasAttribute("data-node-view-wrapper")) element.removeAttribute("data-node-view-wrapper");
|
|
968
|
+
const restoreSelection = captureDOMSelection(this.contentDOMElement);
|
|
969
|
+
element.appendChild(this.contentDOMElement);
|
|
970
|
+
restoreSelection === null || restoreSelection === void 0 || restoreSelection();
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
const context = {
|
|
974
|
+
onDragStart,
|
|
975
|
+
nodeViewContentRef
|
|
976
|
+
};
|
|
977
|
+
const Component = this.component;
|
|
978
|
+
const ReactNodeViewProvider = (0, react.memo)((componentProps) => {
|
|
979
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReactNodeViewContext.Provider, {
|
|
980
|
+
value: context,
|
|
981
|
+
children: (0, react.createElement)(Component, componentProps)
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
ReactNodeViewProvider.displayName = "ReactNodeView";
|
|
985
|
+
let as = this.node.isInline ? "span" : "div";
|
|
986
|
+
if (this.options.as) as = this.options.as;
|
|
987
|
+
const { className = "" } = this.options;
|
|
988
|
+
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
|
989
|
+
editor: this.editor,
|
|
990
|
+
props: mountProps,
|
|
991
|
+
as,
|
|
992
|
+
className: `node-${this.node.type.name} ${className}`.trim()
|
|
993
|
+
});
|
|
994
|
+
getReactNodeViewSelectionTracker(this.editor).register(this);
|
|
995
|
+
this.updateElementAttributes();
|
|
996
|
+
this.currentPos = this.getPos();
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Return the DOM element.
|
|
1000
|
+
* This is the element that will be used to display the node view.
|
|
1001
|
+
*/
|
|
1002
|
+
get dom() {
|
|
1003
|
+
var _this$renderer$elemen;
|
|
1004
|
+
if (this.renderer.element.firstElementChild && !((_this$renderer$elemen = this.renderer.element.firstElementChild) === null || _this$renderer$elemen === void 0 ? void 0 : _this$renderer$elemen.hasAttribute("data-node-view-wrapper"))) throw Error("Please use the NodeViewWrapper component for your node view.");
|
|
1005
|
+
return this.renderer.element;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Return the content DOM element.
|
|
1009
|
+
* This is the element that will be used to display the rich-text content of the node.
|
|
1010
|
+
*/
|
|
1011
|
+
get contentDOM() {
|
|
1012
|
+
if (this.node.isLeaf) return null;
|
|
1013
|
+
return this.contentDOMElement;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* On update, update the React component.
|
|
1017
|
+
* To prevent unnecessary updates, the `update` option can be used.
|
|
1018
|
+
*/
|
|
1019
|
+
update(node, decorations, innerDecorations) {
|
|
1020
|
+
const rerenderComponent = (props) => {
|
|
1021
|
+
this.renderer.updateProps(props);
|
|
1022
|
+
if (typeof this.options.attrs === "function") this.updateElementAttributes();
|
|
1023
|
+
};
|
|
1024
|
+
if (node.type !== this.node.type) return false;
|
|
1025
|
+
if (typeof this.options.update === "function") {
|
|
1026
|
+
const oldNode = this.node;
|
|
1027
|
+
const oldDecorations = this.decorations;
|
|
1028
|
+
const oldInnerDecorations = this.innerDecorations;
|
|
1029
|
+
this.node = node;
|
|
1030
|
+
this.decorations = decorations;
|
|
1031
|
+
this.innerDecorations = innerDecorations;
|
|
1032
|
+
this.currentPos = this.getPos();
|
|
1033
|
+
return this.options.update({
|
|
1034
|
+
oldNode,
|
|
1035
|
+
oldDecorations,
|
|
1036
|
+
newNode: node,
|
|
1037
|
+
newDecorations: decorations,
|
|
1038
|
+
oldInnerDecorations,
|
|
1039
|
+
innerDecorations,
|
|
1040
|
+
updateProps: () => rerenderComponent({
|
|
1041
|
+
node,
|
|
1042
|
+
decorations,
|
|
1043
|
+
innerDecorations,
|
|
1044
|
+
extension: this.extensionWithSyncedStorage
|
|
1045
|
+
})
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
if (!(node !== this.node)) {
|
|
1049
|
+
this.node = node;
|
|
1050
|
+
this.decorations = decorations;
|
|
1051
|
+
this.innerDecorations = innerDecorations;
|
|
1052
|
+
return true;
|
|
1053
|
+
}
|
|
1054
|
+
const newPos = this.getPos();
|
|
1055
|
+
this.node = node;
|
|
1056
|
+
this.decorations = decorations;
|
|
1057
|
+
this.innerDecorations = innerDecorations;
|
|
1058
|
+
this.currentPos = newPos;
|
|
1059
|
+
const extraProps = {
|
|
1060
|
+
node,
|
|
1061
|
+
decorations,
|
|
1062
|
+
innerDecorations,
|
|
1063
|
+
extension: this.extensionWithSyncedStorage
|
|
1064
|
+
};
|
|
1065
|
+
if (this.options.trackNodeViewPosition) extraProps.getPos = () => this.getPos();
|
|
1066
|
+
rerenderComponent(extraProps);
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Select the node.
|
|
1071
|
+
* Add the `selected` prop and the `ProseMirror-selectednode` class.
|
|
1072
|
+
*/
|
|
1073
|
+
selectNode() {
|
|
1074
|
+
this.nodeSelected = true;
|
|
1075
|
+
this.updateSelectedState(true);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Deselect the node.
|
|
1079
|
+
* Remove the `selected` prop and the `ProseMirror-selectednode` class.
|
|
1080
|
+
*/
|
|
1081
|
+
deselectNode() {
|
|
1082
|
+
this.nodeSelected = false;
|
|
1083
|
+
this.updateSelectedState(this.options.selectedOnTextSelection === true && this.isTextSelectionInside());
|
|
1084
|
+
}
|
|
1085
|
+
setSelectionInside(selectionInside) {
|
|
1086
|
+
const selected = this.nodeSelected || this.options.selectedOnTextSelection === true && selectionInside;
|
|
1087
|
+
this.renderer.updateProps({
|
|
1088
|
+
selectionInside,
|
|
1089
|
+
selected
|
|
1090
|
+
});
|
|
1091
|
+
this.renderer.element.classList.toggle("ProseMirror-selectednode", selected);
|
|
1092
|
+
}
|
|
1093
|
+
updateSelectedState(selected) {
|
|
1094
|
+
this.renderer.updateProps({ selected });
|
|
1095
|
+
this.renderer.element.classList.toggle("ProseMirror-selectednode", selected);
|
|
1096
|
+
}
|
|
1097
|
+
isTextSelectionInside() {
|
|
1098
|
+
const pos = this.getPos();
|
|
1099
|
+
return typeof pos === "number" && getTextSelectionAncestorPositions(this.editor.state.selection).includes(pos);
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Destroy the React component instance.
|
|
1103
|
+
*/
|
|
1104
|
+
destroy() {
|
|
1105
|
+
this.renderer.destroy();
|
|
1106
|
+
getReactNodeViewSelectionTracker(this.editor).unregister(this);
|
|
1107
|
+
if (this.options.trackNodeViewPosition) this.editor.off("update", this.handlePositionUpdate);
|
|
1108
|
+
this.contentDOMElement = null;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Update the attributes of the top-level element that holds the React component.
|
|
1112
|
+
* Applying the attributes defined in the `attrs` option.
|
|
1113
|
+
*/
|
|
1114
|
+
updateElementAttributes() {
|
|
1115
|
+
if (this.options.attrs) {
|
|
1116
|
+
let attrsObj = {};
|
|
1117
|
+
if (typeof this.options.attrs === "function") {
|
|
1118
|
+
const extensionAttributes = this.editor.extensionManager.attributes;
|
|
1119
|
+
const HTMLAttributes = (0, _tiptap_core.getRenderedAttributes)(this.node, extensionAttributes);
|
|
1120
|
+
attrsObj = this.options.attrs({
|
|
1121
|
+
node: this.node,
|
|
1122
|
+
HTMLAttributes
|
|
1123
|
+
});
|
|
1124
|
+
} else attrsObj = this.options.attrs;
|
|
1125
|
+
this.renderer.updateAttributes(attrsObj);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
/**
|
|
1130
|
+
* Create a React node view renderer.
|
|
1131
|
+
*/
|
|
1132
|
+
function ReactNodeViewRenderer(component, options) {
|
|
1133
|
+
return (props) => {
|
|
1134
|
+
if (!props.editor.contentComponent) return {
|
|
1135
|
+
dom: document.createElement("span"),
|
|
1136
|
+
contentDOM: null,
|
|
1137
|
+
update: () => false,
|
|
1138
|
+
destroy: () => {},
|
|
1139
|
+
selectNode: () => {},
|
|
1140
|
+
deselectNode: () => {},
|
|
1141
|
+
stopEvent: () => false,
|
|
1142
|
+
ignoreMutation: () => true
|
|
1143
|
+
};
|
|
1144
|
+
return new ReactNodeView(component, props, options);
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
//#endregion
|
|
1148
|
+
//#region src/ReactWidgetRenderer.tsx
|
|
1149
|
+
const WIDGET_CACHE = Symbol("tiptapReactWidgetCache");
|
|
1150
|
+
/**
|
|
1151
|
+
* Renders a React component into a ProseMirror widget decoration.
|
|
1152
|
+
* Reuses Tiptap's `ReactRenderer` so the component lives in the editor's
|
|
1153
|
+
* React tree (context and hooks work as usual). Use a stable `key` for
|
|
1154
|
+
* stateful widgets.
|
|
1155
|
+
* @example
|
|
1156
|
+
* addDecorations() {
|
|
1157
|
+
* return {
|
|
1158
|
+
* create: ({ editor, state }) =>
|
|
1159
|
+
* findMatches(state.doc).map(match =>
|
|
1160
|
+
* ReactWidgetRenderer(MyWidget, {
|
|
1161
|
+
* editor, pos: match.pos, key: `match-${match.id}`,
|
|
1162
|
+
* props: { label: match.label },
|
|
1163
|
+
* }),
|
|
1164
|
+
* ),
|
|
1165
|
+
* }
|
|
1166
|
+
* }
|
|
1167
|
+
*/
|
|
1168
|
+
function ReactWidgetRenderer(component, options) {
|
|
1169
|
+
const { editor, props = {}, as = "span", className } = options;
|
|
1170
|
+
return (0, _tiptap_core.createWidgetDecoration)({
|
|
1171
|
+
...options,
|
|
1172
|
+
props,
|
|
1173
|
+
cacheKey: WIDGET_CACHE,
|
|
1174
|
+
context: (getPos) => ({
|
|
1175
|
+
editor,
|
|
1176
|
+
getPos
|
|
1177
|
+
}),
|
|
1178
|
+
create: (renderProps) => new ReactRenderer(component, {
|
|
1179
|
+
editor,
|
|
1180
|
+
as,
|
|
1181
|
+
className,
|
|
1182
|
+
props: renderProps
|
|
1183
|
+
}),
|
|
1184
|
+
materialize: (renderer) => {
|
|
1185
|
+
renderer.render();
|
|
1186
|
+
return renderer.element;
|
|
1187
|
+
}
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/Tiptap.tsx
|
|
1192
|
+
/**
|
|
1193
|
+
* React context that stores the current editor instance.
|
|
1194
|
+
*
|
|
1195
|
+
* Use `useTiptap()` to read from this context in child components.
|
|
1196
|
+
*/
|
|
1197
|
+
const TiptapContext = (0, react.createContext)({ get editor() {
|
|
1198
|
+
throw new Error("useTiptap must be used within a <Tiptap> provider");
|
|
1199
|
+
} });
|
|
1200
|
+
TiptapContext.displayName = "TiptapContext";
|
|
1201
|
+
/**
|
|
1202
|
+
* Hook to read the Tiptap context and access the editor instance.
|
|
1203
|
+
*
|
|
1204
|
+
* This is a small convenience wrapper around `useContext(TiptapContext)`.
|
|
1205
|
+
* The editor is always available when used within a `<Tiptap>` provider.
|
|
1206
|
+
*
|
|
1207
|
+
* @returns The current `TiptapContextType` value from the provider.
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```tsx
|
|
1211
|
+
* import { useTiptap } from '@tiptap/react'
|
|
1212
|
+
*
|
|
1213
|
+
* function Toolbar() {
|
|
1214
|
+
* const { editor } = useTiptap()
|
|
1215
|
+
*
|
|
1216
|
+
* return (
|
|
1217
|
+
* <button onClick={() => editor.chain().focus().toggleBold().run()}>
|
|
1218
|
+
* Bold
|
|
1219
|
+
* </button>
|
|
1220
|
+
* )
|
|
1221
|
+
* }
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
const useTiptap = () => (0, react.useContext)(TiptapContext);
|
|
1225
|
+
/**
|
|
1226
|
+
* Select a slice of the editor state using the context-provided editor.
|
|
1227
|
+
*
|
|
1228
|
+
* This is a thin wrapper around `useEditorState` that reads the `editor`
|
|
1229
|
+
* instance from `useTiptap()` so callers don't have to pass it manually.
|
|
1230
|
+
*
|
|
1231
|
+
* @typeParam TSelectorResult - The type returned by the selector.
|
|
1232
|
+
* @param selector - Function that receives the editor state snapshot and
|
|
1233
|
+
* returns the piece of state you want to subscribe to.
|
|
1234
|
+
* @param equalityFn - Optional function to compare previous/next selected
|
|
1235
|
+
* values and avoid unnecessary updates.
|
|
1236
|
+
* @returns The selected slice of the editor state.
|
|
1237
|
+
*
|
|
1238
|
+
* @example
|
|
1239
|
+
* ```tsx
|
|
1240
|
+
* function WordCount() {
|
|
1241
|
+
* const wordCount = useTiptapState(state => {
|
|
1242
|
+
* const text = state.editor.state.doc.textContent
|
|
1243
|
+
* return text.split(/\s+/).filter(Boolean).length
|
|
1244
|
+
* })
|
|
1245
|
+
*
|
|
1246
|
+
* return <span>{wordCount} words</span>
|
|
1247
|
+
* }
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
function useTiptapState(selector, equalityFn) {
|
|
1251
|
+
const { editor } = useTiptap();
|
|
1252
|
+
return useEditorState({
|
|
1253
|
+
editor,
|
|
1254
|
+
selector,
|
|
1255
|
+
equalityFn
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Top-level provider component that makes the editor instance available via
|
|
1260
|
+
* React context to all child components.
|
|
1261
|
+
*
|
|
1262
|
+
* This component also provides backwards compatibility with the legacy
|
|
1263
|
+
* `EditorContext`, so components using `useCurrentEditor()` will work
|
|
1264
|
+
* inside a `<Tiptap>` provider.
|
|
1265
|
+
*
|
|
1266
|
+
* @param props - Component props.
|
|
1267
|
+
* @returns A context provider element wrapping `children`.
|
|
1268
|
+
*
|
|
1269
|
+
* @example
|
|
1270
|
+
* ```tsx
|
|
1271
|
+
* import { Tiptap, useEditor } from '@tiptap/react'
|
|
1272
|
+
*
|
|
1273
|
+
* function App() {
|
|
1274
|
+
* const editor = useEditor({ extensions: [...] })
|
|
1275
|
+
*
|
|
1276
|
+
* return (
|
|
1277
|
+
* <Tiptap editor={editor}>
|
|
1278
|
+
* <Toolbar />
|
|
1279
|
+
* <Tiptap.Content />
|
|
1280
|
+
* </Tiptap>
|
|
1281
|
+
* )
|
|
1282
|
+
* }
|
|
1283
|
+
* ```
|
|
1284
|
+
*/
|
|
1285
|
+
function TiptapWrapper({ children, ...props }) {
|
|
1286
|
+
const resolvedEditor = "editor" in props ? props.editor : props.instance;
|
|
1287
|
+
if (!resolvedEditor) throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
|
|
1288
|
+
const tiptapContextValue = (0, react.useMemo)(() => ({ editor: resolvedEditor }), [resolvedEditor]);
|
|
1289
|
+
const legacyContextValue = (0, react.useMemo)(() => ({ editor: resolvedEditor }), [resolvedEditor]);
|
|
1290
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorContext.Provider, {
|
|
1291
|
+
value: legacyContextValue,
|
|
1292
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TiptapContext.Provider, {
|
|
1293
|
+
value: tiptapContextValue,
|
|
1294
|
+
children
|
|
1295
|
+
})
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
TiptapWrapper.displayName = "Tiptap";
|
|
1299
|
+
/**
|
|
1300
|
+
* Convenience component that renders `EditorContent` using the context-provided
|
|
1301
|
+
* editor instance. Use this instead of manually passing the `editor` prop.
|
|
1302
|
+
*
|
|
1303
|
+
* @param props - All `EditorContent` props except `editor` and `ref`.
|
|
1304
|
+
* @returns An `EditorContent` element bound to the context editor.
|
|
1305
|
+
*
|
|
1306
|
+
* @example
|
|
1307
|
+
* ```tsx
|
|
1308
|
+
* // inside a Tiptap provider
|
|
1309
|
+
* <Tiptap.Content className="editor" />
|
|
1310
|
+
* ```
|
|
1311
|
+
*/
|
|
1312
|
+
function TiptapContent({ ...rest }) {
|
|
1313
|
+
const { editor } = useTiptap();
|
|
1314
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorContent, {
|
|
1315
|
+
editor,
|
|
1316
|
+
...rest
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
TiptapContent.displayName = "Tiptap.Content";
|
|
1320
|
+
/**
|
|
1321
|
+
* Root `Tiptap` component. Use it as the provider for all child components.
|
|
1322
|
+
*
|
|
1323
|
+
* The exported object includes the `Content` subcomponent for rendering the
|
|
1324
|
+
* editor content area.
|
|
1325
|
+
*
|
|
1326
|
+
* This component provides both the new `TiptapContext` (accessed via `useTiptap()`)
|
|
1327
|
+
* and the legacy `EditorContext` (accessed via `useCurrentEditor()`) for
|
|
1328
|
+
* backwards compatibility.
|
|
1329
|
+
*
|
|
1330
|
+
* For bubble menus and floating menus, import them separately from
|
|
1331
|
+
* `@tiptap/react/menus` to keep floating-ui as an optional dependency.
|
|
1332
|
+
*
|
|
1333
|
+
* @example
|
|
1334
|
+
* ```tsx
|
|
1335
|
+
* import { Tiptap, useEditor } from '@tiptap/react'
|
|
1336
|
+
* import { BubbleMenu } from '@tiptap/react/menus'
|
|
1337
|
+
*
|
|
1338
|
+
* function App() {
|
|
1339
|
+
* const editor = useEditor({ extensions: [...] })
|
|
1340
|
+
*
|
|
1341
|
+
* return (
|
|
1342
|
+
* <Tiptap editor={editor}>
|
|
1343
|
+
* <Tiptap.Content />
|
|
1344
|
+
* <BubbleMenu>
|
|
1345
|
+
* <button onClick={() => editor.chain().focus().toggleBold().run()}>Bold</button>
|
|
1346
|
+
* </BubbleMenu>
|
|
1347
|
+
* </Tiptap>
|
|
1348
|
+
* )
|
|
1349
|
+
* }
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
const Tiptap = Object.assign(TiptapWrapper, {
|
|
1353
|
+
/**
|
|
1354
|
+
* The Tiptap Content component that renders the EditorContent with the editor instance from the context.
|
|
1355
|
+
* @see TiptapContent
|
|
1356
|
+
*/
|
|
1357
|
+
Content: TiptapContent });
|
|
1358
|
+
//#endregion
|
|
1359
|
+
exports.EditorConsumer = EditorConsumer;
|
|
1360
|
+
exports.EditorContent = EditorContent;
|
|
1361
|
+
exports.EditorContext = EditorContext;
|
|
1362
|
+
exports.EditorProvider = EditorProvider;
|
|
1363
|
+
exports.MarkViewContent = MarkViewContent;
|
|
1364
|
+
exports.NodeViewContent = NodeViewContent;
|
|
1365
|
+
exports.NodeViewWrapper = NodeViewWrapper;
|
|
1366
|
+
exports.PureEditorContent = PureEditorContent;
|
|
1367
|
+
exports.ReactMarkView = ReactMarkView;
|
|
1368
|
+
exports.ReactMarkViewContext = ReactMarkViewContext;
|
|
1369
|
+
exports.ReactMarkViewRenderer = ReactMarkViewRenderer;
|
|
1370
|
+
exports.ReactNodeView = ReactNodeView;
|
|
1371
|
+
exports.ReactNodeViewContentProvider = ReactNodeViewContentProvider;
|
|
1372
|
+
exports.ReactNodeViewContext = ReactNodeViewContext;
|
|
1373
|
+
exports.ReactNodeViewRenderer = ReactNodeViewRenderer;
|
|
1374
|
+
exports.ReactRenderer = ReactRenderer;
|
|
1375
|
+
exports.ReactWidgetRenderer = ReactWidgetRenderer;
|
|
1376
|
+
exports.Tiptap = Tiptap;
|
|
1377
|
+
exports.TiptapContent = TiptapContent;
|
|
1378
|
+
exports.TiptapContext = TiptapContext;
|
|
1379
|
+
exports.TiptapWrapper = TiptapWrapper;
|
|
1380
|
+
exports.createContentComponent = createContentComponent;
|
|
1381
|
+
exports.useCurrentEditor = useCurrentEditor;
|
|
1382
|
+
exports.useEditor = useEditor;
|
|
1383
|
+
exports.useEditorState = useEditorState;
|
|
1384
|
+
exports.useReactNodeView = useReactNodeView;
|
|
1385
|
+
exports.useTiptap = useTiptap;
|
|
1386
|
+
exports.useTiptapState = useTiptapState;
|
|
1387
|
+
Object.keys(_tiptap_core).forEach(function(k) {
|
|
1388
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1389
|
+
enumerable: true,
|
|
1390
|
+
get: function() {
|
|
1391
|
+
return _tiptap_core[k];
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
});
|
|
1395
|
+
|
|
1396
|
+
//# sourceMappingURL=index.cjs.map
|