@ecomcx/ecomweb-editor 0.0.0-stage → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +424 -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/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 +186 -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
package/src/handle.tsx
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Extension, type Editor as TiptapEditor } from "@tiptap/core";
|
|
2
|
+
import { NodeSelection } from "@tiptap/pm/state";
|
|
3
|
+
import { ArrowDown, ArrowUp, Copy, CornerLeftUp, GripVertical, Plus, Shapes, Trash2, type LucideIcon } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef, useState, type DragEvent, type KeyboardEvent } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { createPatternFrom, patternHostOf } from "./synced";
|
|
7
|
+
import { blockFromPos, currentBlock, deleteBlock, duplicateBlock, insertParagraphAfter, insertParagraphBefore, moveBlock, parentBlock, type BlockRef } from "./blockops";
|
|
8
|
+
import type { EditorLabels } from "./labels";
|
|
9
|
+
import { cx } from "./util";
|
|
10
|
+
|
|
11
|
+
const mac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
12
|
+
const key = (s: string) => (mac ? s.replace("Mod", "⌘").replace("Shift", "⇧").replace("Alt", "⌥").replace(/-/g, "") : s.replace("Mod", "Ctrl").replace(/-/g, "+"));
|
|
13
|
+
|
|
14
|
+
/** Thao tác khối theo phím tắt (cùng chỗ với menu khối). */
|
|
15
|
+
export type BlockAction = "up" | "down" | "duplicate" | "delete" | "parent" | "insert" | "insertBefore" | "pattern";
|
|
16
|
+
|
|
17
|
+
export function runBlockAction(editor: TiptapEditor, action: BlockAction, block = currentBlock(editor.state)): boolean {
|
|
18
|
+
if (!block) return false;
|
|
19
|
+
if (action === "pattern") { void createPatternFrom(editor, block); return true; }
|
|
20
|
+
const { state } = editor;
|
|
21
|
+
const tr = action === "up" ? moveBlock(state, block, -1) : action === "down" ? moveBlock(state, block, 1)
|
|
22
|
+
: action === "duplicate" ? duplicateBlock(state, block) : action === "delete" ? deleteBlock(state, block)
|
|
23
|
+
: action === "insert" ? insertParagraphAfter(state, block)
|
|
24
|
+
: action === "insertBefore" ? insertParagraphBefore(state, block)
|
|
25
|
+
: (() => { const p = parentBlock(state.doc, block); return p ? state.tr.setSelection(NodeSelection.create(state.doc, p.pos)) : null; })();
|
|
26
|
+
if (!tr) return false;
|
|
27
|
+
editor.view.dispatch(tr);
|
|
28
|
+
editor.view.focus();
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Phím tắt thao tác khối + Alt+F10 mở menu khối. */
|
|
33
|
+
export const BlockKeys = Extension.create<{ openMenu(): void }>({
|
|
34
|
+
name: "cmsBlockKeys",
|
|
35
|
+
addOptions: () => ({ openMenu: () => {} }),
|
|
36
|
+
addKeyboardShortcuts() {
|
|
37
|
+
return {
|
|
38
|
+
"Mod-Shift-ArrowUp": () => runBlockAction(this.editor, "up"),
|
|
39
|
+
"Mod-Shift-ArrowDown": () => runBlockAction(this.editor, "down"),
|
|
40
|
+
"Mod-Shift-d": () => runBlockAction(this.editor, "duplicate"),
|
|
41
|
+
"Mod-Shift-Backspace": () => runBlockAction(this.editor, "delete"),
|
|
42
|
+
"Alt-F10": () => { this.options.openMenu(); return true; },
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/** Bắt đầu kéo một khối (tay kéo bên trái, nút kéo trên thanh công cụ khối): ProseMirror tự thả + xoá bản gốc. */
|
|
48
|
+
export function startBlockDrag(editor: TiptapEditor, block: BlockRef, e: DragEvent) {
|
|
49
|
+
const view = editor.view;
|
|
50
|
+
const sel = NodeSelection.create(view.state.doc, block.pos);
|
|
51
|
+
view.dispatch(view.state.tr.setSelection(sel));
|
|
52
|
+
const slice = sel.content();
|
|
53
|
+
const { dom, text } = view.serializeForClipboard(slice);
|
|
54
|
+
e.dataTransfer.clearData();
|
|
55
|
+
e.dataTransfer.setData("text/html", dom.innerHTML);
|
|
56
|
+
e.dataTransfer.setData("text/plain", text);
|
|
57
|
+
e.dataTransfer.effectAllowed = "copyMove";
|
|
58
|
+
const el = view.nodeDOM(block.pos) as HTMLElement | null;
|
|
59
|
+
if (el) e.dataTransfer.setDragImage(el, 0, 0);
|
|
60
|
+
(view as any).dragging = { slice, move: true, node: sel };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type Shown = { block: BlockRef; rect: DOMRect };
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Tay kéo bên trái khối (khối đang trỏ chuột, không thì khối có con trỏ): kéo để di chuyển, bấm để mở menu
|
|
67
|
+
* (lên, xuống, nhân bản, xoá, chọn khối cha). Nút "+" chèn đoạn văn mới bên dưới và mở slash menu.
|
|
68
|
+
*/
|
|
69
|
+
export function BlockHandle({ editor, t, menuRequest }: { editor: TiptapEditor; t: EditorLabels; menuRequest: number }) {
|
|
70
|
+
const [shown, setShown] = useState<Shown | null>(null);
|
|
71
|
+
const [menu, setMenu] = useState(false);
|
|
72
|
+
const hover = useRef<BlockRef | null>(null);
|
|
73
|
+
const overHandle = useRef(false);
|
|
74
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
75
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
76
|
+
const menuOpen = useRef(false); menuOpen.current = menu;
|
|
77
|
+
|
|
78
|
+
// Tính lại vị trí (cuộn, gõ, đổi khối)
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const view = editor.view;
|
|
81
|
+
let frame = 0;
|
|
82
|
+
const update = () => {
|
|
83
|
+
cancelAnimationFrame(frame);
|
|
84
|
+
frame = requestAnimationFrame(() => {
|
|
85
|
+
if (menuOpen.current) return;
|
|
86
|
+
let block = hover.current;
|
|
87
|
+
// Khối đang trỏ chuột có thể đã đổi chỗ / bị xoá sau giao dịch → kiểm lại
|
|
88
|
+
if (block) { const n = editor.state.doc.nodeAt(block.pos); block = n ? blockFromPos(editor.state.doc, block.pos) : null; }
|
|
89
|
+
if (!block && (editor.isFocused || overHandle.current)) block = currentBlock(editor.state);
|
|
90
|
+
const dom = block ? (view.nodeDOM(block.pos) as HTMLElement | null) : null;
|
|
91
|
+
setShown(block && dom?.getBoundingClientRect ? { block, rect: dom.getBoundingClientRect() } : null);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
const onMove = (e: MouseEvent) => {
|
|
95
|
+
const at = view.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
96
|
+
const b = at ? blockFromPos(view.state.doc, at.inside >= 0 ? at.inside : Math.max(0, at.pos - 1)) : null;
|
|
97
|
+
if (b?.pos !== hover.current?.pos) { hover.current = b; update(); }
|
|
98
|
+
};
|
|
99
|
+
const onLeave = () => { setTimeout(() => { if (!overHandle.current) { hover.current = null; update(); } }, 120); };
|
|
100
|
+
const root = view.dom.parentElement ?? view.dom;
|
|
101
|
+
root.addEventListener("mousemove", onMove);
|
|
102
|
+
root.addEventListener("mouseleave", onLeave);
|
|
103
|
+
editor.on("transaction", update); editor.on("focus", update); editor.on("blur", update);
|
|
104
|
+
window.addEventListener("scroll", update, true); window.addEventListener("resize", update);
|
|
105
|
+
return () => {
|
|
106
|
+
cancelAnimationFrame(frame);
|
|
107
|
+
root.removeEventListener("mousemove", onMove); root.removeEventListener("mouseleave", onLeave);
|
|
108
|
+
editor.off("transaction", update); editor.off("focus", update); editor.off("blur", update);
|
|
109
|
+
window.removeEventListener("scroll", update, true); window.removeEventListener("resize", update);
|
|
110
|
+
};
|
|
111
|
+
}, [editor]);
|
|
112
|
+
|
|
113
|
+
// Alt+F10: mở menu cho khối có con trỏ
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!menuRequest) return;
|
|
116
|
+
const block = currentBlock(editor.state);
|
|
117
|
+
const dom = block ? (editor.view.nodeDOM(block.pos) as HTMLElement | null) : null;
|
|
118
|
+
if (!block || !dom) return;
|
|
119
|
+
hover.current = null;
|
|
120
|
+
setShown({ block, rect: dom.getBoundingClientRect() });
|
|
121
|
+
setMenu(true);
|
|
122
|
+
}, [menuRequest]);
|
|
123
|
+
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (!menu) return;
|
|
126
|
+
menuRef.current?.querySelector<HTMLElement>("[role=menuitem]:not(:disabled)")?.focus();
|
|
127
|
+
const outside = (e: MouseEvent) => { if (!ref.current?.contains(e.target as Node)) setMenu(false); };
|
|
128
|
+
document.addEventListener("mousedown", outside, true);
|
|
129
|
+
return () => document.removeEventListener("mousedown", outside, true);
|
|
130
|
+
}, [menu]);
|
|
131
|
+
|
|
132
|
+
if (!shown) return null;
|
|
133
|
+
const { block, rect } = shown;
|
|
134
|
+
const $p = editor.state.doc.resolve(Math.min(block.pos, editor.state.doc.content.size));
|
|
135
|
+
const index = $p.index(), count = $p.parent.childCount;
|
|
136
|
+
const hasParent = !!parentBlock(editor.state.doc, block);
|
|
137
|
+
|
|
138
|
+
const act = (a: BlockAction) => { setMenu(false); hover.current = null; runBlockAction(editor, a, block); };
|
|
139
|
+
const items: Array<[BlockAction, LucideIcon, string, string | null, boolean]> = [
|
|
140
|
+
["up", ArrowUp, t.moveUp, key("Mod-Shift-↑"), index > 0],
|
|
141
|
+
["down", ArrowDown, t.moveDown, key("Mod-Shift-↓"), index < count - 1],
|
|
142
|
+
["duplicate", Copy, t.duplicate, key("Mod-Shift-D"), true],
|
|
143
|
+
...(hasParent ? [["parent", CornerLeftUp, t.selectParent, null, true] as [BlockAction, LucideIcon, string, string | null, boolean]] : []),
|
|
144
|
+
...(patternHostOf(editor)?.create ? [["pattern", Shapes, t.createPattern, null, true] as [BlockAction, LucideIcon, string, string | null, boolean]] : []),
|
|
145
|
+
["delete", Trash2, t.deleteBlock, key("Mod-Shift-⌫"), true],
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
function onMenuKey(e: KeyboardEvent) {
|
|
149
|
+
const list = [...(menuRef.current?.querySelectorAll<HTMLElement>("[role=menuitem]:not(:disabled)") ?? [])];
|
|
150
|
+
const i = list.indexOf(document.activeElement as HTMLElement);
|
|
151
|
+
const go = (n: number) => { e.preventDefault(); list[(n + list.length) % list.length]?.focus(); };
|
|
152
|
+
if (e.key === "ArrowDown") go(i + 1);
|
|
153
|
+
else if (e.key === "ArrowUp") go(i - 1);
|
|
154
|
+
else if (e.key === "Home") go(0);
|
|
155
|
+
else if (e.key === "End") go(list.length - 1);
|
|
156
|
+
else if (e.key === "Escape" || e.key === "Tab") { e.preventDefault(); setMenu(false); editor.view.focus(); }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function onDragStart(e: DragEvent) {
|
|
160
|
+
startBlockDrag(editor, block, e);
|
|
161
|
+
setMenu(false);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const top = rect.top + Math.min(rect.height / 2, 14) - 12;
|
|
165
|
+
return createPortal(
|
|
166
|
+
<div ref={ref} className="cms-ed-handle" style={{ top, left: rect.left - 52 }}
|
|
167
|
+
onMouseEnter={() => { overHandle.current = true; }} onMouseLeave={() => { overHandle.current = false; }}>
|
|
168
|
+
<button type="button" className="cms-ed-handle-btn" title={t.addBelow} aria-label={t.addBelow} tabIndex={-1}
|
|
169
|
+
onMouseDown={(e) => e.preventDefault()} onClick={() => { act("insert"); editor.chain().insertContent("/").run(); }}><Plus size={14} /></button>
|
|
170
|
+
<button type="button" className={cx("cms-ed-handle-btn", "is-grip", menu && "is-active")} draggable title={t.blockOptions} aria-label={t.blockOptions}
|
|
171
|
+
aria-haspopup="menu" aria-expanded={menu} tabIndex={-1} onMouseDown={(e) => e.stopPropagation()}
|
|
172
|
+
onClick={() => setMenu((m) => !m)} onDragStart={onDragStart} onDragEnd={() => { hover.current = null; }}><GripVertical size={14} /></button>
|
|
173
|
+
{menu && (
|
|
174
|
+
<div ref={menuRef} role="menu" aria-label={t.blockOptions} className="cms-ed-menu" onKeyDown={onMenuKey}>
|
|
175
|
+
{items.map(([a, Icon, label, shortcut, enabled]) => (
|
|
176
|
+
<button key={a} type="button" role="menuitem" tabIndex={-1} disabled={!enabled} className={cx("cms-ed-menu-item", a === "delete" && "is-danger")}
|
|
177
|
+
onClick={() => act(a)}>
|
|
178
|
+
<Icon size={14} /><span>{label}</span>{shortcut && <kbd>{shortcut}</kbd>}
|
|
179
|
+
</button>
|
|
180
|
+
))}
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
</div>,
|
|
184
|
+
document.body,
|
|
185
|
+
);
|
|
186
|
+
}
|
package/src/handles.tsx
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useEditorState, type Editor as TiptapEditor } from "@tiptap/react";
|
|
2
|
+
import { NodeSelection } from "@tiptap/pm/state";
|
|
3
|
+
import type { Node as PMNode } from "@tiptap/pm/model";
|
|
4
|
+
import { normalizeStyle, type Box, type Device } from "@ecomcx/ecomweb-content";
|
|
5
|
+
import { useEffect, useState, type PointerEvent as ReactPointerEvent, type ReactElement } from "react";
|
|
6
|
+
import { createPortal } from "react-dom";
|
|
7
|
+
import type { EditorLabels } from "./labels";
|
|
8
|
+
|
|
9
|
+
/** Khối kéo chỉnh khoảng đệm được (chọn cả khối). */
|
|
10
|
+
const PADDED = new Set(["group", "cover", "columns", "column", "callout", "mediaText", "details", "pullquote"]);
|
|
11
|
+
const SIDES = ["top", "right", "bottom", "left"] as const;
|
|
12
|
+
type Side = (typeof SIDES)[number];
|
|
13
|
+
|
|
14
|
+
interface Target { columns: { pos: number; node: PMNode } | null; padded: { pos: number; node: PMNode } | null }
|
|
15
|
+
|
|
16
|
+
function findTarget(editor: TiptapEditor): Target {
|
|
17
|
+
const { selection, doc } = editor.state;
|
|
18
|
+
let columns: Target["columns"] = null;
|
|
19
|
+
const $p = selection.$from;
|
|
20
|
+
for (let d = $p.depth; d >= 1 && !columns; d--) if ($p.node(d).type.name === "columns") columns = { pos: $p.before(d), node: $p.node(d) };
|
|
21
|
+
let padded: Target["padded"] = null;
|
|
22
|
+
if (selection instanceof NodeSelection) {
|
|
23
|
+
const node = doc.nodeAt(selection.from);
|
|
24
|
+
if (node && node.type.name === "columns") columns = { pos: selection.from, node };
|
|
25
|
+
if (node && PADDED.has(node.type.name)) padded = { pos: selection.from, node };
|
|
26
|
+
}
|
|
27
|
+
return { columns, padded };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Theo dõi vị trí DOM của khối (cuộn, đổi cỡ, sửa nội dung). */
|
|
31
|
+
function useTick(editor: TiptapEditor, on: boolean) {
|
|
32
|
+
const [, setTick] = useState(0);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!on) return;
|
|
35
|
+
let frame = 0;
|
|
36
|
+
const update = () => { cancelAnimationFrame(frame); frame = requestAnimationFrame(() => setTick((x) => x + 1)); };
|
|
37
|
+
editor.on("transaction", update);
|
|
38
|
+
window.addEventListener("scroll", update, true); window.addEventListener("resize", update);
|
|
39
|
+
return () => { cancelAnimationFrame(frame); editor.off("transaction", update); window.removeEventListener("scroll", update, true); window.removeEventListener("resize", update); };
|
|
40
|
+
}, [editor, on]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Kéo theo con trỏ: gọi `move(dx, dy)` khi rê, `end()` khi thả. */
|
|
44
|
+
function drag(e: ReactPointerEvent, move: (dx: number, dy: number) => void, end?: () => void) {
|
|
45
|
+
e.preventDefault(); e.stopPropagation();
|
|
46
|
+
const x0 = e.clientX, y0 = e.clientY;
|
|
47
|
+
const onMove = (ev: PointerEvent) => { ev.preventDefault(); move(ev.clientX - x0, ev.clientY - y0); };
|
|
48
|
+
const onUp = () => { window.removeEventListener("pointermove", onMove); window.removeEventListener("pointerup", onUp); window.removeEventListener("pointercancel", onUp); end?.(); };
|
|
49
|
+
window.addEventListener("pointermove", onMove); window.addEventListener("pointerup", onUp); window.addEventListener("pointercancel", onUp);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const device = (editor: TiptapEditor): Device => (editor.storage as any).cmsEditorContext?.device ?? "base";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Kéo chỉnh ngay trên khung soạn: thanh giữa các cột (bộ cột chứa con trỏ) đổi độ rộng cột;
|
|
56
|
+
* chọn cả khối bố cục (nhóm, ảnh bìa, cột…) → kéo 4 cạnh đổi khoảng đệm theo khổ màn hình đang sửa ở tab Kiểu dáng.
|
|
57
|
+
*/
|
|
58
|
+
export function CanvasHandles({ editor, t }: { editor: TiptapEditor; t: EditorLabels }) {
|
|
59
|
+
const target = useEditorState({ editor, selector: ({ editor: e }) => (e.isEditable ? findTarget(e) : null),
|
|
60
|
+
equalityFn: (a, b) => a?.columns?.pos === b?.columns?.pos && a?.columns?.node === b?.columns?.node && a?.padded?.pos === b?.padded?.pos && a?.padded?.node === b?.padded?.node });
|
|
61
|
+
const [tip, setTip] = useState<{ x: number; y: number; text: string } | null>(null);
|
|
62
|
+
useTick(editor, !!(target?.columns || target?.padded));
|
|
63
|
+
if (!target || (!target.columns && !target.padded)) return null;
|
|
64
|
+
|
|
65
|
+
const handles: ReactElement[] = [];
|
|
66
|
+
const view = editor.view;
|
|
67
|
+
|
|
68
|
+
// Độ rộng cột: thanh kéo ở khe giữa hai cột liền nhau (bỏ qua khi cột đang xếp chồng)
|
|
69
|
+
if (target.columns) {
|
|
70
|
+
const { pos, node } = target.columns;
|
|
71
|
+
const cols: Array<{ pos: number; rect: DOMRect }> = [];
|
|
72
|
+
let p = pos + 1;
|
|
73
|
+
node.forEach((col) => { const dom = view.nodeDOM(p) as HTMLElement | null; if (dom?.getBoundingClientRect) cols.push({ pos: p, rect: dom.getBoundingClientRect() }); p += col.nodeSize; });
|
|
74
|
+
const side = cols.length === node.childCount && cols.every((c, i) => i === 0 || c.rect.left >= cols[i - 1].rect.right - 1);
|
|
75
|
+
if (side) {
|
|
76
|
+
const total = cols.reduce((s, c) => s + c.rect.width, 0);
|
|
77
|
+
for (let i = 0; i < cols.length - 1; i++) {
|
|
78
|
+
const a = cols[i].rect, b = cols[i + 1].rect;
|
|
79
|
+
const x = (a.right + b.left) / 2, top = Math.min(a.top, b.top), height = Math.max(a.bottom, b.bottom) - top;
|
|
80
|
+
handles.push(<div key={`c${i}`} className="cms-ed-colhandle" role="separator" aria-orientation="vertical" aria-label={t.resizeColumns} title={t.resizeColumns}
|
|
81
|
+
style={{ left: x - 5, top, height }}
|
|
82
|
+
onPointerDown={(e) => {
|
|
83
|
+
const start = cols.map((c) => (c.rect.width / total) * 100), pair = start[i] + start[i + 1];
|
|
84
|
+
drag(e, (dx) => {
|
|
85
|
+
const left = Math.round(Math.min(pair - 10, Math.max(10, start[i] + (dx / total) * 100)));
|
|
86
|
+
const widths = start.map((w) => Math.round(w));
|
|
87
|
+
widths[i] = left; widths[i + 1] = Math.round(pair) - left;
|
|
88
|
+
const cur = editor.state.doc.nodeAt(pos);
|
|
89
|
+
if (!cur || cur.type.name !== "columns") return;
|
|
90
|
+
const tr = editor.state.tr;
|
|
91
|
+
let q = pos + 1;
|
|
92
|
+
cur.forEach((col, _o, k) => { if (col.attrs.width !== widths[k]) tr.setNodeMarkup(q, undefined, { ...col.attrs, width: widths[k] }); q += col.nodeSize; });
|
|
93
|
+
if (tr.docChanged) view.dispatch(tr);
|
|
94
|
+
setTip({ x: e.clientX + dx, y: top - 28, text: widths.map((w) => `${w}%`).join(" · ") });
|
|
95
|
+
}, () => setTip(null));
|
|
96
|
+
}} />);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Khoảng đệm: 4 dải ở mép trong của khối, rộng bằng khoảng đệm hiện tại
|
|
102
|
+
if (target.padded) {
|
|
103
|
+
const { pos } = target.padded;
|
|
104
|
+
const dom = view.nodeDOM(pos) as HTMLElement | null;
|
|
105
|
+
if (dom?.getBoundingClientRect) {
|
|
106
|
+
const r = dom.getBoundingClientRect(), cs = getComputedStyle(dom);
|
|
107
|
+
const pad: Record<Side, number> = { top: parseFloat(cs.paddingTop) || 0, right: parseFloat(cs.paddingRight) || 0, bottom: parseFloat(cs.paddingBottom) || 0, left: parseFloat(cs.paddingLeft) || 0 };
|
|
108
|
+
for (const s of SIDES) {
|
|
109
|
+
const size = Math.max(6, pad[s]);
|
|
110
|
+
const box = s === "top" ? { left: r.left, top: r.top, width: r.width, height: size }
|
|
111
|
+
: s === "bottom" ? { left: r.left, top: r.bottom - size, width: r.width, height: size }
|
|
112
|
+
: s === "left" ? { left: r.left, top: r.top, width: size, height: r.height }
|
|
113
|
+
: { left: r.right - size, top: r.top, width: size, height: r.height };
|
|
114
|
+
handles.push(<div key={`p${s}`} className={`cms-ed-padhandle is-${s}`} role="separator" aria-orientation={s === "top" || s === "bottom" ? "horizontal" : "vertical"}
|
|
115
|
+
aria-label={`${t.style_padding} · ${t[`side_${s}` as keyof EditorLabels]}`} title={t.dragPadding} style={box}
|
|
116
|
+
onPointerDown={(e) => {
|
|
117
|
+
const d = device(editor), start = pad[s], sign = s === "right" ? -1 : 1; // kéo xuống / sang phải = tăng; cạnh phải kéo vào trong = tăng
|
|
118
|
+
drag(e, (dx, dy) => {
|
|
119
|
+
const delta = s === "top" || s === "bottom" ? dy : dx;
|
|
120
|
+
const value = Math.max(0, Math.min(400, Math.round(start + sign * delta)));
|
|
121
|
+
setPadding(editor, pos, d, s, `${value}px`, pad);
|
|
122
|
+
setTip({ x: e.clientX + dx, y: e.clientY + dy - 32, text: `${value}px${d !== "base" ? ` · ${t[`device_${d}` as keyof EditorLabels]}` : ""}` });
|
|
123
|
+
}, () => setTip(null));
|
|
124
|
+
}} />);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return createPortal(
|
|
130
|
+
<div className="cms-ed-handles">
|
|
131
|
+
{handles}
|
|
132
|
+
{tip && <div className="cms-ed-handletip" style={{ left: tip.x, top: Math.max(4, tip.y) }}>{tip.text}</div>}
|
|
133
|
+
</div>,
|
|
134
|
+
document.body,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Đặt khoảng đệm một cạnh cho khổ `d`, giữ nguyên các cạnh khác (giá trị gọn "lg" → tách ra 4 cạnh; cạnh chưa đặt lấy giá trị đang hiển thị). */
|
|
139
|
+
function setPadding(editor: TiptapEditor, pos: number, d: Device, side: Side, value: string, shown: Record<Side, number>) {
|
|
140
|
+
const node = editor.state.doc.nodeAt(pos);
|
|
141
|
+
if (!node) return;
|
|
142
|
+
const style = (normalizeStyle(node.attrs.style) ?? {}) as Record<string, any>;
|
|
143
|
+
const cur: Box | undefined = style.padding?.[d];
|
|
144
|
+
const sides: Partial<Record<Side, string>> = typeof cur === "string" ? { top: cur, right: cur, bottom: cur, left: cur } : { ...(cur ?? {}) };
|
|
145
|
+
for (const s of SIDES) if (sides[s] === undefined) sides[s] = `${Math.round(shown[s])}px`;
|
|
146
|
+
sides[side] = value;
|
|
147
|
+
const next = { ...style, padding: { ...(style.padding ?? {}), [d]: sides } };
|
|
148
|
+
editor.view.dispatch(editor.state.tr.setNodeMarkup(pos, undefined, { ...node.attrs, style: normalizeStyle(next) ?? null }));
|
|
149
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { Editor, type EditorProps } from "./Editor";
|
|
2
|
+
export { contentToEditor, editorToContent } from "./content";
|
|
3
|
+
export { viLabels, enLabels, type EditorLabels } from "./labels";
|
|
4
|
+
export { imageAttrs, galleryImage } from "./media";
|
|
5
|
+
export { CmsImage, Gallery, VideoNode, AudioNode, FileNode } from "./nodes";
|
|
6
|
+
export { registerEditorExtension, unregisterEditorExtension, registeredExtensions } from "./registry";
|
|
7
|
+
export type { ContentDoc, EditorExtensionPack, InsertItem, MediaItem, MediaKind, MediaProvider, MediaSize } from "./types";
|
|
8
|
+
export { registerBlock, unregisterBlock, registeredBlocks, blockNode, type BlockEditProps, type RegisterBlockOptions } from "./blocks";
|
|
9
|
+
export { defineBlock, type BlockDefinition } from "@ecomcx/ecomweb-content";
|
|
10
|
+
/** Lớp TipTap cấp thấp (Node, Mark, Extension…) — cho ứng dụng nhúng cần viết extension riêng; plugin nên dùng defineBlock/registerBlock. */
|
|
11
|
+
export { Node, Mark, Extension, mergeAttributes, getSchema } from "@tiptap/core";
|
|
12
|
+
export { askOf, type Ask, type AskField, type AskOptions, type AskResult } from "./ask";
|
|
13
|
+
export { blockFromPos, currentBlock, deleteBlock, duplicateBlock, insertParagraphAfter, markContainer, moveBlock, parentBlock, type BlockRef } from "./blockops";
|
|
14
|
+
export { runBlockAction, type BlockAction } from "./handle";
|
|
15
|
+
export { Columns, Column, Group, Callout, ButtonNode, EmbedNode, COLUMN_PRESETS, setColumnCount, setColumnWidths } from "./layout";
|
|
16
|
+
export { cleanPastedHtml } from "./paste";
|
|
17
|
+
export { BlockInspector } from "./inspector";
|
|
18
|
+
export { StylePanel } from "./stylepanel";
|
|
19
|
+
export { BlockStyleAttr } from "./styleattr";
|
|
20
|
+
export { BlockInserter, insertItem } from "./inserter";
|
|
21
|
+
export { BlockTree } from "./outline";
|
|
22
|
+
export { blockInfo, type BlockInfo } from "./blockMeta";
|
|
23
|
+
export { blockTree, moveBlockTo, type BlockTreeItem } from "./blockops";
|
|
24
|
+
export { registerDynamicBlocks, DYNAMIC_BLOCKS } from "./dynamic";
|
|
25
|
+
export { registerBasicBlocks, Preformatted, SOCIAL_SERVICES } from "./basic";
|
|
26
|
+
export { registerPattern, unregisterPattern, registeredPatterns, registerCorePatterns, insertPattern, patternNodes, PATTERN_CATEGORIES, type Pattern } from "./patterns";
|
|
27
|
+
export { SyncedPattern, refreshSyncedPatterns, type PatternHost } from "./synced";
|
|
28
|
+
export { registerBlockPanel, unregisterBlockPanel, type BlockPanel, type BlockPanelProps } from "./panels";
|
|
29
|
+
export type { Editor as TiptapEditor } from "@tiptap/core";
|
package/src/insert.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor as TiptapEditor } from "@tiptap/core";
|
|
2
|
+
|
|
3
|
+
/** Chèn khối: dòng trống đang có con trỏ → thay luôn dòng đó (không để lại đoạn trống thừa); không thì chèn tại con trỏ. */
|
|
4
|
+
export function insertBlock(e: TiptapEditor, node: Record<string, unknown>) {
|
|
5
|
+
const { $from, empty } = e.state.selection;
|
|
6
|
+
if (empty && $from.depth > 0 && $from.parent.type.name === "paragraph" && $from.parent.content.size === 0)
|
|
7
|
+
return e.chain().focus().insertContentAt({ from: $from.before(), to: $from.after() }, node).run();
|
|
8
|
+
return e.chain().focus().insertContent(node).run();
|
|
9
|
+
}
|
package/src/inserter.tsx
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { Editor as TiptapEditor } from "@tiptap/core";
|
|
2
|
+
import { useEditorState } from "@tiptap/react";
|
|
3
|
+
import { TextSelection } from "@tiptap/pm/state";
|
|
4
|
+
import type { EditorView } from "@tiptap/pm/view";
|
|
5
|
+
import { Search } from "lucide-react";
|
|
6
|
+
import { useId, useMemo, useState, useSyncExternalStore, type DragEvent } from "react";
|
|
7
|
+
import { blockFromPos, currentBlock, insertParagraphAfter } from "./blockops";
|
|
8
|
+
import { viLabels, type EditorLabels } from "./labels";
|
|
9
|
+
import { labelsOf } from "./nodes";
|
|
10
|
+
import type { InsertItem } from "./types";
|
|
11
|
+
import { DYNAMIC_NODES } from "@ecomcx/ecomweb-content";
|
|
12
|
+
import { rankItems } from "./rank";
|
|
13
|
+
import { DOMSerializer } from "@tiptap/pm/model";
|
|
14
|
+
import { PATTERN_CATEGORIES, insertPattern, onPatternsChange, patternNodes, registeredPatterns, type Pattern } from "./patterns";
|
|
15
|
+
import { cx, norm } from "./util";
|
|
16
|
+
|
|
17
|
+
/** Kiểu dữ liệu kéo từ trình chèn vào trình soạn. */
|
|
18
|
+
export const INSERT_MIME = "application/x-cms-insert";
|
|
19
|
+
|
|
20
|
+
const GROUPS: Array<[keyof EditorLabels, string[]]> = [
|
|
21
|
+
["groupText", ["p", "h2", "h3", "h4", "ul", "ol", "quote", "block:pullquote", "code", "preformatted", "table", "block:details", "block:tableOfContents"]],
|
|
22
|
+
["groupMedia", ["image", "gallery", "block:cover", "block:mediaText", "video", "audio", "file"]],
|
|
23
|
+
["groupDesign", ["columns2", "columns3", "group", "callout", "button", "block:buttons", "block:spacer", "hr"]],
|
|
24
|
+
["groupEmbed", ["youtube", "embed", "block:socialLinks"]],
|
|
25
|
+
["groupWidgets", ["shortcode", "block:customHtml"]],
|
|
26
|
+
["groupTheme", [...DYNAMIC_NODES].map((n) => `block:${n}`)],
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const itemsOf = (editor: TiptapEditor): InsertItem[] => (editor.storage as any).cmsEditorContext?.items ?? [];
|
|
30
|
+
|
|
31
|
+
/** Đoạn văn trống đang có con trỏ → dùng luôn; không thì thêm đoạn trống dưới khối hiện tại (hoặc cuối bài). */
|
|
32
|
+
function prepareLine(editor: TiptapEditor) {
|
|
33
|
+
const { state } = editor;
|
|
34
|
+
const block = currentBlock(state);
|
|
35
|
+
if (block && block.node.type.name === "paragraph" && block.node.content.size === 0) return;
|
|
36
|
+
if (block) { editor.view.dispatch(insertParagraphAfter(state, block)); return; }
|
|
37
|
+
const end = state.doc.content.size;
|
|
38
|
+
const tr = state.tr.insert(end, state.schema.nodes.paragraph.create());
|
|
39
|
+
editor.view.dispatch(tr.setSelection(TextSelection.create(tr.doc, end + 1)));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Chèn một lệnh của trình chèn / slash menu dưới khối đang chọn. */
|
|
43
|
+
export function insertItem(editor: TiptapEditor, item: InsertItem) {
|
|
44
|
+
prepareLine(editor);
|
|
45
|
+
item.run(editor);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Thả từ trình chèn vào trình soạn: thêm đoạn trống phía trên / dưới khối dưới con trỏ chuột (theo nửa trên / nửa dưới), rồi chạy lệnh.
|
|
50
|
+
* Editor gọi hàm này trong handleDrop; trả true khi đã xử lý.
|
|
51
|
+
*/
|
|
52
|
+
export function handleInsertDrop(editor: TiptapEditor, view: EditorView, event: DragEvent | globalThis.DragEvent): boolean {
|
|
53
|
+
const key = event.dataTransfer?.getData(INSERT_MIME);
|
|
54
|
+
if (!key) return false;
|
|
55
|
+
const item = itemsOf(editor).find((i) => i.key === key);
|
|
56
|
+
if (!item) return false;
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
const at = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
59
|
+
const block = at ? blockFromPos(view.state.doc, at.inside >= 0 ? at.inside : Math.max(0, at.pos - 1)) : null;
|
|
60
|
+
let pos = view.state.doc.content.size;
|
|
61
|
+
if (block) {
|
|
62
|
+
const dom = view.nodeDOM(block.pos) as HTMLElement | null;
|
|
63
|
+
const rect = dom?.getBoundingClientRect?.();
|
|
64
|
+
pos = rect && event.clientY < rect.top + rect.height / 2 ? block.pos : block.pos + block.node.nodeSize;
|
|
65
|
+
}
|
|
66
|
+
const tr = view.state.tr.insert(pos, view.state.schema.nodes.paragraph.create());
|
|
67
|
+
view.dispatch(tr.setSelection(TextSelection.create(tr.doc, pos + 1)));
|
|
68
|
+
view.focus();
|
|
69
|
+
item.run(editor);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Xem trước thu nhỏ của mẫu: HTML dựng từ schema của chính trình soạn (cùng CSS nền ecx-content). */
|
|
74
|
+
function PatternPreview({ editor, pattern }: { editor: TiptapEditor; pattern: Pattern }) {
|
|
75
|
+
const html = useMemo(() => {
|
|
76
|
+
try {
|
|
77
|
+
const doc = editor.schema.nodeFromJSON({ type: "doc", content: patternNodes(pattern) });
|
|
78
|
+
const div = document.createElement("div");
|
|
79
|
+
div.appendChild(DOMSerializer.fromSchema(editor.schema).serializeFragment(doc.content));
|
|
80
|
+
return div.innerHTML;
|
|
81
|
+
} catch { return ""; }
|
|
82
|
+
}, [editor, pattern]);
|
|
83
|
+
return <div className="cms-ed-pattern-preview" aria-hidden><div className="cms-ed-pattern-canvas ecx-content" dangerouslySetInnerHTML={{ __html: html }} /></div>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Tab "Mẫu" của trình chèn: mẫu theo nhóm, tìm theo tên / từ khoá, bấm để chèn dưới khối đang chọn. */
|
|
87
|
+
function PatternList({ editor, t, query }: { editor: TiptapEditor; t: EditorLabels; query: string }) {
|
|
88
|
+
const all = useSyncExternalStore(onPatternsChange, registeredPatterns);
|
|
89
|
+
const q = norm(query.trim());
|
|
90
|
+
const list = q ? all.filter((p) => norm(`${p.title} ${p.description ?? ""} ${p.keywords ?? ""} ${p.category}`).includes(q)) : all;
|
|
91
|
+
const cats = [...new Set(["mine", ...PATTERN_CATEGORIES, ...list.map((p) => p.category)])].filter((c) => list.some((p) => p.category === c));
|
|
92
|
+
if (!list.length) return <p className="cms-ed-inspector-empty">{t.noPatterns}</p>;
|
|
93
|
+
return <>
|
|
94
|
+
{cats.map((c) => (
|
|
95
|
+
<section key={c} className="cms-ed-inserter-group" aria-label={(t as Record<string, string>)[`cat_${c}`] ?? c}>
|
|
96
|
+
<h3>{(t as Record<string, string>)[`cat_${c}`] ?? c}</h3>
|
|
97
|
+
<div className="cms-ed-pattern-list">
|
|
98
|
+
{list.filter((p) => p.category === c).map((p) => (
|
|
99
|
+
<button key={p.name} type="button" className="cms-ed-pattern" data-pattern={p.name} title={p.description} onClick={() => insertPattern(editor, p)}>
|
|
100
|
+
<PatternPreview editor={editor} pattern={p} />
|
|
101
|
+
<span className="cms-ed-pattern-title">{p.title}{p.synced && <span className="cms-ed-pattern-synced">{t.syncedBadge}</span>}</span>
|
|
102
|
+
</button>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
</section>
|
|
106
|
+
))}
|
|
107
|
+
</>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Trình chèn khối (cột trái): tab Khối (tìm, bấm để chèn, kéo vào bài) và Mẫu (đoạn dựng sẵn). */
|
|
111
|
+
export function BlockInserter({ editor, labels }: { editor: TiptapEditor; labels?: Partial<EditorLabels> }) {
|
|
112
|
+
const t = { ...viLabels, ...labelsOf(editor), ...labels };
|
|
113
|
+
const [query, setQuery] = useState("");
|
|
114
|
+
const [tab, setTab] = useState<"blocks" | "patterns">("blocks");
|
|
115
|
+
const id = useId();
|
|
116
|
+
// Danh sách lệnh do Editor đặt vào ngữ cảnh (gồm khối của plugin); đọc lại khi trình soạn đổi
|
|
117
|
+
const items = useEditorState({ editor, selector: ({ editor: e }) => itemsOf(e), equalityFn: (a, b) => a === b });
|
|
118
|
+
const list = query.trim() ? rankItems(items, query) : items;
|
|
119
|
+
const known = new Set(GROUPS.flatMap(([, keys]) => keys));
|
|
120
|
+
const groups: Array<[string, InsertItem[]]> = query.trim()
|
|
121
|
+
? [["", list]]
|
|
122
|
+
: [...GROUPS.map(([label, keys]) => [t[label], keys.map((k) => list.find((i) => i.key === k)).filter(Boolean) as InsertItem[]] as [string, InsertItem[]]),
|
|
123
|
+
[t.groupPlugin, list.filter((i) => !known.has(i.key))]];
|
|
124
|
+
|
|
125
|
+
const onDragStart = (e: DragEvent, item: InsertItem) => {
|
|
126
|
+
e.dataTransfer.setData(INSERT_MIME, item.key);
|
|
127
|
+
e.dataTransfer.setData("text/plain", item.title);
|
|
128
|
+
e.dataTransfer.effectAllowed = "copy";
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className="cms-ed-inserter">
|
|
133
|
+
<div className="cms-ed-inspector-tabs" role="tablist" aria-label={t.inserter}>
|
|
134
|
+
{(["blocks", "patterns"] as const).map((k) => (
|
|
135
|
+
<button key={k} type="button" role="tab" aria-selected={tab === k} className={cx(tab === k && "is-active")} onClick={() => setTab(k)}>{k === "blocks" ? t.tabBlocks : t.tabPatterns}</button>
|
|
136
|
+
))}
|
|
137
|
+
</div>
|
|
138
|
+
<label className="cms-ed-inserter-search" htmlFor={id}>
|
|
139
|
+
<Search size={14} aria-hidden />
|
|
140
|
+
<input id={id} type="search" placeholder={t.searchBlocks} aria-label={t.searchBlocks} value={query} onChange={(e) => setQuery(e.target.value)}
|
|
141
|
+
onKeyDown={(e) => { if (tab === "blocks" && e.key === "Enter" && list[0]) { e.preventDefault(); insertItem(editor, list[0]); } }} />
|
|
142
|
+
</label>
|
|
143
|
+
{tab === "patterns" ? <PatternList editor={editor} t={t} query={query} /> : <>
|
|
144
|
+
<p className="cms-ed-inserter-hint">{t.dragToInsert}</p>
|
|
145
|
+
{list.length === 0 && <p className="cms-ed-inspector-empty">{t.noBlocks}</p>}
|
|
146
|
+
{groups.filter(([, g]) => g.length).map(([label, g]) => (
|
|
147
|
+
<section key={label || "results"} className="cms-ed-inserter-group" aria-label={label || t.searchBlocks}>
|
|
148
|
+
{label && <h3>{label}</h3>}
|
|
149
|
+
<div className="cms-ed-inserter-grid">
|
|
150
|
+
{g.map((item) => (
|
|
151
|
+
<button key={item.key} type="button" draggable className={cx("cms-ed-inserter-item")} title={item.hint} data-key={item.key}
|
|
152
|
+
onDragStart={(e) => onDragStart(e, item)} onClick={() => insertItem(editor, item)}>
|
|
153
|
+
<item.icon size={20} aria-hidden />
|
|
154
|
+
<span>{item.title}</span>
|
|
155
|
+
</button>
|
|
156
|
+
))}
|
|
157
|
+
</div>
|
|
158
|
+
</section>
|
|
159
|
+
))}
|
|
160
|
+
</>}
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|