@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
package/src/layoutUi.tsx
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { Editor as TiptapEditor } from "@tiptap/core";
|
|
2
|
+
import { useEditorState } from "@tiptap/react";
|
|
3
|
+
import { NodeSelection, TextSelection, type EditorState } from "@tiptap/pm/state";
|
|
4
|
+
import type { Node as PMNode } from "@tiptap/pm/model";
|
|
5
|
+
import { embedInfo } from "@ecomcx/ecomweb-content";
|
|
6
|
+
import { AlignCenter, AlignLeft, AlignRight, Columns2, Columns3, Globe, Info, Pencil, RectangleHorizontal, SquareDashed } from "lucide-react";
|
|
7
|
+
import { useEffect, useRef, useState, type ReactNode } from "react";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
import { askOf } from "./ask";
|
|
10
|
+
import { setBlockAttrs } from "./blockops";
|
|
11
|
+
import { insertBlock } from "./insert";
|
|
12
|
+
export { insertBlock } from "./insert";
|
|
13
|
+
import type { EditorLabels } from "./labels";
|
|
14
|
+
import { COLUMN_PRESETS, emptyColumn, safeColor, setColumnCount, setColumnWidths } from "./layout";
|
|
15
|
+
import type { InsertItem } from "./types";
|
|
16
|
+
import { cx } from "./util";
|
|
17
|
+
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Lệnh chèn (slash menu)
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
const start = (e: TiptapEditor, r?: { from: number; to: number }) => (r ? e.chain().focus().deleteRange(r) : e.chain().focus());
|
|
22
|
+
|
|
23
|
+
/** Chèn khối chứa rồi đặt con trỏ vào đoạn văn đầu tiên bên trong. */
|
|
24
|
+
function insertContainer(e: TiptapEditor, r: { from: number; to: number } | undefined, node: Record<string, unknown>) {
|
|
25
|
+
start(e, r).run();
|
|
26
|
+
insertBlock(e, node);
|
|
27
|
+
// Con trỏ vào đoạn văn đầu tiên của khối vừa chèn (insertContent để con trỏ sau khối)
|
|
28
|
+
// = khối cùng loại bắt đầu gần nhất trước con trỏ
|
|
29
|
+
const { state } = e;
|
|
30
|
+
let target = -1;
|
|
31
|
+
state.doc.descendants((n, pos) => { if (n.type.name === node.type && pos < state.selection.from && pos > target) target = pos; });
|
|
32
|
+
const found = target >= 0 ? TextSelection.findFrom(state.doc.resolve(target + 1), 1, true) : null;
|
|
33
|
+
if (found) e.view.dispatch(state.tr.setSelection(found).scrollIntoView());
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function editButton(e: TiptapEditor, t: EditorLabels, current: Record<string, any> = {}) {
|
|
37
|
+
const r = await askOf(e)({ title: t.button, submit: current.text ? t.apply : t.insert, fields: [
|
|
38
|
+
{ key: "text", label: t.buttonText, value: current.text ?? "" },
|
|
39
|
+
{ key: "href", label: t.buttonUrl, type: "url", value: current.href ?? "", placeholder: "https://" },
|
|
40
|
+
{ key: "blank", label: t.linkNewTab, type: "checkbox", value: current.target === "_blank" },
|
|
41
|
+
] });
|
|
42
|
+
if (!r || r === "remove") return null;
|
|
43
|
+
return { text: String(r.text).trim() || null, href: String(r.href).trim() || null, target: r.blank ? "_blank" : null };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function editEmbed(e: TiptapEditor, t: EditorLabels, current: Record<string, any> = {}) {
|
|
47
|
+
const r = await askOf(e)({ title: t.embed, submit: current.url ? t.apply : t.insert, fields: [
|
|
48
|
+
{ key: "url", label: t.embedUrl, type: "url", value: current.url ?? "", placeholder: "https://" },
|
|
49
|
+
{ key: "caption", label: t.caption, value: current.caption ?? "" },
|
|
50
|
+
] });
|
|
51
|
+
if (!r || r === "remove" || !String(r.url).trim()) return null;
|
|
52
|
+
return { url: String(r.url).trim(), caption: String(r.caption).trim() || null };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function layoutItems(t: EditorLabels): InsertItem[] {
|
|
56
|
+
return [
|
|
57
|
+
{ key: "columns2", title: t.columns2, hint: t.columnsHint, icon: Columns2, keywords: "cot columns layout bo cuc 2",
|
|
58
|
+
run: (e, r) => insertContainer(e, r, { type: "columns", content: [emptyColumn(), emptyColumn()] }) },
|
|
59
|
+
{ key: "columns3", title: t.columns3, hint: t.columnsHint, icon: Columns3, keywords: "cot columns layout bo cuc 3",
|
|
60
|
+
run: (e, r) => insertContainer(e, r, { type: "columns", content: [emptyColumn(), emptyColumn(), emptyColumn()] }) },
|
|
61
|
+
{ key: "group", title: t.group, hint: t.groupHint, icon: SquareDashed, keywords: "nhom group khung section nen",
|
|
62
|
+
run: (e, r) => insertContainer(e, r, { type: "group", attrs: { padding: "medium" }, content: [{ type: "paragraph" }] }) },
|
|
63
|
+
{ key: "callout", title: t.callout, hint: t.calloutHint, icon: Info, keywords: "hop luu y callout canh bao note thong tin",
|
|
64
|
+
run: (e, r) => insertContainer(e, r, { type: "callout", attrs: { tone: "info" }, content: [{ type: "paragraph" }] }) },
|
|
65
|
+
{ key: "button", title: t.button, hint: t.buttonHint, icon: RectangleHorizontal, keywords: "nut button lien ket cta",
|
|
66
|
+
run: async (e, r) => {
|
|
67
|
+
start(e, r).run();
|
|
68
|
+
const a = await editButton(e, t);
|
|
69
|
+
if (a?.text) insertBlock(e, { type: "button", attrs: { ...a, variant: "primary" } });
|
|
70
|
+
} },
|
|
71
|
+
{ key: "embed", title: t.embed, hint: t.embedHint, icon: Globe, keywords: "nhung embed oembed video vimeo spotify tiktok twitter x instagram soundcloud codepen figma map ban do",
|
|
72
|
+
run: async (e, r) => {
|
|
73
|
+
start(e, r).run();
|
|
74
|
+
const a = await editEmbed(e, t);
|
|
75
|
+
if (a) insertBlock(e, { type: "embed", attrs: a });
|
|
76
|
+
} },
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Thanh cài đặt khối: hiện phía trên khối bố cục đang có con trỏ / đang chọn
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
const TYPES = new Set(["columns", "group", "callout", "button", "embed"]);
|
|
84
|
+
|
|
85
|
+
type Target = { pos: number; node: PMNode };
|
|
86
|
+
|
|
87
|
+
function settingsTarget(state: EditorState): Target | null {
|
|
88
|
+
const sel = state.selection;
|
|
89
|
+
if (sel instanceof NodeSelection) return TYPES.has(sel.node.type.name) ? { pos: sel.from, node: sel.node } : null;
|
|
90
|
+
if (!sel.empty) return null; // đang bôi đen chữ → menu định dạng
|
|
91
|
+
const $f = sel.$from;
|
|
92
|
+
for (let d = $f.depth; d > 0; d--) if (TYPES.has($f.node(d).type.name)) return { pos: $f.before(d), node: $f.node(d) };
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function Seg<T extends string>({ value, options, onChange, label }: { value: T | null; options: Array<[T, ReactNode, string]>; onChange(v: T): void; label: string }) {
|
|
97
|
+
return (
|
|
98
|
+
<span role="group" aria-label={label} className="cms-ed-seg">
|
|
99
|
+
{options.map(([v, content, title]) => (
|
|
100
|
+
<button key={v} type="button" title={title} aria-label={title} aria-pressed={value === v} className={cx("cms-ed-seg-btn", value === v && "is-active")}
|
|
101
|
+
onMouseDown={(e) => e.preventDefault()} onClick={() => onChange(v)}>{content}</button>
|
|
102
|
+
))}
|
|
103
|
+
</span>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function ColorField({ value, onChange, label, t }: { value: string | null; onChange(v: string | null): void; label: string; t: EditorLabels }) {
|
|
108
|
+
return (
|
|
109
|
+
<span className="cms-ed-color">
|
|
110
|
+
<label className="cms-ed-color-label">
|
|
111
|
+
<span>{label}</span>
|
|
112
|
+
<input type="color" aria-label={label} value={safeColor(value)?.startsWith("#") && value!.length === 7 ? value! : "#ffffff"} onChange={(e) => onChange(e.target.value)} />
|
|
113
|
+
</label>
|
|
114
|
+
{value && <button type="button" className="cms-ed-text-btn" onMouseDown={(e) => e.preventDefault()} onClick={() => onChange(null)}>{t.noColor}</button>}
|
|
115
|
+
</span>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Cài đặt của khối bố cục (cột, nhóm, hộp lưu ý, nút, nhúng) — dùng ở thanh nổi và ở tab "Khối". null = loại khối khác. */
|
|
120
|
+
export function LayoutSettings({ editor, pos, node, t, anchor }: { editor: TiptapEditor; pos: number; node: PMNode; t: EditorLabels; anchor?(): { left: number; top: number; bottom: number } | undefined }) {
|
|
121
|
+
const a = node.attrs as Record<string, any>;
|
|
122
|
+
const set = (attrs: Record<string, unknown>) => {
|
|
123
|
+
const tr = setBlockAttrs(editor.state, pos, attrs);
|
|
124
|
+
if (tr) editor.view.dispatch(tr);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
let body: ReactNode = null;
|
|
128
|
+
switch (node.type.name) {
|
|
129
|
+
case "columns": {
|
|
130
|
+
const widths = Array.from({ length: node.childCount }, (_, i) => Number(node.child(i).attrs.width) || 0);
|
|
131
|
+
const current = widths.every((w) => w > 0) ? widths.join("/") : null;
|
|
132
|
+
body = <>
|
|
133
|
+
<Seg label={t.layout} value={current} onChange={(v) => setColumnWidths(editor, pos, v.split("/").map(Number))}
|
|
134
|
+
options={(COLUMN_PRESETS[node.childCount] ?? []).map((p) => [p.join("/"), p.join(" / "), p.join(" / ")] as [string, ReactNode, string])} />
|
|
135
|
+
<button type="button" className="cms-ed-text-btn" disabled={node.childCount >= 4} onMouseDown={(e) => e.preventDefault()} onClick={() => setColumnCount(editor, pos, node.childCount + 1)}>{t.addColumn}</button>
|
|
136
|
+
<button type="button" className="cms-ed-text-btn" disabled={node.childCount <= 2} onMouseDown={(e) => e.preventDefault()} onClick={() => setColumnCount(editor, pos, node.childCount - 1)}>{t.removeColumn}</button>
|
|
137
|
+
<Seg label={t.vAlign} value={a.verticalAlign ?? "top"} onChange={(v) => set({ verticalAlign: v === "top" ? null : v })}
|
|
138
|
+
options={[["top", t.vTop, t.vTop], ["center", t.vCenter, t.vCenter], ["bottom", t.vBottom, t.vBottom]]} />
|
|
139
|
+
<label className="cms-ed-check"><input type="checkbox" checked={a.stack !== false} onChange={(e) => set({ stack: e.target.checked })} /> {t.stack}</label>
|
|
140
|
+
</>;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case "group":
|
|
144
|
+
body = <>
|
|
145
|
+
<ColorField label={t.background} value={a.background} onChange={(v) => set({ background: v })} t={t} />
|
|
146
|
+
<ColorField label={t.textColor} value={a.textColor} onChange={(v) => set({ textColor: v })} t={t} />
|
|
147
|
+
<Seg label={t.padding} value={a.padding ?? "medium"} onChange={(v) => set({ padding: v })}
|
|
148
|
+
options={[["none", t.padNone, t.padNone], ["small", t.padSmall, t.padSmall], ["medium", t.padMedium, t.padMedium], ["large", t.padLarge, t.padLarge]]} />
|
|
149
|
+
</>;
|
|
150
|
+
break;
|
|
151
|
+
case "callout":
|
|
152
|
+
body = <>
|
|
153
|
+
<Seg label={t.tone} value={a.tone ?? "info"} onChange={(v) => set({ tone: v })}
|
|
154
|
+
options={[["info", t.toneInfo, t.toneInfo], ["success", t.toneSuccess, t.toneSuccess], ["warning", t.toneWarning, t.toneWarning], ["danger", t.toneDanger, t.toneDanger]]} />
|
|
155
|
+
<button type="button" className="cms-ed-text-btn" onMouseDown={(e) => e.preventDefault()} onClick={async () => {
|
|
156
|
+
const r = await askOf(editor)({ title: t.calloutTitle, anchor: anchor?.(), fields: [{ key: "v", label: t.calloutTitle, value: a.title ?? "" }] });
|
|
157
|
+
if (r && r !== "remove") set({ title: String(r.v).trim() || null });
|
|
158
|
+
}}>{t.calloutTitle}</button>
|
|
159
|
+
</>;
|
|
160
|
+
break;
|
|
161
|
+
case "button":
|
|
162
|
+
body = <>
|
|
163
|
+
<button type="button" className="cms-ed-text-btn" onMouseDown={(e) => e.preventDefault()} onClick={async () => { const v = await editButton(editor, t, a); if (v?.text) set(v); }}>
|
|
164
|
+
<Pencil size={12} /> {t.edit}
|
|
165
|
+
</button>
|
|
166
|
+
<Seg label={t.variant} value={a.variant ?? "primary"} onChange={(v) => set({ variant: v })}
|
|
167
|
+
options={[["primary", t.variantPrimary, t.variantPrimary], ["secondary", t.variantSecondary, t.variantSecondary], ["outline", t.variantOutline, t.variantOutline]]} />
|
|
168
|
+
<Seg label={t.alignLeft} value={a.align ?? "left"} onChange={(v) => set({ align: v === "left" ? null : v })}
|
|
169
|
+
options={[["left", <AlignLeft size={14} />, t.alignLeft], ["center", <AlignCenter size={14} />, t.alignCenter], ["right", <AlignRight size={14} />, t.alignRight]]} />
|
|
170
|
+
</>;
|
|
171
|
+
break;
|
|
172
|
+
case "embed":
|
|
173
|
+
body = <>
|
|
174
|
+
<span className="cms-ed-bar-note">{embedInfo(a.url)?.title ?? t.embedUnsupported}</span>
|
|
175
|
+
<button type="button" className="cms-ed-text-btn" onMouseDown={(e) => e.preventDefault()} onClick={async () => { const v = await editEmbed(editor, t, a); if (v) set(v); }}>
|
|
176
|
+
<Pencil size={12} /> {t.edit}
|
|
177
|
+
</button>
|
|
178
|
+
</>;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return body;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const LAYOUT_TYPES = TYPES;
|
|
186
|
+
|
|
187
|
+
export function BlockSettingsBar({ editor, t }: { editor: TiptapEditor; t: EditorLabels }) {
|
|
188
|
+
const target = useEditorState({ editor, selector: ({ editor: e }) => settingsTarget(e.state), equalityFn: (a, b) => a?.pos === b?.pos && a?.node === b?.node });
|
|
189
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
190
|
+
const [rect, setRect] = useState<DOMRect | null>(null);
|
|
191
|
+
const [inside, setInside] = useState(false);
|
|
192
|
+
const [focused, setFocused] = useState(editor.isFocused);
|
|
193
|
+
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
const f = () => setFocused(true), b = () => setFocused(false);
|
|
196
|
+
editor.on("focus", f); editor.on("blur", b);
|
|
197
|
+
return () => { editor.off("focus", f); editor.off("blur", b); };
|
|
198
|
+
}, [editor]);
|
|
199
|
+
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (!target) { setRect(null); return; }
|
|
202
|
+
let frame = 0;
|
|
203
|
+
const update = () => { cancelAnimationFrame(frame); frame = requestAnimationFrame(() => {
|
|
204
|
+
const dom = editor.view.nodeDOM(target.pos) as HTMLElement | null;
|
|
205
|
+
setRect(dom?.getBoundingClientRect ? dom.getBoundingClientRect() : null);
|
|
206
|
+
}); };
|
|
207
|
+
update();
|
|
208
|
+
editor.on("transaction", update);
|
|
209
|
+
window.addEventListener("scroll", update, true); window.addEventListener("resize", update);
|
|
210
|
+
return () => { cancelAnimationFrame(frame); editor.off("transaction", update); window.removeEventListener("scroll", update, true); window.removeEventListener("resize", update); };
|
|
211
|
+
}, [editor, target?.pos, target?.node]);
|
|
212
|
+
|
|
213
|
+
if (!target || !rect || !(focused || inside)) return null;
|
|
214
|
+
// Có tab "Khối" (BlockInspector) → cài đặt nằm ở đó, không hiện thanh nổi
|
|
215
|
+
if (((editor.storage as any).cmsEditorContext?.inspector ?? 0) > 0) return null;
|
|
216
|
+
const anchor = () => { const r = ref.current?.getBoundingClientRect(); return r ? { left: r.left, top: r.top, bottom: r.bottom } : undefined; };
|
|
217
|
+
const top = rect.top - 44 < 8 ? rect.top + 6 : rect.top - 44;
|
|
218
|
+
return createPortal(
|
|
219
|
+
<div ref={ref} role="toolbar" aria-label={t.blockSettings} className="cms-ed-bar" style={{ top, left: Math.max(8, rect.left) }}
|
|
220
|
+
onFocus={() => setInside(true)} onBlur={(e) => { if (!ref.current?.contains(e.relatedTarget as Node)) setInside(false); }}
|
|
221
|
+
onMouseEnter={() => setInside(true)} onMouseLeave={() => { if (!ref.current?.contains(document.activeElement)) setInside(false); }}>
|
|
222
|
+
<LayoutSettings editor={editor} pos={target.pos} node={target.node} t={t} anchor={anchor} />
|
|
223
|
+
</div>,
|
|
224
|
+
document.body,
|
|
225
|
+
);
|
|
226
|
+
}
|
package/src/media.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MediaItem, MediaSize } from "./types";
|
|
2
|
+
|
|
3
|
+
/** Cỡ cùng tỉ lệ ≤ cỡ được chọn → srcset (trình duyệt tự chọn file vừa đủ). */
|
|
4
|
+
function candidates(m: MediaItem, size: string): MediaSize[] {
|
|
5
|
+
const full: MediaSize = { url: m.url, width: m.width ?? 0, height: m.height ?? 0, webpUrl: m.webpUrl };
|
|
6
|
+
const sizes = m.sizes ?? {};
|
|
7
|
+
const target = size === "full" ? full : sizes[size] ?? full;
|
|
8
|
+
const r = target.height ? target.width / target.height : 0;
|
|
9
|
+
const all = [...Object.values(sizes), full];
|
|
10
|
+
const list = all.filter((s) => s.width && s.height && s.width <= target.width && Math.abs(s.width / s.height - r) < 0.02);
|
|
11
|
+
if (!list.includes(target)) list.push(target);
|
|
12
|
+
return list.sort((a, b) => a.width - b.width).filter((s, i, arr) => i === 0 || s.width !== arr[i - 1].width);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Thuộc tính node ảnh khi chèn từ thư viện: src, srcset JPEG + WebP, kích thước (chống nhảy layout). */
|
|
16
|
+
export function imageAttrs(m: MediaItem, size = "large") {
|
|
17
|
+
const list = candidates(m, size);
|
|
18
|
+
const main = list[list.length - 1];
|
|
19
|
+
return {
|
|
20
|
+
src: main.url, mediaId: m.id, size, alt: m.alt || "", caption: m.caption || null,
|
|
21
|
+
width: main.width || null, height: main.height || null,
|
|
22
|
+
srcset: list.length > 1 ? list.map((s) => `${s.url} ${s.width}w`).join(", ") : null,
|
|
23
|
+
webpSrcset: list.every((s) => s.webpUrl) ? list.map((s) => `${s.webpUrl} ${s.width}w`).join(", ") : null,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Ảnh trong gallery: cỡ medium_large (đủ nét dạng lưới) + liên kết ảnh gốc. */
|
|
28
|
+
export function galleryImage(m: MediaItem) {
|
|
29
|
+
const a = imageAttrs(m, m.sizes?.medium_large ? "medium_large" : "large");
|
|
30
|
+
return { mediaId: m.id, src: a.src, srcset: a.srcset, webpSrcset: a.webpSrcset, width: a.width, height: a.height, alt: m.alt || "", caption: m.caption || "", full: m.url };
|
|
31
|
+
}
|
package/src/nodes.tsx
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Extension, Node, mergeAttributes, type Editor } from "@tiptap/core";
|
|
2
|
+
import Image from "@tiptap/extension-image";
|
|
3
|
+
import { NodeViewWrapper, ReactNodeViewRenderer, type ReactNodeViewProps } from "@tiptap/react";
|
|
4
|
+
import { FileText, Music, Video as VideoIcon } from "lucide-react";
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
import { viLabels, type EditorLabels } from "./labels";
|
|
7
|
+
import { cx } from "./util";
|
|
8
|
+
import type { Ask } from "./ask";
|
|
9
|
+
|
|
10
|
+
/** Ngữ cảnh dùng chung cho node view (chữ giao diện…), đặt bởi component Editor. */
|
|
11
|
+
export const EditorContext = Extension.create<unknown, { labels: EditorLabels; ask: Ask; items: unknown[]; inspector: number }>({
|
|
12
|
+
name: "cmsEditorContext",
|
|
13
|
+
addStorage: () => ({ labels: viLabels, ask: async () => null, items: [], inspector: 0 }),
|
|
14
|
+
});
|
|
15
|
+
export const labelsOf = (editor: Editor): EditorLabels => (editor.storage as any).cmsEditorContext?.labels ?? viLabels;
|
|
16
|
+
|
|
17
|
+
/** Thuộc tính chỉ lưu trong JSON (không render thành thuộc tính HTML lạ trong trình soạn). */
|
|
18
|
+
const dataAttr = (name: string, def: unknown = null) => ({ default: def, renderHTML: () => ({}), parseHTML: (el: HTMLElement) => el.getAttribute(`data-${name}`) ?? def });
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Ảnh: mediaId, srcset (JPEG + WebP), cỡ, căn lề, chú thích; kéo góc để đổi kích thước hiển thị (giữ tỉ lệ).
|
|
22
|
+
* width/height lưu kích thước hiển thị → theme render ảnh responsive đúng cỡ, không nhảy layout.
|
|
23
|
+
*/
|
|
24
|
+
export const CmsImage = Image.extend({
|
|
25
|
+
addAttributes() {
|
|
26
|
+
return {
|
|
27
|
+
...this.parent?.(),
|
|
28
|
+
mediaId: dataAttr("media-id"),
|
|
29
|
+
srcset: { default: null, renderHTML: (a) => (a.srcset ? { srcset: a.srcset } : {}) },
|
|
30
|
+
webpSrcset: dataAttr("webp-srcset"),
|
|
31
|
+
width: { default: null },
|
|
32
|
+
height: { default: null },
|
|
33
|
+
size: dataAttr("size", "large"),
|
|
34
|
+
caption: dataAttr("caption"),
|
|
35
|
+
align: { default: null, renderHTML: (a) => (a.align ? { "data-align": a.align } : {}) },
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
}).configure({
|
|
39
|
+
inline: false,
|
|
40
|
+
resize: { enabled: true, alwaysPreserveAspectRatio: true, minWidth: 60, minHeight: 40, directions: ["top-left", "top-right", "bottom-left", "bottom-right"] },
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function Frame({ selected, children, label }: { selected: boolean; children: ReactNode; label: string }) {
|
|
44
|
+
return (
|
|
45
|
+
<NodeViewWrapper className={cx("cms-ed-block", selected && "is-selected")} data-drag-handle>
|
|
46
|
+
<div className="cms-ed-block-label">{label}</div>
|
|
47
|
+
{children}
|
|
48
|
+
</NodeViewWrapper>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function GalleryView({ node, selected, updateAttributes, editor }: ReactNodeViewProps) {
|
|
53
|
+
const t = labelsOf(editor);
|
|
54
|
+
const images = (node.attrs.images ?? []) as Array<{ src: string; alt?: string }>;
|
|
55
|
+
const cols = node.attrs.columns ?? 3;
|
|
56
|
+
return (
|
|
57
|
+
<Frame selected={selected} label={t.galleryLabel.replace("{n}", String(images.length))}>
|
|
58
|
+
<div className="cms-ed-gallery" style={{ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` }}>
|
|
59
|
+
{images.map((im, i) => <img key={i} src={im.src} alt={im.alt ?? ""} />)}
|
|
60
|
+
</div>
|
|
61
|
+
<div className="cms-ed-gallery-cols" contentEditable={false}>
|
|
62
|
+
{t.columns}
|
|
63
|
+
{[2, 3, 4, 5].map((n) => <button key={n} type="button" onClick={() => updateAttributes({ columns: n })} className={cx(n === cols && "is-active")}>{n}</button>)}
|
|
64
|
+
</div>
|
|
65
|
+
</Frame>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const Gallery = Node.create({
|
|
70
|
+
name: "gallery",
|
|
71
|
+
group: "block",
|
|
72
|
+
atom: true,
|
|
73
|
+
draggable: true,
|
|
74
|
+
addAttributes: () => ({ images: { default: [] }, columns: { default: 3 }, caption: { default: null } }),
|
|
75
|
+
parseHTML: () => [{ tag: "div[data-gallery]" }],
|
|
76
|
+
renderHTML: () => ["div", mergeAttributes({ "data-gallery": "" })],
|
|
77
|
+
addNodeView: () => ReactNodeViewRenderer(GalleryView),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
function MediaView({ node, selected, editor }: ReactNodeViewProps) {
|
|
81
|
+
const t = labelsOf(editor);
|
|
82
|
+
const kind = node.type.name;
|
|
83
|
+
return (
|
|
84
|
+
<Frame selected={selected} label={kind === "video" ? t.videoLabel : kind === "audio" ? t.audioLabel : t.fileLabel}>
|
|
85
|
+
{kind === "video" && <video src={node.attrs.src} controls className="cms-ed-video" />}
|
|
86
|
+
{kind === "audio" && <audio src={node.attrs.src} controls className="cms-ed-audio" />}
|
|
87
|
+
{kind === "file" && <div className="cms-ed-file"><FileText size={20} /><span>{node.attrs.name}</span></div>}
|
|
88
|
+
{kind !== "file" && <div className="cms-ed-media-name">{kind === "video" ? <VideoIcon size={12} /> : <Music size={12} />}{node.attrs.name ?? node.attrs.src}</div>}
|
|
89
|
+
</Frame>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const mediaNode = (name: "video" | "audio" | "file", extra: Record<string, unknown> = {}) => Node.create({
|
|
94
|
+
name,
|
|
95
|
+
group: "block",
|
|
96
|
+
atom: true,
|
|
97
|
+
draggable: true,
|
|
98
|
+
addAttributes: () => ({ src: { default: null }, name: { default: null }, mime: { default: null }, mediaId: { default: null }, caption: { default: null }, ...extra }),
|
|
99
|
+
parseHTML: () => [{ tag: `div[data-${name}]` }],
|
|
100
|
+
renderHTML: ({ HTMLAttributes }) => ["div", { [`data-${name}`]: HTMLAttributes.src ?? "" }],
|
|
101
|
+
addNodeView: () => ReactNodeViewRenderer(MediaView),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export const VideoNode = mediaNode("video", { poster: { default: null } });
|
|
105
|
+
export const AudioNode = mediaNode("audio");
|
|
106
|
+
/** Tệp tải xuống (theme hiển thị PDF ngay trong trang, tệp khác là liên kết tải). */
|
|
107
|
+
export const FileNode = mediaNode("file", { size: { default: null }, embed: { default: true } });
|
package/src/outline.tsx
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Editor as TiptapEditor } from "@tiptap/core";
|
|
2
|
+
import { useEditorState } from "@tiptap/react";
|
|
3
|
+
import { NodeSelection, TextSelection } from "@tiptap/pm/state";
|
|
4
|
+
import type { Node as PMNode } from "@tiptap/pm/model";
|
|
5
|
+
import { embedInfo } from "@ecomcx/ecomweb-content";
|
|
6
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
7
|
+
import { useRef, useState, type DragEvent, type KeyboardEvent } from "react";
|
|
8
|
+
import { blockInfo } from "./blockMeta";
|
|
9
|
+
import { blockTree, currentBlock, moveBlockTo, type BlockTreeItem } from "./blockops";
|
|
10
|
+
import { viLabels, type EditorLabels } from "./labels";
|
|
11
|
+
import { labelsOf } from "./nodes";
|
|
12
|
+
import { cx } from "./util";
|
|
13
|
+
|
|
14
|
+
/** Mô tả ngắn của khối trong cây (chữ đầu, alt ảnh, đường dẫn nhúng…). */
|
|
15
|
+
function preview(node: PMNode): string {
|
|
16
|
+
const a = node.attrs as Record<string, any>;
|
|
17
|
+
if (node.type.name === "embed") return embedInfo(a.url)?.title ?? a.url ?? "";
|
|
18
|
+
if (node.type.name === "button") return a.text ?? "";
|
|
19
|
+
if (node.type.name === "image") return a.alt || a.caption || "";
|
|
20
|
+
return node.textBetween(0, node.content.size, " ", " ").replace(/\s+/g, " ").trim().slice(0, 60);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type Row = BlockTreeItem & { parent: number | null };
|
|
24
|
+
|
|
25
|
+
/** Chọn khối từ cây: khối chữ → con trỏ ở cuối khối; khối khác → chọn cả khối. */
|
|
26
|
+
function selectBlock(editor: TiptapEditor, item: BlockTreeItem, focus: boolean) {
|
|
27
|
+
const { state } = editor;
|
|
28
|
+
const sel = item.node.isTextblock ? TextSelection.create(state.doc, item.pos + item.node.nodeSize - 1) : NodeSelection.create(state.doc, item.pos);
|
|
29
|
+
editor.view.dispatch(state.tr.setSelection(sel).scrollIntoView());
|
|
30
|
+
if (focus) editor.view.focus();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Cây khối của bài: khối lồng trong cột / nhóm / hộp lưu ý thụt vào; bấm để chọn,
|
|
35
|
+
* kéo thả để đổi chỗ (cả vào / ra khỏi vùng chứa), mũi tên lên/xuống để đi, ←/→ để thu/mở, Enter để vào khối.
|
|
36
|
+
*/
|
|
37
|
+
export function BlockTree({ editor, labels }: { editor: TiptapEditor; labels?: Partial<EditorLabels> }) {
|
|
38
|
+
const t = { ...viLabels, ...labelsOf(editor), ...labels };
|
|
39
|
+
const data = useEditorState({
|
|
40
|
+
editor,
|
|
41
|
+
selector: ({ editor: e }) => ({ tree: blockTree(e.state.doc), current: currentBlock(e.state)?.pos ?? -1, doc: e.state.doc }),
|
|
42
|
+
equalityFn: (a, b) => a?.doc === b?.doc && a?.current === b?.current,
|
|
43
|
+
});
|
|
44
|
+
const [collapsed, setCollapsed] = useState<Set<number>>(new Set());
|
|
45
|
+
const [drop, setDrop] = useState<{ pos: number; where: "before" | "after" } | null>(null);
|
|
46
|
+
const dragging = useRef<number | null>(null);
|
|
47
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
48
|
+
const [focusPos, setFocusPos] = useState<number | null>(null);
|
|
49
|
+
|
|
50
|
+
// Danh sách dòng đang hiện (bỏ con của mục đã thu gọn)
|
|
51
|
+
const rows: Row[] = [];
|
|
52
|
+
const flatten = (items: BlockTreeItem[], parent: number | null) => {
|
|
53
|
+
for (const it of items) {
|
|
54
|
+
rows.push({ ...it, parent });
|
|
55
|
+
if (it.children.length && !collapsed.has(it.pos)) flatten(it.children, it.pos);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
flatten(data.tree, null);
|
|
59
|
+
if (!rows.length) return <div className="cms-ed-outline"><p className="cms-ed-inspector-empty">{t.outlineEmpty}</p></div>;
|
|
60
|
+
const active = focusPos ?? (rows.some((r) => r.pos === data.current) ? data.current : rows[0].pos);
|
|
61
|
+
|
|
62
|
+
const toggle = (pos: number) => setCollapsed((c) => { const n = new Set(c); if (n.has(pos)) n.delete(pos); else n.add(pos); return n; });
|
|
63
|
+
const focusRow = (pos: number) => { setFocusPos(pos); requestAnimationFrame(() => ref.current?.querySelector<HTMLElement>(`[data-pos="${pos}"]`)?.focus()); };
|
|
64
|
+
|
|
65
|
+
function onKey(e: KeyboardEvent, row: Row, i: number) {
|
|
66
|
+
const go = (j: number) => { e.preventDefault(); const r = rows[Math.max(0, Math.min(rows.length - 1, j))]; focusRow(r.pos); selectBlock(editor, r, false); };
|
|
67
|
+
if (e.key === "ArrowDown") go(i + 1);
|
|
68
|
+
else if (e.key === "ArrowUp") go(i - 1);
|
|
69
|
+
else if (e.key === "Home") go(0);
|
|
70
|
+
else if (e.key === "End") go(rows.length - 1);
|
|
71
|
+
else if (e.key === "ArrowRight" && row.children.length) { e.preventDefault(); if (collapsed.has(row.pos)) toggle(row.pos); else go(i + 1); }
|
|
72
|
+
else if (e.key === "ArrowLeft") { e.preventDefault(); if (row.children.length && !collapsed.has(row.pos)) toggle(row.pos); else if (row.parent != null) focusRow(row.parent); }
|
|
73
|
+
else if (e.key === "Enter") { e.preventDefault(); selectBlock(editor, row, true); }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function onDragOver(e: DragEvent, row: Row) {
|
|
77
|
+
if (dragging.current == null || dragging.current === row.pos) return;
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
const r = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
80
|
+
const where = e.clientY < r.top + r.height / 2 ? "before" : "after";
|
|
81
|
+
if (drop?.pos !== row.pos || drop.where !== where) setDrop({ pos: row.pos, where });
|
|
82
|
+
}
|
|
83
|
+
function onDrop(e: DragEvent, row: Row) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
const from = dragging.current;
|
|
86
|
+
dragging.current = null;
|
|
87
|
+
setDrop(null);
|
|
88
|
+
if (from == null || from === row.pos) return;
|
|
89
|
+
// Tính lại nửa trên / dưới theo chỗ thả (không dựa vào state của dragover — có thể chưa kịp cập nhật)
|
|
90
|
+
const r = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
91
|
+
const to = e.clientY < r.top + r.height / 2 ? row.pos : row.pos + row.node.nodeSize;
|
|
92
|
+
const tr = moveBlockTo(editor.state, from, to);
|
|
93
|
+
if (tr) editor.view.dispatch(tr);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div ref={ref} className="cms-ed-outline" role="tree" aria-label={t.outline}>
|
|
98
|
+
<p className="cms-ed-inserter-hint">{t.outlineHint}</p>
|
|
99
|
+
{rows.map((row, i) => {
|
|
100
|
+
const info = blockInfo(row.node.type.name, t);
|
|
101
|
+
const open = row.children.length > 0 && !collapsed.has(row.pos);
|
|
102
|
+
return (
|
|
103
|
+
<div key={row.pos} data-pos={row.pos} role="treeitem" aria-level={row.depth + 1} aria-selected={row.pos === data.current}
|
|
104
|
+
aria-expanded={row.children.length ? open : undefined} tabIndex={row.pos === active ? 0 : -1} draggable
|
|
105
|
+
className={cx("cms-ed-outline-row", row.pos === data.current && "is-current", drop?.pos === row.pos && `is-drop-${drop.where}`)}
|
|
106
|
+
style={{ paddingLeft: 6 + row.depth * 14 }}
|
|
107
|
+
onClick={() => { setFocusPos(row.pos); selectBlock(editor, row, false); }}
|
|
108
|
+
onDoubleClick={() => selectBlock(editor, row, true)}
|
|
109
|
+
onKeyDown={(e) => onKey(e, row, i)}
|
|
110
|
+
onDragStart={(e) => { dragging.current = row.pos; e.dataTransfer.effectAllowed = "move"; e.dataTransfer.setData("text/plain", info.title); }}
|
|
111
|
+
onDragEnd={() => { dragging.current = null; setDrop(null); }}
|
|
112
|
+
onDragOver={(e) => onDragOver(e, row)} onDragLeave={() => setDrop(null)} onDrop={(e) => onDrop(e, row)}>
|
|
113
|
+
{row.children.length > 0
|
|
114
|
+
? <span className="cms-ed-outline-toggle" onClick={(e) => { e.stopPropagation(); toggle(row.pos); }} aria-hidden>{open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}</span>
|
|
115
|
+
: <span className="cms-ed-outline-toggle" aria-hidden />}
|
|
116
|
+
<info.icon size={14} aria-hidden />
|
|
117
|
+
<span className="cms-ed-outline-title">{info.title}</span>
|
|
118
|
+
<span className="cms-ed-outline-preview">{preview(row.node)}</span>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
})}
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
package/src/panels.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
import { registerEditorExtension, unregisterEditorExtension } from "./registry";
|
|
4
|
+
|
|
5
|
+
/** Props của panel plugin trong tab "Khối". */
|
|
6
|
+
export interface BlockPanelProps {
|
|
7
|
+
/** Loại khối đang chọn (vd "image", "button", "shop/product"). */
|
|
8
|
+
type: string;
|
|
9
|
+
/** Thuộc tính hiện tại của khối. */
|
|
10
|
+
attrs: Record<string, any>;
|
|
11
|
+
/** Đổi thuộc tính (chỉ thuộc tính đã khai báo ở `attributes` hoặc thuộc tính sẵn có của khối). */
|
|
12
|
+
setAttrs(attrs: Record<string, unknown>): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface BlockPanel {
|
|
16
|
+
/** Mã duy nhất, dạng "slug-plugin/tên". */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Tiêu đề mục trong tab "Khối" (nhận "%khoá%" — admin dịch theo plugin). */
|
|
19
|
+
title: string;
|
|
20
|
+
/** Loại khối áp dụng; bỏ trống = mọi khối. */
|
|
21
|
+
blocks?: string[];
|
|
22
|
+
/** Thứ tự (nhỏ đứng trước, mặc định 10). */
|
|
23
|
+
order?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Thuộc tính thêm vào khối (kể cả khối lõi), vd { lazy: { default: true } } — cần khai báo để trình soạn lưu được.
|
|
26
|
+
* Bắt buộc có `blocks` khi khai báo thuộc tính. Website đọc được qua filter "post.blocks" hoặc renderer của plugin.
|
|
27
|
+
*/
|
|
28
|
+
attributes?: Record<string, { default?: unknown }>;
|
|
29
|
+
component: ComponentType<BlockPanelProps>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const panels = new Map<string, BlockPanel>();
|
|
33
|
+
const listeners = new Set<() => void>();
|
|
34
|
+
let snapshot: BlockPanel[] = [];
|
|
35
|
+
const changed = () => { snapshot = [...panels.values()].sort((a, b) => (a.order ?? 10) - (b.order ?? 10)); listeners.forEach((l) => l()); };
|
|
36
|
+
|
|
37
|
+
/** Thêm panel vào tab "Khối" (BlockInspector) cho một số loại khối hoặc mọi khối. */
|
|
38
|
+
export function registerBlockPanel(panel: BlockPanel) {
|
|
39
|
+
panels.set(panel.id, panel);
|
|
40
|
+
if (panel.attributes && panel.blocks?.length) {
|
|
41
|
+
const attrs = Object.fromEntries(Object.entries(panel.attributes).map(([k, spec]) => [k, { default: spec.default ?? null, renderHTML: () => ({}), parseHTML: () => spec.default ?? null }]));
|
|
42
|
+
registerEditorExtension({
|
|
43
|
+
name: `panel:${panel.id}`,
|
|
44
|
+
extensions: [Extension.create({ name: `cmsPanel_${panel.id.replace(/[^\w]/g, "_")}`, addGlobalAttributes: () => [{ types: panel.blocks!, attributes: attrs }] })],
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
changed();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function unregisterBlockPanel(id: string) {
|
|
51
|
+
if (!panels.delete(id)) return;
|
|
52
|
+
unregisterEditorExtension(`panel:${id}`);
|
|
53
|
+
changed();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Panel áp dụng cho một loại khối. */
|
|
57
|
+
export const blockPanelsFor = (type: string) => snapshot.filter((p) => !p.blocks || p.blocks.includes(type));
|
|
58
|
+
export const blockPanels = () => snapshot;
|
|
59
|
+
export function onBlockPanelsChange(l: () => void) { listeners.add(l); return () => { listeners.delete(l); }; }
|
package/src/paste.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Làm sạch HTML dán từ Word / Google Docs / trang web trước khi trình soạn đọc:
|
|
3
|
+
* - định dạng viết bằng style (Google Docs: span font-weight:700…) → thẻ ngữ nghĩa (strong, em, u, s, sup, sub);
|
|
4
|
+
* - bỏ style/class/id/màu chữ/font, thẻ Office (o:p), chú thích điều kiện, meta/style/script;
|
|
5
|
+
* - đoạn danh sách của Word (mso-list) → ul/ol lồng theo cấp;
|
|
6
|
+
* - bỏ thẻ bọc của Google Docs (b#docs-internal-guid…), đoạn trống chỉ có .
|
|
7
|
+
* Nội dung chép từ chính trình soạn (có data-pm-slice) giữ nguyên.
|
|
8
|
+
*/
|
|
9
|
+
const KEEP_ATTRS: Record<string, string[]> = { a: ["href"], img: ["src", "alt", "width", "height"], td: ["colspan", "rowspan"], th: ["colspan", "rowspan"], ol: ["start"] };
|
|
10
|
+
const DROP = "style, meta, link, script, title, xml, o\\:p, colgroup";
|
|
11
|
+
|
|
12
|
+
/** Định dạng (đậm, nghiêng…) suy ra từ style của một thẻ. */
|
|
13
|
+
function formatsOf(style: string): string[] {
|
|
14
|
+
const s = style.toLowerCase().replace(/\s+/g, "");
|
|
15
|
+
const out: string[] = [];
|
|
16
|
+
if (/font-weight:(bold|[6-9]00)/.test(s)) out.push("strong");
|
|
17
|
+
if (/font-style:italic/.test(s)) out.push("em");
|
|
18
|
+
if (/text-decoration[^;]*underline/.test(s)) out.push("u");
|
|
19
|
+
if (/text-decoration[^;]*line-through/.test(s)) out.push("s");
|
|
20
|
+
if (/vertical-align:super/.test(s)) out.push("sup");
|
|
21
|
+
if (/vertical-align:sub/.test(s)) out.push("sub");
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function unwrap(el: Element) {
|
|
26
|
+
const parent = el.parentNode;
|
|
27
|
+
if (!parent) return;
|
|
28
|
+
while (el.firstChild) parent.insertBefore(el.firstChild, el);
|
|
29
|
+
parent.removeChild(el);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Đoạn danh sách của Word → ul/ol (gom các đoạn liền nhau, lồng theo level). */
|
|
33
|
+
function wordLists(doc: Document) {
|
|
34
|
+
const items = [...doc.querySelectorAll("p")].filter((p) => /mso-list:\s*l\d+\s+level\d+/i.test(p.getAttribute("style") ?? ""));
|
|
35
|
+
let stack: Array<{ list: HTMLElement; level: number }> = [];
|
|
36
|
+
for (const p of items) {
|
|
37
|
+
const level = Number(/level(\d+)/i.exec(p.getAttribute("style") ?? "")?.[1] ?? 1);
|
|
38
|
+
const marker = p.querySelector('[style*="mso-list:Ignore" i], [style*="mso-list: Ignore" i]');
|
|
39
|
+
const mark = (marker?.textContent ?? "").trim();
|
|
40
|
+
const ordered = /^(\d+|[a-z]{1,4})[.)]/i.test(mark);
|
|
41
|
+
marker?.remove();
|
|
42
|
+
// Đoạn danh sách nằm ngay sau danh sách đang dựng → cùng danh sách; không thì bắt đầu danh sách mới
|
|
43
|
+
if (!stack.length || p.previousElementSibling !== stack[0].list) stack = [];
|
|
44
|
+
while (stack.length && stack[stack.length - 1].level > level) stack.pop();
|
|
45
|
+
let top = stack[stack.length - 1];
|
|
46
|
+
if (!top || top.level < level) {
|
|
47
|
+
const list = doc.createElement(ordered ? "ol" : "ul");
|
|
48
|
+
if (top) (top.list.lastElementChild ?? top.list).appendChild(list);
|
|
49
|
+
else p.parentNode!.insertBefore(list, p);
|
|
50
|
+
top = { list, level };
|
|
51
|
+
stack.push(top);
|
|
52
|
+
}
|
|
53
|
+
const li = doc.createElement("li");
|
|
54
|
+
li.innerHTML = p.innerHTML;
|
|
55
|
+
top.list.appendChild(li);
|
|
56
|
+
p.remove();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function cleanPastedHtml(html: string): string {
|
|
61
|
+
if (typeof DOMParser === "undefined" || html.includes("data-pm-slice")) return html;
|
|
62
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
63
|
+
const body = doc.body;
|
|
64
|
+
|
|
65
|
+
// Chú thích (gồm chú thích điều kiện của Word), thẻ không phải nội dung
|
|
66
|
+
const walker = doc.createTreeWalker(body, NodeFilter.SHOW_COMMENT);
|
|
67
|
+
const comments: globalThis.Node[] = [];
|
|
68
|
+
while (walker.nextNode()) comments.push(walker.currentNode);
|
|
69
|
+
comments.forEach((c) => c.parentNode?.removeChild(c));
|
|
70
|
+
body.querySelectorAll(DROP).forEach((el) => el.remove());
|
|
71
|
+
|
|
72
|
+
wordLists(doc);
|
|
73
|
+
|
|
74
|
+
// Thẻ bọc của Google Docs: <b style="font-weight:normal" id="docs-internal-guid-…">
|
|
75
|
+
body.querySelectorAll('b[id^="docs-internal-guid"]').forEach(unwrap);
|
|
76
|
+
// b/strong/i có style "normal" (Google Docs) không phải định dạng thật
|
|
77
|
+
body.querySelectorAll("b, strong").forEach((el) => { if (/font-weight:\s*(normal|[1-4]00)/i.test(el.getAttribute("style") ?? "")) unwrap(el); });
|
|
78
|
+
|
|
79
|
+
// Định dạng viết bằng style → thẻ ngữ nghĩa
|
|
80
|
+
body.querySelectorAll("span, font").forEach((el) => {
|
|
81
|
+
const formats = formatsOf(el.getAttribute("style") ?? "");
|
|
82
|
+
let inner: Element = el;
|
|
83
|
+
for (const f of formats) { const w = doc.createElement(f); while (inner.firstChild) w.appendChild(inner.firstChild); inner.appendChild(w); inner = w; }
|
|
84
|
+
});
|
|
85
|
+
body.querySelectorAll("span, font").forEach(unwrap);
|
|
86
|
+
|
|
87
|
+
// Thuộc tính: chỉ giữ thứ có nghĩa (link, ảnh, gộp ô)
|
|
88
|
+
body.querySelectorAll("*").forEach((el) => {
|
|
89
|
+
const keep = KEEP_ATTRS[el.tagName.toLowerCase()] ?? [];
|
|
90
|
+
for (const name of [...el.getAttributeNames()]) if (!keep.includes(name)) el.removeAttribute(name);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Đoạn trống (Word: <p> </p>), <br> đứng riêng giữa các khối (Google Docs)
|
|
94
|
+
body.querySelectorAll("p, h1, h2, h3, h4, h5, h6").forEach((el) => { if (!el.textContent?.replace(/ /g, "").trim() && !el.querySelector("img")) el.remove(); });
|
|
95
|
+
[...body.children].forEach((el) => { if (el.tagName === "BR") el.remove(); });
|
|
96
|
+
return body.innerHTML;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Chuỗi chỉ là một đường dẫn http(s). */
|
|
100
|
+
export const isUrl = (text: string) => /^https?:\/\/[^\s<>"]+$/i.test(text.trim());
|