@akinon/ui-editor 1.0.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/dist/cjs/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/__tests__/index.test.js +38 -0
- package/dist/cjs/__tests__/index.test.tsx +51 -0
- package/dist/cjs/i18n/index.d.ts +3 -0
- package/dist/cjs/i18n/index.d.ts.map +1 -0
- package/dist/cjs/i18n/index.js +11 -0
- package/dist/cjs/i18n/translations/en.d.ts +86 -0
- package/dist/cjs/i18n/translations/en.d.ts.map +1 -0
- package/dist/cjs/i18n/translations/en.js +85 -0
- package/dist/cjs/i18n/translations/tr.d.ts +86 -0
- package/dist/cjs/i18n/translations/tr.d.ts.map +1 -0
- package/dist/cjs/i18n/translations/tr.js +85 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.d.ts +2 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.js +25 -0
- package/dist/cjs/tiptap/assets/__tests__/icons.test.tsx +29 -0
- package/dist/cjs/tiptap/assets/icons.d.ts +3 -0
- package/dist/cjs/tiptap/assets/icons.d.ts.map +1 -0
- package/dist/cjs/tiptap/assets/icons.js +3 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.d.ts +6 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.js +311 -0
- package/dist/cjs/tiptap/components/__tests__/format-bubble-menu.test.tsx +452 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.js +89 -0
- package/dist/cjs/tiptap/components/__tests__/html-code-viewer.test.tsx +126 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.js +206 -0
- package/dist/cjs/tiptap/components/__tests__/image-upload-placeholder.test.tsx +297 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.js +57 -0
- package/dist/cjs/tiptap/components/__tests__/secure-script-component.test.tsx +89 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.d.ts +6 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.js +284 -0
- package/dist/cjs/tiptap/components/__tests__/table-bubble-menu.test.tsx +466 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.js +101 -0
- package/dist/cjs/tiptap/components/__tests__/table-popover.test.tsx +157 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.js +275 -0
- package/dist/cjs/tiptap/components/__tests__/tiptap.test.tsx +378 -0
- package/dist/cjs/tiptap/components/format-bubble-menu.d.ts +8 -0
- package/dist/cjs/tiptap/components/format-bubble-menu.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/format-bubble-menu.js +202 -0
- package/dist/cjs/tiptap/components/html-code-viewer.d.ts +10 -0
- package/dist/cjs/tiptap/components/html-code-viewer.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/html-code-viewer.js +96 -0
- package/dist/cjs/tiptap/components/image-upload-placeholder.d.ts +4 -0
- package/dist/cjs/tiptap/components/image-upload-placeholder.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/image-upload-placeholder.js +94 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.js +78 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/action-toolbar.test.tsx +212 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts +3 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.js +201 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.tsx +411 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts +4 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.js +242 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/heading-selector.test.tsx +569 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.js +236 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/index.test.tsx +325 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts +3 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.js +332 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/link-popover.test.tsx +648 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.js +196 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.tsx +414 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.js +74 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/media-toolbar.test.tsx +206 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts +2 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.js +265 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.tsx +575 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts +3 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.js +277 -0
- package/dist/cjs/tiptap/components/menu-bar/__tests__/youtube-popover.test.tsx +538 -0
- package/dist/cjs/tiptap/components/menu-bar/action-toolbar.d.ts +15 -0
- package/dist/cjs/tiptap/components/menu-bar/action-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/action-toolbar.js +40 -0
- package/dist/cjs/tiptap/components/menu-bar/alignment-toolbar.d.ts +12 -0
- package/dist/cjs/tiptap/components/menu-bar/alignment-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/alignment-toolbar.js +39 -0
- package/dist/cjs/tiptap/components/menu-bar/heading-selector.d.ts +16 -0
- package/dist/cjs/tiptap/components/menu-bar/heading-selector.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/heading-selector.js +70 -0
- package/dist/cjs/tiptap/components/menu-bar/index.d.ts +18 -0
- package/dist/cjs/tiptap/components/menu-bar/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/index.js +131 -0
- package/dist/cjs/tiptap/components/menu-bar/link-popover.d.ts +12 -0
- package/dist/cjs/tiptap/components/menu-bar/link-popover.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/link-popover.js +108 -0
- package/dist/cjs/tiptap/components/menu-bar/list-and-block-toolbar.d.ts +18 -0
- package/dist/cjs/tiptap/components/menu-bar/list-and-block-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/list-and-block-toolbar.js +69 -0
- package/dist/cjs/tiptap/components/menu-bar/media-toolbar.d.ts +13 -0
- package/dist/cjs/tiptap/components/menu-bar/media-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/media-toolbar.js +15 -0
- package/dist/cjs/tiptap/components/menu-bar/text-formatting-toolbar.d.ts +18 -0
- package/dist/cjs/tiptap/components/menu-bar/text-formatting-toolbar.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/text-formatting-toolbar.js +87 -0
- package/dist/cjs/tiptap/components/menu-bar/youtube-popover.d.ts +12 -0
- package/dist/cjs/tiptap/components/menu-bar/youtube-popover.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/menu-bar/youtube-popover.js +70 -0
- package/dist/cjs/tiptap/components/secure-script-component.d.ts +3 -0
- package/dist/cjs/tiptap/components/secure-script-component.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/secure-script-component.js +61 -0
- package/dist/cjs/tiptap/components/table-bubble-menu.d.ts +9 -0
- package/dist/cjs/tiptap/components/table-bubble-menu.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/table-bubble-menu.js +274 -0
- package/dist/cjs/tiptap/components/table-popover.d.ts +10 -0
- package/dist/cjs/tiptap/components/table-popover.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/table-popover.js +86 -0
- package/dist/cjs/tiptap/components/tiptap.d.ts +4 -0
- package/dist/cjs/tiptap/components/tiptap.d.ts.map +1 -0
- package/dist/cjs/tiptap/components/tiptap.js +311 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.d.ts +2 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.js +56 -0
- package/dist/cjs/tiptap/constants/__tests__/table-defaults.test.ts +69 -0
- package/dist/cjs/tiptap/constants/editor-config.d.ts +89 -0
- package/dist/cjs/tiptap/constants/editor-config.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/editor-config.js +103 -0
- package/dist/cjs/tiptap/constants/html-elements.d.ts +95 -0
- package/dist/cjs/tiptap/constants/html-elements.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/html-elements.js +158 -0
- package/dist/cjs/tiptap/constants/index.d.ts +4 -0
- package/dist/cjs/tiptap/constants/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/index.js +3 -0
- package/dist/cjs/tiptap/constants/table-defaults.d.ts +14 -0
- package/dist/cjs/tiptap/constants/table-defaults.d.ts.map +1 -0
- package/dist/cjs/tiptap/constants/table-defaults.js +18 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.js +75 -0
- package/dist/cjs/tiptap/extensions/__tests__/comment-extension.test.ts +84 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.js +116 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.ts +147 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-cell-extension.test.tsx +90 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.js +183 -0
- package/dist/cjs/tiptap/extensions/__tests__/custom-table-header-extension.test.ts +213 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.js +103 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-block-extension.test.ts +117 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.js +105 -0
- package/dist/cjs/tiptap/extensions/__tests__/html-inline-extension.test.ts +119 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.js +262 -0
- package/dist/cjs/tiptap/extensions/__tests__/iframe-extension.test.ts +297 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.js +52 -0
- package/dist/cjs/tiptap/extensions/__tests__/image-upload-extension.test.tsx +65 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.js +24 -0
- package/dist/cjs/tiptap/extensions/__tests__/index.test.ts +26 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.js +53 -0
- package/dist/cjs/tiptap/extensions/__tests__/reset-marks-extension.test.ts +74 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.d.ts +2 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.js +27 -0
- package/dist/cjs/tiptap/extensions/__tests__/secure-script-extension.test.tsx +32 -0
- package/dist/cjs/tiptap/extensions/comment-extension.d.ts +13 -0
- package/dist/cjs/tiptap/extensions/comment-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/comment-extension.js +47 -0
- package/dist/cjs/tiptap/extensions/custom-table-cell-extension.d.ts +10 -0
- package/dist/cjs/tiptap/extensions/custom-table-cell-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/custom-table-cell-extension.js +64 -0
- package/dist/cjs/tiptap/extensions/custom-table-header-extension.d.ts +10 -0
- package/dist/cjs/tiptap/extensions/custom-table-header-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/custom-table-header-extension.js +63 -0
- package/dist/cjs/tiptap/extensions/html-block-extension.d.ts +6 -0
- package/dist/cjs/tiptap/extensions/html-block-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/html-block-extension.js +90 -0
- package/dist/cjs/tiptap/extensions/html-inline-extension.d.ts +6 -0
- package/dist/cjs/tiptap/extensions/html-inline-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/html-inline-extension.js +87 -0
- package/dist/cjs/tiptap/extensions/iframe-extension.d.ts +18 -0
- package/dist/cjs/tiptap/extensions/iframe-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/iframe-extension.js +170 -0
- package/dist/cjs/tiptap/extensions/image-upload-extension.d.ts +3 -0
- package/dist/cjs/tiptap/extensions/image-upload-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/image-upload-extension.js +29 -0
- package/dist/cjs/tiptap/extensions/index.d.ts +10 -0
- package/dist/cjs/tiptap/extensions/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/index.js +9 -0
- package/dist/cjs/tiptap/extensions/reset-marks-extension.d.ts +3 -0
- package/dist/cjs/tiptap/extensions/reset-marks-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/reset-marks-extension.js +17 -0
- package/dist/cjs/tiptap/extensions/secure-script-extension.d.ts +3 -0
- package/dist/cjs/tiptap/extensions/secure-script-extension.d.ts.map +1 -0
- package/dist/cjs/tiptap/extensions/secure-script-extension.js +55 -0
- package/dist/cjs/tiptap/types/index.d.ts +232 -0
- package/dist/cjs/tiptap/types/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/types/index.js +1 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.js +68 -0
- package/dist/cjs/tiptap/utils/__tests__/format-html.test.ts +91 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.js +71 -0
- package/dist/cjs/tiptap/utils/__tests__/highlight-html.test.ts +100 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.js +13 -0
- package/dist/cjs/tiptap/utils/__tests__/index.test.ts +15 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.js +53 -0
- package/dist/cjs/tiptap/utils/__tests__/normalize-html.test.ts +77 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.d.ts +2 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.js +209 -0
- package/dist/cjs/tiptap/utils/__tests__/tiptap-extensions.test.ts +299 -0
- package/dist/cjs/tiptap/utils/format-html.d.ts +6 -0
- package/dist/cjs/tiptap/utils/format-html.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/format-html.js +108 -0
- package/dist/cjs/tiptap/utils/highlight-html.d.ts +6 -0
- package/dist/cjs/tiptap/utils/highlight-html.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/highlight-html.js +82 -0
- package/dist/cjs/tiptap/utils/index.d.ts +5 -0
- package/dist/cjs/tiptap/utils/index.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/index.js +4 -0
- package/dist/cjs/tiptap/utils/normalize-html.d.ts +7 -0
- package/dist/cjs/tiptap/utils/normalize-html.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/normalize-html.js +109 -0
- package/dist/cjs/tiptap/utils/tiptap-extensions.d.ts +21 -0
- package/dist/cjs/tiptap/utils/tiptap-extensions.d.ts.map +1 -0
- package/dist/cjs/tiptap/utils/tiptap-extensions.js +198 -0
- package/dist/esm/__tests__/index.test.d.ts +2 -0
- package/dist/esm/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/__tests__/index.test.js +38 -0
- package/dist/esm/__tests__/index.test.tsx +51 -0
- package/dist/esm/i18n/index.d.ts +3 -0
- package/dist/esm/i18n/index.d.ts.map +1 -0
- package/dist/esm/i18n/index.js +11 -0
- package/dist/esm/i18n/translations/en.d.ts +86 -0
- package/dist/esm/i18n/translations/en.d.ts.map +1 -0
- package/dist/esm/i18n/translations/en.js +85 -0
- package/dist/esm/i18n/translations/tr.d.ts +86 -0
- package/dist/esm/i18n/translations/tr.d.ts.map +1 -0
- package/dist/esm/i18n/translations/tr.js +85 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.d.ts +2 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.d.ts.map +1 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.js +25 -0
- package/dist/esm/tiptap/assets/__tests__/icons.test.tsx +29 -0
- package/dist/esm/tiptap/assets/icons.d.ts +3 -0
- package/dist/esm/tiptap/assets/icons.d.ts.map +1 -0
- package/dist/esm/tiptap/assets/icons.js +3 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.d.ts +6 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.js +311 -0
- package/dist/esm/tiptap/components/__tests__/format-bubble-menu.test.tsx +452 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.js +89 -0
- package/dist/esm/tiptap/components/__tests__/html-code-viewer.test.tsx +126 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.js +206 -0
- package/dist/esm/tiptap/components/__tests__/image-upload-placeholder.test.tsx +297 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.js +57 -0
- package/dist/esm/tiptap/components/__tests__/secure-script-component.test.tsx +89 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.d.ts +6 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.js +284 -0
- package/dist/esm/tiptap/components/__tests__/table-bubble-menu.test.tsx +466 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.js +101 -0
- package/dist/esm/tiptap/components/__tests__/table-popover.test.tsx +157 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.d.ts +2 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.js +275 -0
- package/dist/esm/tiptap/components/__tests__/tiptap.test.tsx +378 -0
- package/dist/esm/tiptap/components/format-bubble-menu.d.ts +8 -0
- package/dist/esm/tiptap/components/format-bubble-menu.d.ts.map +1 -0
- package/dist/esm/tiptap/components/format-bubble-menu.js +202 -0
- package/dist/esm/tiptap/components/html-code-viewer.d.ts +10 -0
- package/dist/esm/tiptap/components/html-code-viewer.d.ts.map +1 -0
- package/dist/esm/tiptap/components/html-code-viewer.js +96 -0
- package/dist/esm/tiptap/components/image-upload-placeholder.d.ts +4 -0
- package/dist/esm/tiptap/components/image-upload-placeholder.d.ts.map +1 -0
- package/dist/esm/tiptap/components/image-upload-placeholder.js +94 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.js +78 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/action-toolbar.test.tsx +212 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts +3 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.js +201 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/alignment-toolbar.test.tsx +411 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts +4 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.js +242 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/heading-selector.test.tsx +569 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.js +236 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/index.test.tsx +325 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts +3 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.js +332 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/link-popover.test.tsx +648 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.js +196 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/list-and-block-toolbar.test.tsx +414 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.js +74 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/media-toolbar.test.tsx +206 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts +2 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.js +265 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/text-formatting-toolbar.test.tsx +575 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts +3 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.js +277 -0
- package/dist/esm/tiptap/components/menu-bar/__tests__/youtube-popover.test.tsx +538 -0
- package/dist/esm/tiptap/components/menu-bar/action-toolbar.d.ts +15 -0
- package/dist/esm/tiptap/components/menu-bar/action-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/action-toolbar.js +40 -0
- package/dist/esm/tiptap/components/menu-bar/alignment-toolbar.d.ts +12 -0
- package/dist/esm/tiptap/components/menu-bar/alignment-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/alignment-toolbar.js +39 -0
- package/dist/esm/tiptap/components/menu-bar/heading-selector.d.ts +16 -0
- package/dist/esm/tiptap/components/menu-bar/heading-selector.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/heading-selector.js +70 -0
- package/dist/esm/tiptap/components/menu-bar/index.d.ts +18 -0
- package/dist/esm/tiptap/components/menu-bar/index.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/index.js +131 -0
- package/dist/esm/tiptap/components/menu-bar/link-popover.d.ts +12 -0
- package/dist/esm/tiptap/components/menu-bar/link-popover.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/link-popover.js +108 -0
- package/dist/esm/tiptap/components/menu-bar/list-and-block-toolbar.d.ts +18 -0
- package/dist/esm/tiptap/components/menu-bar/list-and-block-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/list-and-block-toolbar.js +69 -0
- package/dist/esm/tiptap/components/menu-bar/media-toolbar.d.ts +13 -0
- package/dist/esm/tiptap/components/menu-bar/media-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/media-toolbar.js +15 -0
- package/dist/esm/tiptap/components/menu-bar/text-formatting-toolbar.d.ts +18 -0
- package/dist/esm/tiptap/components/menu-bar/text-formatting-toolbar.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/text-formatting-toolbar.js +87 -0
- package/dist/esm/tiptap/components/menu-bar/youtube-popover.d.ts +12 -0
- package/dist/esm/tiptap/components/menu-bar/youtube-popover.d.ts.map +1 -0
- package/dist/esm/tiptap/components/menu-bar/youtube-popover.js +70 -0
- package/dist/esm/tiptap/components/secure-script-component.d.ts +3 -0
- package/dist/esm/tiptap/components/secure-script-component.d.ts.map +1 -0
- package/dist/esm/tiptap/components/secure-script-component.js +61 -0
- package/dist/esm/tiptap/components/table-bubble-menu.d.ts +9 -0
- package/dist/esm/tiptap/components/table-bubble-menu.d.ts.map +1 -0
- package/dist/esm/tiptap/components/table-bubble-menu.js +274 -0
- package/dist/esm/tiptap/components/table-popover.d.ts +10 -0
- package/dist/esm/tiptap/components/table-popover.d.ts.map +1 -0
- package/dist/esm/tiptap/components/table-popover.js +86 -0
- package/dist/esm/tiptap/components/tiptap.d.ts +4 -0
- package/dist/esm/tiptap/components/tiptap.d.ts.map +1 -0
- package/dist/esm/tiptap/components/tiptap.js +311 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.d.ts +2 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.js +56 -0
- package/dist/esm/tiptap/constants/__tests__/table-defaults.test.ts +69 -0
- package/dist/esm/tiptap/constants/editor-config.d.ts +89 -0
- package/dist/esm/tiptap/constants/editor-config.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/editor-config.js +103 -0
- package/dist/esm/tiptap/constants/html-elements.d.ts +95 -0
- package/dist/esm/tiptap/constants/html-elements.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/html-elements.js +158 -0
- package/dist/esm/tiptap/constants/index.d.ts +4 -0
- package/dist/esm/tiptap/constants/index.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/index.js +3 -0
- package/dist/esm/tiptap/constants/table-defaults.d.ts +14 -0
- package/dist/esm/tiptap/constants/table-defaults.d.ts.map +1 -0
- package/dist/esm/tiptap/constants/table-defaults.js +18 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.js +75 -0
- package/dist/esm/tiptap/extensions/__tests__/comment-extension.test.ts +84 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.js +116 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.ts +147 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-cell-extension.test.tsx +90 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.js +183 -0
- package/dist/esm/tiptap/extensions/__tests__/custom-table-header-extension.test.ts +213 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.js +103 -0
- package/dist/esm/tiptap/extensions/__tests__/html-block-extension.test.ts +117 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.js +105 -0
- package/dist/esm/tiptap/extensions/__tests__/html-inline-extension.test.ts +119 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.js +262 -0
- package/dist/esm/tiptap/extensions/__tests__/iframe-extension.test.ts +297 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.js +52 -0
- package/dist/esm/tiptap/extensions/__tests__/image-upload-extension.test.tsx +65 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.js +24 -0
- package/dist/esm/tiptap/extensions/__tests__/index.test.ts +26 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.js +53 -0
- package/dist/esm/tiptap/extensions/__tests__/reset-marks-extension.test.ts +74 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.d.ts +2 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.js +27 -0
- package/dist/esm/tiptap/extensions/__tests__/secure-script-extension.test.tsx +32 -0
- package/dist/esm/tiptap/extensions/comment-extension.d.ts +13 -0
- package/dist/esm/tiptap/extensions/comment-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/comment-extension.js +47 -0
- package/dist/esm/tiptap/extensions/custom-table-cell-extension.d.ts +10 -0
- package/dist/esm/tiptap/extensions/custom-table-cell-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/custom-table-cell-extension.js +64 -0
- package/dist/esm/tiptap/extensions/custom-table-header-extension.d.ts +10 -0
- package/dist/esm/tiptap/extensions/custom-table-header-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/custom-table-header-extension.js +63 -0
- package/dist/esm/tiptap/extensions/html-block-extension.d.ts +6 -0
- package/dist/esm/tiptap/extensions/html-block-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/html-block-extension.js +90 -0
- package/dist/esm/tiptap/extensions/html-inline-extension.d.ts +6 -0
- package/dist/esm/tiptap/extensions/html-inline-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/html-inline-extension.js +87 -0
- package/dist/esm/tiptap/extensions/iframe-extension.d.ts +18 -0
- package/dist/esm/tiptap/extensions/iframe-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/iframe-extension.js +170 -0
- package/dist/esm/tiptap/extensions/image-upload-extension.d.ts +3 -0
- package/dist/esm/tiptap/extensions/image-upload-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/image-upload-extension.js +29 -0
- package/dist/esm/tiptap/extensions/index.d.ts +10 -0
- package/dist/esm/tiptap/extensions/index.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/index.js +9 -0
- package/dist/esm/tiptap/extensions/reset-marks-extension.d.ts +3 -0
- package/dist/esm/tiptap/extensions/reset-marks-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/reset-marks-extension.js +17 -0
- package/dist/esm/tiptap/extensions/secure-script-extension.d.ts +3 -0
- package/dist/esm/tiptap/extensions/secure-script-extension.d.ts.map +1 -0
- package/dist/esm/tiptap/extensions/secure-script-extension.js +55 -0
- package/dist/esm/tiptap/types/index.d.ts +232 -0
- package/dist/esm/tiptap/types/index.d.ts.map +1 -0
- package/dist/esm/tiptap/types/index.js +1 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.js +68 -0
- package/dist/esm/tiptap/utils/__tests__/format-html.test.ts +91 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.js +71 -0
- package/dist/esm/tiptap/utils/__tests__/highlight-html.test.ts +100 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.js +13 -0
- package/dist/esm/tiptap/utils/__tests__/index.test.ts +15 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.js +53 -0
- package/dist/esm/tiptap/utils/__tests__/normalize-html.test.ts +77 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.d.ts +2 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.js +209 -0
- package/dist/esm/tiptap/utils/__tests__/tiptap-extensions.test.ts +299 -0
- package/dist/esm/tiptap/utils/format-html.d.ts +6 -0
- package/dist/esm/tiptap/utils/format-html.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/format-html.js +108 -0
- package/dist/esm/tiptap/utils/highlight-html.d.ts +6 -0
- package/dist/esm/tiptap/utils/highlight-html.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/highlight-html.js +82 -0
- package/dist/esm/tiptap/utils/index.d.ts +5 -0
- package/dist/esm/tiptap/utils/index.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/index.js +4 -0
- package/dist/esm/tiptap/utils/normalize-html.d.ts +7 -0
- package/dist/esm/tiptap/utils/normalize-html.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/normalize-html.js +109 -0
- package/dist/esm/tiptap/utils/tiptap-extensions.d.ts +21 -0
- package/dist/esm/tiptap/utils/tiptap-extensions.d.ts.map +1 -0
- package/dist/esm/tiptap/utils/tiptap-extensions.js +198 -0
- package/package.json +99 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import Document from '@tiptap/extension-document';
|
|
3
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
4
|
+
import { Table, TableHeader, TableRow } from '@tiptap/extension-table';
|
|
5
|
+
import Text from '@tiptap/extension-text';
|
|
6
|
+
import { describe, expect, it } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { CustomTableCell } from '../custom-table-cell-extension';
|
|
9
|
+
|
|
10
|
+
describe('CustomTableCell', () => {
|
|
11
|
+
it('should parse style attributes', () => {
|
|
12
|
+
const editor = new Editor({
|
|
13
|
+
extensions: [
|
|
14
|
+
Document,
|
|
15
|
+
Paragraph,
|
|
16
|
+
Text,
|
|
17
|
+
Table,
|
|
18
|
+
TableRow,
|
|
19
|
+
TableHeader,
|
|
20
|
+
CustomTableCell
|
|
21
|
+
],
|
|
22
|
+
content:
|
|
23
|
+
'<table><tbody><tr><td style="background-color: red; border-color: blue; border-width: 2px; border-style: dotted">cell</td></tr></tbody></table>'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const json = editor.getJSON();
|
|
27
|
+
type TableCellNode = {
|
|
28
|
+
type: string;
|
|
29
|
+
attrs?: Record<string, unknown>;
|
|
30
|
+
content?: unknown[];
|
|
31
|
+
};
|
|
32
|
+
type TableRowNode = {
|
|
33
|
+
type: string;
|
|
34
|
+
content?: TableCellNode[];
|
|
35
|
+
};
|
|
36
|
+
type TableNode = {
|
|
37
|
+
type: string;
|
|
38
|
+
content?: TableRowNode[];
|
|
39
|
+
};
|
|
40
|
+
type DocNode = {
|
|
41
|
+
type: string;
|
|
42
|
+
content?: TableNode[];
|
|
43
|
+
};
|
|
44
|
+
const cell = (json as DocNode).content?.[0]?.content?.[0]?.content?.[0] as
|
|
45
|
+
| TableCellNode
|
|
46
|
+
| undefined;
|
|
47
|
+
|
|
48
|
+
expect(cell?.attrs).toMatchObject({
|
|
49
|
+
backgroundColor: 'red',
|
|
50
|
+
borderColor: 'blue',
|
|
51
|
+
borderWidth: '2px',
|
|
52
|
+
borderStyle: 'dotted'
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should render style attributes', () => {
|
|
57
|
+
const editor = new Editor({
|
|
58
|
+
extensions: [
|
|
59
|
+
Document,
|
|
60
|
+
Paragraph,
|
|
61
|
+
Text,
|
|
62
|
+
Table,
|
|
63
|
+
TableRow,
|
|
64
|
+
TableHeader,
|
|
65
|
+
CustomTableCell
|
|
66
|
+
],
|
|
67
|
+
content: {
|
|
68
|
+
type: 'doc',
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
type: 'table',
|
|
72
|
+
content: [
|
|
73
|
+
{
|
|
74
|
+
type: 'tableRow',
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'tableCell',
|
|
78
|
+
attrs: {
|
|
79
|
+
backgroundColor: 'red',
|
|
80
|
+
borderColor: 'blue'
|
|
81
|
+
},
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: 'paragraph',
|
|
85
|
+
content: [{ type: 'text', text: 'cell' }]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const html = editor.getHTML();
|
|
98
|
+
expect(html).toContain('background-color: red');
|
|
99
|
+
expect(html).toContain('border-color: blue');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should preserve existing styles', () => {
|
|
103
|
+
const editor = new Editor({
|
|
104
|
+
extensions: [
|
|
105
|
+
Document,
|
|
106
|
+
Paragraph,
|
|
107
|
+
Text,
|
|
108
|
+
Table,
|
|
109
|
+
TableRow,
|
|
110
|
+
TableHeader,
|
|
111
|
+
CustomTableCell
|
|
112
|
+
],
|
|
113
|
+
content:
|
|
114
|
+
'<table><tbody><tr><td style="color: pink; background-color: red">cell</td></tr></tbody></table>'
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const html = editor.getHTML();
|
|
118
|
+
expect(html).toContain('color: pink');
|
|
119
|
+
expect(html).toContain('background-color: red');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should execute updateCellAttributes command', () => {
|
|
123
|
+
const editor = new Editor({
|
|
124
|
+
extensions: [
|
|
125
|
+
Document,
|
|
126
|
+
Paragraph,
|
|
127
|
+
Text,
|
|
128
|
+
Table,
|
|
129
|
+
TableRow,
|
|
130
|
+
TableHeader,
|
|
131
|
+
CustomTableCell
|
|
132
|
+
],
|
|
133
|
+
content: '<table><tbody><tr><td>cell</td></tr></tbody></table>'
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
editor.commands.setTextSelection(4); // Inside the cell
|
|
137
|
+
editor.commands.updateCellAttributes({ backgroundColor: 'green' });
|
|
138
|
+
|
|
139
|
+
const json = editor.getJSON();
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
+
const cell = (json.content as any)?.[0].content?.[0].content?.[0];
|
|
142
|
+
|
|
143
|
+
expect(cell?.attrs).toMatchObject({
|
|
144
|
+
backgroundColor: 'green'
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import Document from '@tiptap/extension-document';
|
|
3
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
4
|
+
import { Table, TableRow } from '@tiptap/extension-table';
|
|
5
|
+
import Text from '@tiptap/extension-text';
|
|
6
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
7
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import { CustomTableCell } from '../custom-table-cell-extension';
|
|
10
|
+
import { CustomTableHeader } from '../custom-table-header-extension';
|
|
11
|
+
|
|
12
|
+
describe('CustomTableCell', () => {
|
|
13
|
+
it('should render with custom attributes', () => {
|
|
14
|
+
const editor = new Editor({
|
|
15
|
+
extensions: [
|
|
16
|
+
Document,
|
|
17
|
+
Table,
|
|
18
|
+
TableRow,
|
|
19
|
+
Paragraph,
|
|
20
|
+
Text,
|
|
21
|
+
CustomTableCell,
|
|
22
|
+
CustomTableHeader
|
|
23
|
+
],
|
|
24
|
+
content: `
|
|
25
|
+
<table>
|
|
26
|
+
<tbody>
|
|
27
|
+
<tr>
|
|
28
|
+
<td style="background-color: #ff0000; border-color: #00ff00;">cell</td>
|
|
29
|
+
</tr>
|
|
30
|
+
</tbody>
|
|
31
|
+
</table>
|
|
32
|
+
`
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const cell = editor.view.dom.querySelector('td');
|
|
36
|
+
expect(cell).not.toBeNull();
|
|
37
|
+
if (cell) {
|
|
38
|
+
const bg = cell.style.backgroundColor.replace(/\s/g, '').toLowerCase();
|
|
39
|
+
const border = cell.style.borderColor.replace(/\s/g, '').toLowerCase();
|
|
40
|
+
|
|
41
|
+
expect(['rgb(255,0,0)', '#ff0000', 'red']).toContain(bg);
|
|
42
|
+
expect(['rgb(0,255,0)', '#00ff00', 'lime']).toContain(border);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should not throw error for missing node type', () => {
|
|
47
|
+
const editor2 = new Editor({
|
|
48
|
+
extensions: [
|
|
49
|
+
Document,
|
|
50
|
+
Table,
|
|
51
|
+
TableRow,
|
|
52
|
+
Paragraph,
|
|
53
|
+
Text,
|
|
54
|
+
CustomTableCell,
|
|
55
|
+
CustomTableHeader
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(() => {
|
|
60
|
+
editor2.commands.insertTable({ rows: 3, cols: 3 });
|
|
61
|
+
}).not.toThrow();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should include parent commands', () => {
|
|
65
|
+
const config = CustomTableCell.config;
|
|
66
|
+
const addCommandsFn = config.addCommands;
|
|
67
|
+
|
|
68
|
+
if (!addCommandsFn) {
|
|
69
|
+
throw new Error('addCommands not defined');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const mockParentCommand = vi.fn();
|
|
73
|
+
const mockContext = {
|
|
74
|
+
name: 'tableCell',
|
|
75
|
+
options: {},
|
|
76
|
+
storage: {},
|
|
77
|
+
editor: {} as Editor,
|
|
78
|
+
type: { name: 'tableCell' } as NodeType,
|
|
79
|
+
parent: () =>
|
|
80
|
+
({ someParentCommand: mockParentCommand }) as Partial<
|
|
81
|
+
Record<string, unknown>
|
|
82
|
+
>
|
|
83
|
+
};
|
|
84
|
+
const commands = addCommandsFn.call(mockContext);
|
|
85
|
+
|
|
86
|
+
expect(commands).toBeDefined();
|
|
87
|
+
expect(commands?.updateCellAttributes).toBeDefined();
|
|
88
|
+
expect(Object.keys(commands || {}).length).toBeGreaterThan(1);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-table-header-extension.test.d.ts","sourceRoot":"","sources":["../../../../../src/tiptap/extensions/__tests__/custom-table-header-extension.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import Document from '@tiptap/extension-document';
|
|
3
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
4
|
+
import { Table, TableCell, TableRow } from '@tiptap/extension-table';
|
|
5
|
+
import Text from '@tiptap/extension-text';
|
|
6
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
7
|
+
import { CustomTableHeader } from '../custom-table-header-extension';
|
|
8
|
+
describe('CustomTableHeader', () => {
|
|
9
|
+
it('should parse style attributes', () => {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
const editor = new Editor({
|
|
12
|
+
extensions: [
|
|
13
|
+
Document,
|
|
14
|
+
Paragraph,
|
|
15
|
+
Text,
|
|
16
|
+
Table,
|
|
17
|
+
TableRow,
|
|
18
|
+
TableCell,
|
|
19
|
+
CustomTableHeader
|
|
20
|
+
],
|
|
21
|
+
content: '<table><tbody><tr><th style="background-color: red; border-color: blue; border-width: 2px; border-style: dotted">header</th></tr></tbody></table>'
|
|
22
|
+
});
|
|
23
|
+
const json = editor.getJSON();
|
|
24
|
+
// doc -> table -> tableRow -> tableHeader
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
const header = (_c = (_b = (_a = json.content) === null || _a === void 0 ? void 0 : _a[0].content) === null || _b === void 0 ? void 0 : _b[0].content) === null || _c === void 0 ? void 0 : _c[0];
|
|
27
|
+
expect(header === null || header === void 0 ? void 0 : header.attrs).toMatchObject({
|
|
28
|
+
backgroundColor: 'red',
|
|
29
|
+
borderColor: 'blue',
|
|
30
|
+
borderWidth: '2px',
|
|
31
|
+
borderStyle: 'dotted'
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
it('should render style attributes', () => {
|
|
35
|
+
const editor = new Editor({
|
|
36
|
+
extensions: [
|
|
37
|
+
Document,
|
|
38
|
+
Paragraph,
|
|
39
|
+
Text,
|
|
40
|
+
Table,
|
|
41
|
+
TableRow,
|
|
42
|
+
TableCell,
|
|
43
|
+
CustomTableHeader
|
|
44
|
+
],
|
|
45
|
+
content: {
|
|
46
|
+
type: 'doc',
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: 'table',
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: 'tableRow',
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'tableHeader',
|
|
56
|
+
attrs: {
|
|
57
|
+
backgroundColor: 'red',
|
|
58
|
+
borderColor: 'blue'
|
|
59
|
+
},
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'paragraph',
|
|
63
|
+
content: [{ type: 'text', text: 'header' }]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const html = editor.getHTML();
|
|
75
|
+
expect(html).toContain('background-color: red');
|
|
76
|
+
expect(html).toContain('border-color: blue');
|
|
77
|
+
});
|
|
78
|
+
it('should preserve existing styles', () => {
|
|
79
|
+
const editor = new Editor({
|
|
80
|
+
extensions: [
|
|
81
|
+
Document,
|
|
82
|
+
Paragraph,
|
|
83
|
+
Text,
|
|
84
|
+
Table,
|
|
85
|
+
TableRow,
|
|
86
|
+
TableCell,
|
|
87
|
+
CustomTableHeader
|
|
88
|
+
],
|
|
89
|
+
content: '<table><tbody><tr><th style="color: pink; background-color: red">header</th></tr></tbody></table>'
|
|
90
|
+
});
|
|
91
|
+
const html = editor.getHTML();
|
|
92
|
+
expect(html).toContain('color: pink');
|
|
93
|
+
expect(html).toContain('background-color: red');
|
|
94
|
+
});
|
|
95
|
+
it('should execute updateHeaderAttributes command', () => {
|
|
96
|
+
var _a, _b, _c;
|
|
97
|
+
const editor = new Editor({
|
|
98
|
+
extensions: [
|
|
99
|
+
Document,
|
|
100
|
+
Paragraph,
|
|
101
|
+
Text,
|
|
102
|
+
Table,
|
|
103
|
+
TableRow,
|
|
104
|
+
TableCell,
|
|
105
|
+
CustomTableHeader
|
|
106
|
+
],
|
|
107
|
+
content: '<table><tbody><tr><th>header</th></tr></tbody></table>'
|
|
108
|
+
});
|
|
109
|
+
editor.commands.setTextSelection(4); // Inside the header
|
|
110
|
+
editor.commands.updateHeaderAttributes({ backgroundColor: 'green' });
|
|
111
|
+
const json = editor.getJSON();
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
const header = (_c = (_b = (_a = json.content) === null || _a === void 0 ? void 0 : _a[0].content) === null || _b === void 0 ? void 0 : _b[0].content) === null || _c === void 0 ? void 0 : _c[0];
|
|
114
|
+
expect(header === null || header === void 0 ? void 0 : header.attrs).toMatchObject({
|
|
115
|
+
backgroundColor: 'green'
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
it('should return command function from addCommands', () => {
|
|
119
|
+
const mockCommands = {
|
|
120
|
+
updateAttributes: vi.fn(() => true)
|
|
121
|
+
};
|
|
122
|
+
const attrs = { borderColor: 'red' };
|
|
123
|
+
const config = CustomTableHeader.config;
|
|
124
|
+
const addCommandsFn = config.addCommands;
|
|
125
|
+
if (!addCommandsFn) {
|
|
126
|
+
throw new Error('addCommands not defined');
|
|
127
|
+
}
|
|
128
|
+
const mockContext = {
|
|
129
|
+
name: 'tableHeader',
|
|
130
|
+
options: {},
|
|
131
|
+
storage: {},
|
|
132
|
+
editor: {},
|
|
133
|
+
type: { name: 'tableHeader' },
|
|
134
|
+
parent: () => ({ someParentCommand: vi.fn() })
|
|
135
|
+
};
|
|
136
|
+
const commands = addCommandsFn.call(mockContext);
|
|
137
|
+
expect(commands).toBeDefined();
|
|
138
|
+
expect(commands === null || commands === void 0 ? void 0 : commands.updateHeaderAttributes).toBeDefined();
|
|
139
|
+
let result;
|
|
140
|
+
if (commands === null || commands === void 0 ? void 0 : commands.updateHeaderAttributes) {
|
|
141
|
+
const mockEditor = {};
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
const mockCommandProps = {
|
|
144
|
+
commands: mockCommands,
|
|
145
|
+
editor: mockEditor,
|
|
146
|
+
tr: {},
|
|
147
|
+
state: {},
|
|
148
|
+
dispatch: vi.fn(),
|
|
149
|
+
view: {},
|
|
150
|
+
can: vi.fn(),
|
|
151
|
+
chain: vi.fn(),
|
|
152
|
+
get: vi.fn()
|
|
153
|
+
};
|
|
154
|
+
result = commands.updateHeaderAttributes(attrs)(mockCommandProps);
|
|
155
|
+
expect(mockCommands.updateAttributes).toHaveBeenCalledWith('tableHeader', attrs);
|
|
156
|
+
expect(result).toBe(true);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
throw new Error('updateHeaderAttributes is not defined');
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
it('should include parent commands', () => {
|
|
163
|
+
const config = CustomTableHeader.config;
|
|
164
|
+
const addCommandsFn = config.addCommands;
|
|
165
|
+
if (!addCommandsFn) {
|
|
166
|
+
throw new Error('addCommands not defined');
|
|
167
|
+
}
|
|
168
|
+
const mockContext = {
|
|
169
|
+
name: 'tableHeader',
|
|
170
|
+
options: {},
|
|
171
|
+
storage: {},
|
|
172
|
+
editor: {},
|
|
173
|
+
type: { name: 'tableHeader' },
|
|
174
|
+
parent: () => ({
|
|
175
|
+
someParentCommand: () => () => true
|
|
176
|
+
})
|
|
177
|
+
};
|
|
178
|
+
const commands = addCommandsFn.call(mockContext);
|
|
179
|
+
expect(commands).toBeDefined();
|
|
180
|
+
expect(commands === null || commands === void 0 ? void 0 : commands.updateHeaderAttributes).toBeDefined();
|
|
181
|
+
expect(commands === null || commands === void 0 ? void 0 : commands.someParentCommand).toBeDefined();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Editor, RawCommands, SingleCommands } from '@tiptap/core';
|
|
2
|
+
import Document from '@tiptap/extension-document';
|
|
3
|
+
import Paragraph from '@tiptap/extension-paragraph';
|
|
4
|
+
import { Table, TableCell, TableRow } from '@tiptap/extension-table';
|
|
5
|
+
import Text from '@tiptap/extension-text';
|
|
6
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
7
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
8
|
+
|
|
9
|
+
import { CustomTableHeader } from '../custom-table-header-extension';
|
|
10
|
+
|
|
11
|
+
describe('CustomTableHeader', () => {
|
|
12
|
+
it('should parse style attributes', () => {
|
|
13
|
+
const editor = new Editor({
|
|
14
|
+
extensions: [
|
|
15
|
+
Document,
|
|
16
|
+
Paragraph,
|
|
17
|
+
Text,
|
|
18
|
+
Table,
|
|
19
|
+
TableRow,
|
|
20
|
+
TableCell,
|
|
21
|
+
CustomTableHeader
|
|
22
|
+
],
|
|
23
|
+
content:
|
|
24
|
+
'<table><tbody><tr><th style="background-color: red; border-color: blue; border-width: 2px; border-style: dotted">header</th></tr></tbody></table>'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const json = editor.getJSON();
|
|
28
|
+
// doc -> table -> tableRow -> tableHeader
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
const header = (json.content as any)?.[0].content?.[0].content?.[0];
|
|
31
|
+
|
|
32
|
+
expect(header?.attrs).toMatchObject({
|
|
33
|
+
backgroundColor: 'red',
|
|
34
|
+
borderColor: 'blue',
|
|
35
|
+
borderWidth: '2px',
|
|
36
|
+
borderStyle: 'dotted'
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should render style attributes', () => {
|
|
41
|
+
const editor = new Editor({
|
|
42
|
+
extensions: [
|
|
43
|
+
Document,
|
|
44
|
+
Paragraph,
|
|
45
|
+
Text,
|
|
46
|
+
Table,
|
|
47
|
+
TableRow,
|
|
48
|
+
TableCell,
|
|
49
|
+
CustomTableHeader
|
|
50
|
+
],
|
|
51
|
+
content: {
|
|
52
|
+
type: 'doc',
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'table',
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: 'tableRow',
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'tableHeader',
|
|
62
|
+
attrs: {
|
|
63
|
+
backgroundColor: 'red',
|
|
64
|
+
borderColor: 'blue'
|
|
65
|
+
},
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'paragraph',
|
|
69
|
+
content: [{ type: 'text', text: 'header' }]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const html = editor.getHTML();
|
|
82
|
+
expect(html).toContain('background-color: red');
|
|
83
|
+
expect(html).toContain('border-color: blue');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should preserve existing styles', () => {
|
|
87
|
+
const editor = new Editor({
|
|
88
|
+
extensions: [
|
|
89
|
+
Document,
|
|
90
|
+
Paragraph,
|
|
91
|
+
Text,
|
|
92
|
+
Table,
|
|
93
|
+
TableRow,
|
|
94
|
+
TableCell,
|
|
95
|
+
CustomTableHeader
|
|
96
|
+
],
|
|
97
|
+
content:
|
|
98
|
+
'<table><tbody><tr><th style="color: pink; background-color: red">header</th></tr></tbody></table>'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const html = editor.getHTML();
|
|
102
|
+
expect(html).toContain('color: pink');
|
|
103
|
+
expect(html).toContain('background-color: red');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should execute updateHeaderAttributes command', () => {
|
|
107
|
+
const editor = new Editor({
|
|
108
|
+
extensions: [
|
|
109
|
+
Document,
|
|
110
|
+
Paragraph,
|
|
111
|
+
Text,
|
|
112
|
+
Table,
|
|
113
|
+
TableRow,
|
|
114
|
+
TableCell,
|
|
115
|
+
CustomTableHeader
|
|
116
|
+
],
|
|
117
|
+
content: '<table><tbody><tr><th>header</th></tr></tbody></table>'
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
editor.commands.setTextSelection(4); // Inside the header
|
|
121
|
+
editor.commands.updateHeaderAttributes({ backgroundColor: 'green' });
|
|
122
|
+
|
|
123
|
+
const json = editor.getJSON();
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
+
const header = (json.content as any)?.[0].content?.[0].content?.[0];
|
|
126
|
+
|
|
127
|
+
expect(header?.attrs).toMatchObject({
|
|
128
|
+
backgroundColor: 'green'
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should return command function from addCommands', () => {
|
|
133
|
+
const mockCommands: Partial<SingleCommands> = {
|
|
134
|
+
updateAttributes: vi.fn(() => true)
|
|
135
|
+
};
|
|
136
|
+
const attrs = { borderColor: 'red' };
|
|
137
|
+
|
|
138
|
+
const config = CustomTableHeader.config;
|
|
139
|
+
const addCommandsFn = config.addCommands;
|
|
140
|
+
|
|
141
|
+
if (!addCommandsFn) {
|
|
142
|
+
throw new Error('addCommands not defined');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const mockContext = {
|
|
146
|
+
name: 'tableHeader',
|
|
147
|
+
options: {},
|
|
148
|
+
storage: {},
|
|
149
|
+
editor: {} as Editor,
|
|
150
|
+
type: { name: 'tableHeader' } as NodeType,
|
|
151
|
+
parent: () =>
|
|
152
|
+
({ someParentCommand: vi.fn() }) as Partial<Record<string, unknown>>
|
|
153
|
+
};
|
|
154
|
+
const commands = addCommandsFn.call(mockContext);
|
|
155
|
+
|
|
156
|
+
expect(commands).toBeDefined();
|
|
157
|
+
expect(commands?.updateHeaderAttributes).toBeDefined();
|
|
158
|
+
|
|
159
|
+
let result: boolean | undefined;
|
|
160
|
+
if (commands?.updateHeaderAttributes) {
|
|
161
|
+
const mockEditor = {} as Editor;
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
|
+
const mockCommandProps: any = {
|
|
164
|
+
commands: mockCommands as SingleCommands,
|
|
165
|
+
editor: mockEditor,
|
|
166
|
+
tr: {},
|
|
167
|
+
state: {},
|
|
168
|
+
dispatch: vi.fn(),
|
|
169
|
+
view: {},
|
|
170
|
+
can: vi.fn(),
|
|
171
|
+
chain: vi.fn(),
|
|
172
|
+
get: vi.fn()
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
result = commands.updateHeaderAttributes(attrs)(mockCommandProps);
|
|
176
|
+
expect(mockCommands.updateAttributes).toHaveBeenCalledWith(
|
|
177
|
+
'tableHeader',
|
|
178
|
+
attrs
|
|
179
|
+
);
|
|
180
|
+
expect(result).toBe(true);
|
|
181
|
+
} else {
|
|
182
|
+
throw new Error('updateHeaderAttributes is not defined');
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('should include parent commands', () => {
|
|
187
|
+
const config = CustomTableHeader.config;
|
|
188
|
+
const addCommandsFn = config.addCommands;
|
|
189
|
+
|
|
190
|
+
if (!addCommandsFn) {
|
|
191
|
+
throw new Error('addCommands not defined');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const mockContext = {
|
|
195
|
+
name: 'tableHeader',
|
|
196
|
+
options: {},
|
|
197
|
+
storage: {},
|
|
198
|
+
editor: {} as Editor,
|
|
199
|
+
type: { name: 'tableHeader' } as NodeType,
|
|
200
|
+
parent: () =>
|
|
201
|
+
({
|
|
202
|
+
someParentCommand: () => () => true
|
|
203
|
+
}) as Partial<RawCommands>
|
|
204
|
+
};
|
|
205
|
+
const commands = addCommandsFn.call(mockContext);
|
|
206
|
+
|
|
207
|
+
expect(commands).toBeDefined();
|
|
208
|
+
expect(commands?.updateHeaderAttributes).toBeDefined();
|
|
209
|
+
expect(
|
|
210
|
+
(commands as Record<string, unknown>)?.someParentCommand
|
|
211
|
+
).toBeDefined();
|
|
212
|
+
});
|
|
213
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-block-extension.test.d.ts","sourceRoot":"","sources":["../../../../../src/tiptap/extensions/__tests__/html-block-extension.test.ts"],"names":[],"mappings":""}
|