cvnert-editor 0.1.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/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/components/tiptap-extension/indent-extension.d.ts +90 -0
- package/dist/components/tiptap-extension/list-normalization-extension.d.ts +30 -0
- package/dist/components/tiptap-extension/node-alignment-extension.d.ts +38 -0
- package/dist/components/tiptap-extension/node-background-extension.d.ts +23 -0
- package/dist/components/tiptap-extension/triple-click-block-selection-extension.d.ts +13 -0
- package/dist/components/tiptap-extension/ui-state-extension.d.ts +22 -0
- package/dist/components/tiptap-icons/add-col-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/add-col-right-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/add-row-bottom-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/add-row-top-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-bottom-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-center-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-center-vertical-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-end-vertical-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-justify-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-middle-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-right-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-start-vertical-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-top-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/alignment-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-down-a-z-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-down-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-down-to-line-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-down-z-a-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-right-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/arrow-up-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/at-sign-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/ban-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/blockquote-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/bold-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/check-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/chevron-right-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/clipboard-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/close-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/code-block-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/code2-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/copy-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/external-link-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/grip-4-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/grip-vertical-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-five-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-four-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-one-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-six-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-three-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/heading-two-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/highlighter-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/image-caption-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/image-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/image-plus-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/indent-decrease-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/indent-increase-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/italic-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/link-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-indented-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-ordered-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/list-todo-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/minus-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/moon-star-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/more-vertical-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/move-horizontal-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/paint-bucket-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/plus-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/plus-small-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/redo2-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/refresh-ccw-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/repeat-2-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/rotate-ccw-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/smile-plus-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/square-x-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/strike-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/subscript-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/sun-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/superscript-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/table-cell-merge-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/table-cell-split-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/table-header-column-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/table-header-row-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/table-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/text-color-small-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/trash-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/type-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/underline-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/undo2-icon.d.ts +3 -0
- package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
- package/dist/components/tiptap-node/image-node/image-node-extension.d.ts +3 -0
- package/dist/components/tiptap-node/image-node/image-node-floating.d.ts +4 -0
- package/dist/components/tiptap-node/image-node/image-node-view.d.ts +24 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +57 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node.d.ts +69 -0
- package/dist/components/tiptap-node/table-node/extensions/table-handle/helpers/create-image.d.ts +9 -0
- package/dist/components/tiptap-node/table-node/extensions/table-handle/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/extensions/table-handle/table-handle-plugin.d.ts +43 -0
- package/dist/components/tiptap-node/table-node/extensions/table-handle/table-handle.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/extensions/table-node-extension.d.ts +31 -0
- package/dist/components/tiptap-node/table-node/hooks/use-table-handle-state.d.ts +22 -0
- package/dist/components/tiptap-node/table-node/lib/tiptap-table-utils.d.ts +395 -0
- package/dist/components/tiptap-node/table-node/ui/table-add-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-add-row-column-button/table-add-row-column-button.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/ui/table-add-row-column-button/use-table-add-row-column.d.ts +53 -0
- package/dist/components/tiptap-node/table-node/ui/table-align-cell-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-align-cell-button/table-align-cell-button.d.ts +41 -0
- package/dist/components/tiptap-node/table-node/ui/table-align-cell-button/use-table-align-cell.d.ts +145 -0
- package/dist/components/tiptap-node/table-node/ui/table-alignment-menu/index.d.ts +1 -0
- package/dist/components/tiptap-node/table-node/ui/table-alignment-menu/table-alignment-menu.d.ts +16 -0
- package/dist/components/tiptap-node/table-node/ui/table-cell-handle-menu/index.d.ts +1 -0
- package/dist/components/tiptap-node/table-node/ui/table-cell-handle-menu/table-cell-handle-menu.d.ts +11 -0
- package/dist/components/tiptap-node/table-node/ui/table-clear-row-column-content-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-clear-row-column-content-button/table-clear-row-column-content-button.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/ui/table-clear-row-column-content-button/use-table-clear-row-column-content.d.ts +96 -0
- package/dist/components/tiptap-node/table-node/ui/table-delete-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-delete-row-column-button/table-delete-row-column-button.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/ui/table-delete-row-column-button/use-table-delete-row-column.d.ts +80 -0
- package/dist/components/tiptap-node/table-node/ui/table-duplicate-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-duplicate-row-column-button/table-duplicate-row-column-button.d.ts +6 -0
- package/dist/components/tiptap-node/table-node/ui/table-duplicate-row-column-button/use-table-duplicate-row-column.d.ts +42 -0
- package/dist/components/tiptap-node/table-node/ui/table-extend-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-extend-row-column-button/table-extend-row-column-button.d.ts +23 -0
- package/dist/components/tiptap-node/table-node/ui/table-extend-row-column-button/use-table-extend-row-column.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/ui/table-fit-to-width-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-fit-to-width-button/table-fit-to-width-button.d.ts +21 -0
- package/dist/components/tiptap-node/table-node/ui/table-fit-to-width-button/use-table-fit-to-width.d.ts +67 -0
- package/dist/components/tiptap-node/table-node/ui/table-handle/table-handle.d.ts +50 -0
- package/dist/components/tiptap-node/table-node/ui/table-handle/use-table-handle-positioning.d.ts +41 -0
- package/dist/components/tiptap-node/table-node/ui/table-handle-menu/index.d.ts +1 -0
- package/dist/components/tiptap-node/table-node/ui/table-handle-menu/table-handle-menu.d.ts +25 -0
- package/dist/components/tiptap-node/table-node/ui/table-header-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-header-row-column-button/table-header-row-column-button.d.ts +15 -0
- package/dist/components/tiptap-node/table-node/ui/table-header-row-column-button/use-table-header-row-column.d.ts +51 -0
- package/dist/components/tiptap-node/table-node/ui/table-merge-split-cell-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-merge-split-cell-button/table-merge-split-cell-button.d.ts +43 -0
- package/dist/components/tiptap-node/table-node/ui/table-merge-split-cell-button/use-table-merge-split-cell.d.ts +119 -0
- package/dist/components/tiptap-node/table-node/ui/table-move-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-move-row-column-button/table-move-row-column-button.d.ts +37 -0
- package/dist/components/tiptap-node/table-node/ui/table-move-row-column-button/use-table-move-row-column.d.ts +94 -0
- package/dist/components/tiptap-node/table-node/ui/table-selection-overlay/index.d.ts +1 -0
- package/dist/components/tiptap-node/table-node/ui/table-selection-overlay/table-selection-overlay.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/ui/table-selection-overlay/use-resize-overlay.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-sort-row-column-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/table-node/ui/table-sort-row-column-button/table-sort-row-column-button.d.ts +14 -0
- package/dist/components/tiptap-node/table-node/ui/table-sort-row-column-button/use-table-sort-row-column.d.ts +111 -0
- package/dist/components/tiptap-node/toc-node/context/toc-context.d.ts +44 -0
- package/dist/components/tiptap-node/toc-node/extensions/toc-node-extension.d.ts +45 -0
- package/dist/components/tiptap-node/toc-node/index.d.ts +3 -0
- package/dist/components/tiptap-node/toc-node/toc-node.d.ts +4 -0
- package/dist/components/tiptap-node/toc-node/ui/toc-show-title-button/index.d.ts +2 -0
- package/dist/components/tiptap-node/toc-node/ui/toc-show-title-button/toc-show-title-button.d.ts +16 -0
- package/dist/components/tiptap-node/toc-node/ui/toc-show-title-button/toc-show-title.d.ts +83 -0
- package/dist/components/tiptap-node/toc-node/ui/toc-sidebar/index.d.ts +1 -0
- package/dist/components/tiptap-node/toc-node/ui/toc-sidebar/toc-sidebar.d.ts +14 -0
- package/dist/components/tiptap-templates/omnibox/omnibox-editor-header.d.ts +1 -0
- package/dist/components/tiptap-templates/omnibox/omnibox-editor-mobile-toolbar.d.ts +14 -0
- package/dist/components/tiptap-templates/omnibox/omnibox-editor-theme-toggle.d.ts +1 -0
- package/dist/components/tiptap-templates/omnibox/omnibox-editor-toolbar-floating.d.ts +15 -0
- package/dist/components/tiptap-templates/omnibox/omnibox-editor.d.ts +28 -0
- package/dist/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
- package/dist/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
- package/dist/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
- package/dist/components/tiptap-ui/code-block-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
- package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +46 -0
- package/dist/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +93 -0
- package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +35 -0
- package/dist/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
- package/dist/components/tiptap-ui/color-menu/color-menu.d.ts +39 -0
- package/dist/components/tiptap-ui/color-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui/color-text-button/color-text-button.d.ts +23 -0
- package/dist/components/tiptap-ui/color-text-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/color-text-button/use-color-text.d.ts +109 -0
- package/dist/components/tiptap-ui/color-text-popover/color-text-popover.d.ts +46 -0
- package/dist/components/tiptap-ui/color-text-popover/index.d.ts +2 -0
- package/dist/components/tiptap-ui/color-text-popover/use-color-text-popover.d.ts +132 -0
- package/dist/components/tiptap-ui/copy-anchor-link-button/copy-anchor-link-button.d.ts +22 -0
- package/dist/components/tiptap-ui/copy-anchor-link-button/index.d.ts +3 -0
- package/dist/components/tiptap-ui/copy-anchor-link-button/use-copy-anchor-link.d.ts +93 -0
- package/dist/components/tiptap-ui/copy-anchor-link-button/use-scroll-to-hash.d.ts +27 -0
- package/dist/components/tiptap-ui/copy-to-clipboard-button/copy-to-clipboard-button.d.ts +22 -0
- package/dist/components/tiptap-ui/copy-to-clipboard-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/copy-to-clipboard-button/use-copy-to-clipboard.d.ts +103 -0
- package/dist/components/tiptap-ui/delete-node-button/delete-node-button.d.ts +22 -0
- package/dist/components/tiptap-ui/delete-node-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/delete-node-button/use-delete-node.d.ts +82 -0
- package/dist/components/tiptap-ui/drag-context-menu/drag-context-menu-types.d.ts +30 -0
- package/dist/components/tiptap-ui/drag-context-menu/drag-context-menu.d.ts +3 -0
- package/dist/components/tiptap-ui/drag-context-menu/index.d.ts +2 -0
- package/dist/components/tiptap-ui/duplicate-button/duplicate-button.d.ts +22 -0
- package/dist/components/tiptap-ui/duplicate-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/duplicate-button/use-duplicate.d.ts +78 -0
- package/dist/components/tiptap-ui/emoji-dropdown-menu/emoji-dropdown-menu.d.ts +3 -0
- package/dist/components/tiptap-ui/emoji-dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui/emoji-menu/emoji-menu-utils.d.ts +6 -0
- package/dist/components/tiptap-ui/emoji-menu/emoji-menu.d.ts +18 -0
- package/dist/components/tiptap-ui/emoji-menu/index.d.ts +2 -0
- package/dist/components/tiptap-ui/emoji-trigger-button/emoji-trigger-button.d.ts +22 -0
- package/dist/components/tiptap-ui/emoji-trigger-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/emoji-trigger-button/use-emoji-trigger.d.ts +94 -0
- package/dist/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
- package/dist/components/tiptap-ui/heading-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
- package/dist/components/tiptap-ui/image-align-button/image-align-button.d.ts +23 -0
- package/dist/components/tiptap-ui/image-align-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/image-align-button/use-image-align.d.ts +110 -0
- package/dist/components/tiptap-ui/image-caption-button/image-caption-button.d.ts +16 -0
- package/dist/components/tiptap-ui/image-caption-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/image-caption-button/use-image-caption.d.ts +82 -0
- package/dist/components/tiptap-ui/image-download-button/image-download-button.d.ts +23 -0
- package/dist/components/tiptap-ui/image-download-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/image-download-button/use-image-download.d.ts +64 -0
- package/dist/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
- package/dist/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
- package/dist/components/tiptap-ui/indent-button/indent-button.d.ts +30 -0
- package/dist/components/tiptap-ui/indent-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/indent-button/use-indent.d.ts +91 -0
- package/dist/components/tiptap-ui/link-popover/index.d.ts +2 -0
- package/dist/components/tiptap-ui/link-popover/link-popover.d.ts +58 -0
- package/dist/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
- package/dist/components/tiptap-ui/list-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/list-button/list-button.d.ts +23 -0
- package/dist/components/tiptap-ui/list-button/use-list.d.ts +97 -0
- package/dist/components/tiptap-ui/mark-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
- package/dist/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
- package/dist/components/tiptap-ui/mention-dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui/mention-dropdown-menu/mention-dropdown-menu.d.ts +4 -0
- package/dist/components/tiptap-ui/mention-trigger-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/mention-trigger-button/mention-trigger-button.d.ts +22 -0
- package/dist/components/tiptap-ui/mention-trigger-button/use-mention-trigger.d.ts +96 -0
- package/dist/components/tiptap-ui/move-node-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/move-node-button/move-node-button.d.ts +20 -0
- package/dist/components/tiptap-ui/move-node-button/use-move-node.d.ts +52 -0
- package/dist/components/tiptap-ui/reset-all-formatting-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/reset-all-formatting-button/reset-all-formatting-button.d.ts +24 -0
- package/dist/components/tiptap-ui/reset-all-formatting-button/use-reset-all-formatting.d.ts +106 -0
- package/dist/components/tiptap-ui/slash-command-trigger-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/slash-command-trigger-button/slash-command-trigger-button.d.ts +22 -0
- package/dist/components/tiptap-ui/slash-command-trigger-button/use-slash-command-trigger.d.ts +96 -0
- package/dist/components/tiptap-ui/slash-dropdown-menu/index.d.ts +2 -0
- package/dist/components/tiptap-ui/slash-dropdown-menu/slash-dropdown-menu.d.ts +8 -0
- package/dist/components/tiptap-ui/slash-dropdown-menu/use-slash-dropdown-menu.d.ts +126 -0
- package/dist/components/tiptap-ui/text-align-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
- package/dist/components/tiptap-ui/text-align-button/use-text-align.d.ts +102 -0
- package/dist/components/tiptap-ui/text-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/text-button/text-button.d.ts +22 -0
- package/dist/components/tiptap-ui/text-button/use-text.d.ts +86 -0
- package/dist/components/tiptap-ui/turn-into-dropdown/index.d.ts +2 -0
- package/dist/components/tiptap-ui/turn-into-dropdown/turn-into-dropdown.d.ts +16 -0
- package/dist/components/tiptap-ui/turn-into-dropdown/use-turn-into-dropdown.d.ts +149 -0
- package/dist/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
- package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
- package/dist/components/tiptap-ui-primitive/avatar/avatar.d.ts +23 -0
- package/dist/components/tiptap-ui-primitive/avatar/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/badge/badge.d.ts +11 -0
- package/dist/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/button/button.d.ts +16 -0
- package/dist/components/tiptap-ui-primitive/button/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/button-group/button-group.d.ts +10 -0
- package/dist/components/tiptap-ui-primitive/button-group/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/card/card.d.ts +10 -0
- package/dist/components/tiptap-ui-primitive/card/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/combobox/combobox.d.ts +21 -0
- package/dist/components/tiptap-ui-primitive/combobox/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +29 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/input/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/input/input.d.ts +3 -0
- package/dist/components/tiptap-ui-primitive/input-group/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/input-group/input-group.d.ts +19 -0
- package/dist/components/tiptap-ui-primitive/menu/index.d.ts +5 -0
- package/dist/components/tiptap-ui-primitive/menu/menu-context.d.ts +5 -0
- package/dist/components/tiptap-ui-primitive/menu/menu-hooks.d.ts +10 -0
- package/dist/components/tiptap-ui-primitive/menu/menu-types.d.ts +44 -0
- package/dist/components/tiptap-ui-primitive/menu/menu-utils.d.ts +15 -0
- package/dist/components/tiptap-ui-primitive/menu/menu.d.ts +20 -0
- package/dist/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/popover/popover.d.ts +6 -0
- package/dist/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/separator/separator.d.ts +5 -0
- package/dist/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/spacer/spacer.d.ts +5 -0
- package/dist/components/tiptap-ui-primitive/textarea/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/textarea/textarea.d.ts +3 -0
- package/dist/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +9 -0
- package/dist/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +29 -0
- package/dist/components/tiptap-ui-utils/floating-element/floating-element-utils.d.ts +3 -0
- package/dist/components/tiptap-ui-utils/floating-element/floating-element.d.ts +53 -0
- package/dist/components/tiptap-ui-utils/floating-element/index.d.ts +2 -0
- package/dist/components/tiptap-ui-utils/suggestion-menu/index.d.ts +3 -0
- package/dist/components/tiptap-ui-utils/suggestion-menu/suggestion-menu-types.d.ts +86 -0
- package/dist/components/tiptap-ui-utils/suggestion-menu/suggestion-menu-utils.d.ts +19 -0
- package/dist/components/tiptap-ui-utils/suggestion-menu/suggestion-menu.d.ts +6 -0
- package/dist/cvnert-editor.css +1 -0
- package/dist/cvnert-editor.js +17069 -0
- package/dist/cvnert-editor.umd.cjs +5 -0
- package/dist/hooks/use-composed-ref.d.ts +3 -0
- package/dist/hooks/use-cursor-visibility.d.ts +20 -0
- package/dist/hooks/use-element-rect.d.ts +35 -0
- package/dist/hooks/use-floating-element.d.ts +36 -0
- package/dist/hooks/use-floating-toolbar-visibility.d.ts +29 -0
- package/dist/hooks/use-is-breakpoint.d.ts +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +7 -0
- package/dist/hooks/use-menu-navigation.d.ts +52 -0
- package/dist/hooks/use-on-click-outside.d.ts +18 -0
- package/dist/hooks/use-throttled-callback.d.ts +18 -0
- package/dist/hooks/use-tiptap-editor.d.ts +6 -0
- package/dist/hooks/use-ui-editor-state.d.ts +4 -0
- package/dist/hooks/use-unmount.d.ts +7 -0
- package/dist/hooks/use-window-size.d.ts +35 -0
- package/dist/index.d.ts +3 -0
- package/dist/lib/tiptap-advanced-utils.d.ts +120 -0
- package/dist/lib/tiptap-collab-utils.d.ts +46 -0
- package/dist/lib/tiptap-utils.d.ts +174 -0
- package/dist/types.d.ts +26 -0
- package/package.json +94 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
import type { Node } from "@tiptap/pm/model";
|
|
3
|
+
import type { Command } from "@tiptap/pm/state";
|
|
4
|
+
import { type EditorState, type Transaction } from "@tiptap/pm/state";
|
|
5
|
+
import type { FindNodeResult, Rect } from "@tiptap/pm/tables";
|
|
6
|
+
import { TableMap } from "@tiptap/pm/tables";
|
|
7
|
+
export declare const RESIZE_MIN_WIDTH = 35;
|
|
8
|
+
export declare const EMPTY_CELL_WIDTH = 120;
|
|
9
|
+
export declare const EMPTY_CELL_HEIGHT = 40;
|
|
10
|
+
export type Orientation = "row" | "column";
|
|
11
|
+
export interface CellInfo extends FindNodeResult {
|
|
12
|
+
row: number;
|
|
13
|
+
column: number;
|
|
14
|
+
}
|
|
15
|
+
export type CellCoordinates = {
|
|
16
|
+
row: number;
|
|
17
|
+
col: number;
|
|
18
|
+
};
|
|
19
|
+
export type SelectionReturnMode = "state" | "transaction" | "dispatch";
|
|
20
|
+
export type BaseSelectionOptions = {
|
|
21
|
+
mode?: SelectionReturnMode;
|
|
22
|
+
};
|
|
23
|
+
export type DispatchSelectionOptions = {
|
|
24
|
+
mode: "dispatch";
|
|
25
|
+
dispatch: (tr: Transaction) => void;
|
|
26
|
+
};
|
|
27
|
+
export type TransactionSelectionOptions = {
|
|
28
|
+
mode: "transaction";
|
|
29
|
+
};
|
|
30
|
+
export type StateSelectionOptions = {
|
|
31
|
+
mode?: "state";
|
|
32
|
+
};
|
|
33
|
+
export type TableInfo = {
|
|
34
|
+
map: TableMap;
|
|
35
|
+
} & FindNodeResult;
|
|
36
|
+
export declare function isHTMLElement(n: unknown): n is HTMLElement;
|
|
37
|
+
export type DomCellAroundResult = {
|
|
38
|
+
type: "cell";
|
|
39
|
+
domNode: HTMLElement;
|
|
40
|
+
tbodyNode: HTMLTableSectionElement | null;
|
|
41
|
+
} | {
|
|
42
|
+
type: "wrapper";
|
|
43
|
+
domNode: HTMLElement;
|
|
44
|
+
tbodyNode: HTMLTableSectionElement | null;
|
|
45
|
+
};
|
|
46
|
+
export declare function safeClosest<T extends Element>(start: Element | null, selector: string): T | null;
|
|
47
|
+
/**
|
|
48
|
+
* Walk up from an element until we find a TD/TH or the table wrapper.
|
|
49
|
+
* Returns the found element plus its tbody (if present).
|
|
50
|
+
*/
|
|
51
|
+
export declare function domCellAround(target: Element): DomCellAroundResult | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Clamps a value between min and max bounds
|
|
54
|
+
*/
|
|
55
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if a cell is merged (has colspan or rowspan > 1)
|
|
58
|
+
*/
|
|
59
|
+
export declare function isCellMerged(node: Node | null): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Get information about the table at the current selection or a specific position.
|
|
62
|
+
*
|
|
63
|
+
* If `tablePos` is provided, it looks for a table at that exact position.
|
|
64
|
+
* Otherwise, it finds the nearest table containing the current selection.
|
|
65
|
+
*
|
|
66
|
+
* Returns an object with:
|
|
67
|
+
* - `node`: the table node
|
|
68
|
+
* - `pos`: the position of the table in the document
|
|
69
|
+
* - `start`: the position just after the table node (where its content starts)
|
|
70
|
+
* - `map`: the `TableMap` for layout info (rows, columns, spans)
|
|
71
|
+
*
|
|
72
|
+
* If no table is found, returns null.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getTable(editor: Editor | null, tablePos?: number): {
|
|
75
|
+
map: TableMap;
|
|
76
|
+
node: Node;
|
|
77
|
+
pos: number;
|
|
78
|
+
start: number;
|
|
79
|
+
depth: number;
|
|
80
|
+
} | null;
|
|
81
|
+
/**
|
|
82
|
+
* Checks if the current text selection is inside a table cell.
|
|
83
|
+
* @param state - The editor state to check
|
|
84
|
+
* @returns true if the selection is inside a table cell; false otherwise
|
|
85
|
+
*/
|
|
86
|
+
export declare function isSelectionInCell(state: EditorState): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Cells overlap a rectangle if any of the cells in the rectangle are merged
|
|
89
|
+
* with cells outside the rectangle.
|
|
90
|
+
*/
|
|
91
|
+
export declare function cellsOverlapRectangle({ width, height, map }: TableMap, rect: Rect): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Runs a function while preserving the editor's selection.
|
|
94
|
+
* @param editor The Tiptap editor instance
|
|
95
|
+
* @param fn The function to run
|
|
96
|
+
* @returns True if the selection was successfully restored, false otherwise
|
|
97
|
+
*/
|
|
98
|
+
export declare function runPreservingCursor(editor: Editor, fn: () => void): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Determines whether a table cell is effectively empty.
|
|
101
|
+
*
|
|
102
|
+
* A cell is considered empty when:
|
|
103
|
+
* - it has no children, or
|
|
104
|
+
* - it contains only whitespace text, or
|
|
105
|
+
* - it contains no text and no non-text leaf nodes (images, embeds, etc.)
|
|
106
|
+
*
|
|
107
|
+
* Early-outs as soon as any meaningful content is found.
|
|
108
|
+
*
|
|
109
|
+
* @param cellNode - The table cell node to check
|
|
110
|
+
* @returns true if the cell is empty; false otherwise
|
|
111
|
+
*/
|
|
112
|
+
export declare function isCellEmpty(cellNode: Node): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Determine if the current selection is a full row or column selection.
|
|
115
|
+
*
|
|
116
|
+
* If the selection is a `CellSelection` that spans an entire row or column,
|
|
117
|
+
* returns an object indicating the type and index:
|
|
118
|
+
* - `{ type: "row", index: number }` for full row selections
|
|
119
|
+
* - `{ type: "column", index: number }` for full column selections
|
|
120
|
+
*
|
|
121
|
+
* If the selection is not a full row/column, or if no table is found, returns null.
|
|
122
|
+
*/
|
|
123
|
+
export declare function getTableSelectionType(editor: Editor | null, index?: number, orientation?: Orientation, tablePos?: number): {
|
|
124
|
+
orientation: Orientation;
|
|
125
|
+
index: number;
|
|
126
|
+
} | null;
|
|
127
|
+
/**
|
|
128
|
+
* Get all cells (and unique merged cells) in the selected row or column.
|
|
129
|
+
*
|
|
130
|
+
* - If `index` is provided, uses that row/column index.
|
|
131
|
+
* - If omitted, uses the first selected row/column based on current selection.
|
|
132
|
+
*
|
|
133
|
+
* Returns an object with:
|
|
134
|
+
* - `cells`: all cells in the row/column
|
|
135
|
+
* - `mergedCells`: only the unique cells that have rowspan/colspan > 1
|
|
136
|
+
*
|
|
137
|
+
* If no valid selection or index is found, returns empty arrays.
|
|
138
|
+
*/
|
|
139
|
+
export declare function getRowOrColumnCells(editor: Editor | null, index?: number, orientation?: Orientation, tablePos?: number): {
|
|
140
|
+
cells: CellInfo[];
|
|
141
|
+
mergedCells: CellInfo[];
|
|
142
|
+
index?: number;
|
|
143
|
+
orientation?: Orientation;
|
|
144
|
+
tablePos?: number;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Collect cells (and unique merged cells) from a specific row.
|
|
148
|
+
* - If `rowIndex` is provided, scans that row.
|
|
149
|
+
* - If omitted, uses the first (topmost) selected row based on the current selection.
|
|
150
|
+
*/
|
|
151
|
+
export declare function getRowCells(editor: Editor | null, rowIndex?: number, tablePos?: number): {
|
|
152
|
+
cells: CellInfo[];
|
|
153
|
+
mergedCells: CellInfo[];
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Collect cells (and unique merged cells) from the current table.
|
|
157
|
+
* - If `columnIndex` is provided, scans that column.
|
|
158
|
+
* - If omitted, uses the first (leftmost) selected column based on the current selection.
|
|
159
|
+
*/
|
|
160
|
+
export declare function getColumnCells(editor: Editor | null, columnIndex?: number, tablePos?: number): {
|
|
161
|
+
cells: CellInfo[];
|
|
162
|
+
mergedCells: CellInfo[];
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* After moving a row or column, update the selection to the moved item.
|
|
166
|
+
*
|
|
167
|
+
* This ensures that after a move operation, the selection remains on the
|
|
168
|
+
* moved row or column, providing better user feedback.
|
|
169
|
+
*
|
|
170
|
+
* @param editor - The editor instance
|
|
171
|
+
* @param orientation - "row" or "column" indicating what was moved
|
|
172
|
+
* @param newIndex - The new index of the moved row/column
|
|
173
|
+
* @param tablePos - Optional position of the table in the document
|
|
174
|
+
*/
|
|
175
|
+
export declare function updateSelectionAfterAction(editor: Editor, orientation: Orientation, newIndex: number, tablePos?: number): void;
|
|
176
|
+
/**
|
|
177
|
+
* Returns a command that sets the given attributes to the given values,
|
|
178
|
+
* and is only available when the currently selected cell doesn't
|
|
179
|
+
* already have those attributes set to those values.
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
export declare function setCellAttr(attrs: Record<string, unknown>): Command;
|
|
184
|
+
export declare function setCellAttr(name: string, value: unknown): Command;
|
|
185
|
+
/**
|
|
186
|
+
* Counts how many consecutive empty rows exist at the bottom of a given table.
|
|
187
|
+
*
|
|
188
|
+
* This function:
|
|
189
|
+
* - Locates the exact table in the document via reference matching
|
|
190
|
+
* - Iterates from the last visual row upward
|
|
191
|
+
* - Deduplicates cells per row using `TableMap` (merged cells can repeat positions)
|
|
192
|
+
* - Treats a row as empty only if all its unique cells are empty by `isCellEmpty`
|
|
193
|
+
*
|
|
194
|
+
* @param editor - The editor whose document contains the table
|
|
195
|
+
* @param target - The table node instance to analyze (must be the same reference as in the doc)
|
|
196
|
+
* @returns The number of trailing empty rows (0 if table not found)
|
|
197
|
+
*/
|
|
198
|
+
export declare function countEmptyRowsFromEnd(editor: Editor, tablePos: number): number;
|
|
199
|
+
/**
|
|
200
|
+
* Counts how many consecutive empty columns exist at the right edge of a given table.
|
|
201
|
+
*
|
|
202
|
+
* Similar to `countEmptyRowsFromEnd`, but scans by columns:
|
|
203
|
+
* - Iterates from the last visual column leftward
|
|
204
|
+
* - Deduplicates per-column cells using `TableMap`
|
|
205
|
+
* - A column is empty only if all unique cells in that column are empty
|
|
206
|
+
*
|
|
207
|
+
* @param editor - The editor whose document contains the table
|
|
208
|
+
* @param target - The table node instance to analyze (must be the same reference as in the doc)
|
|
209
|
+
* @returns The number of trailing empty columns (0 if table not found)
|
|
210
|
+
*/
|
|
211
|
+
export declare function countEmptyColumnsFromEnd(editor: Editor, tablePos: number): number;
|
|
212
|
+
/**
|
|
213
|
+
* Rounds a number with a symmetric "dead-zone" around integer boundaries,
|
|
214
|
+
* which makes drag/resize UX feel less jittery near thresholds.
|
|
215
|
+
*
|
|
216
|
+
* For example, with `margin = 0.3`:
|
|
217
|
+
* - values < n + 0.3 snap down to `n`
|
|
218
|
+
* - values > n + 0.7 snap up to `n + 1`
|
|
219
|
+
* - values in [n + 0.3, n + 0.7] fall back to `Math.round`
|
|
220
|
+
*
|
|
221
|
+
* @param num - The floating value to round
|
|
222
|
+
* @param margin - Half-width of the dead-zone around integer boundaries (default 0.3)
|
|
223
|
+
* @returns The rounded value using the dead-zone heuristic
|
|
224
|
+
*/
|
|
225
|
+
export declare function marginRound(num: number, margin?: number): number;
|
|
226
|
+
/**
|
|
227
|
+
* Compares two DOMRect objects for equality.
|
|
228
|
+
*
|
|
229
|
+
* Treats `undefined` as a valid state, where two `undefined` rects are equal,
|
|
230
|
+
* and `undefined` is not equal to any defined rect.
|
|
231
|
+
*
|
|
232
|
+
* @param a - The first DOMRect or undefined
|
|
233
|
+
* @param b - The second DOMRect or undefined
|
|
234
|
+
* @returns true if both rects are equal or both are undefined; false otherwise
|
|
235
|
+
*/
|
|
236
|
+
export declare function rectEq(a?: DOMRect | null, b?: DOMRect | null): boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Create or apply a `CellSelection` inside a table.
|
|
239
|
+
*
|
|
240
|
+
* Depending on the `mode` option, this helper behaves differently:
|
|
241
|
+
*
|
|
242
|
+
* - `"state"` (default) → Returns a new `EditorState` with the selection applied.
|
|
243
|
+
* - `"transaction"` → Returns a `Transaction` with the selection set, without applying it.
|
|
244
|
+
* - `"dispatch"` → Immediately calls `dispatch(tr)` with the new selection.
|
|
245
|
+
*
|
|
246
|
+
* This allows you to reuse the same helper in commands, tests, or utilities
|
|
247
|
+
* without duplicating logic.
|
|
248
|
+
*
|
|
249
|
+
* Example:
|
|
250
|
+
* ```ts
|
|
251
|
+
* // Get new state
|
|
252
|
+
* const nextState = createTableCellSelection(state, tablePosition, { row: 1, col: 1 }, { row: 2, col: 3 })
|
|
253
|
+
*
|
|
254
|
+
* // Get transaction only
|
|
255
|
+
* const tr = createTableCellSelection(state, tablePosition, { row: 0, col: 0 }, { row: 0, col: 2 }, { mode: "transaction" })
|
|
256
|
+
*
|
|
257
|
+
* // Dispatch directly
|
|
258
|
+
* createTableCellSelection(state, tablePosition, { row: 1, col: 1 }, { row: 3, col: 2 }, { mode: "dispatch", dispatch })
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export declare function createTableCellSelection(state: EditorState, tablePosition: number, startCell: CellCoordinates, endCell?: CellCoordinates, options?: StateSelectionOptions): EditorState;
|
|
262
|
+
export declare function createTableCellSelection(state: EditorState, tablePosition: number, startCell: CellCoordinates, endCell: CellCoordinates | undefined, options: TransactionSelectionOptions): Transaction;
|
|
263
|
+
export declare function createTableCellSelection(state: EditorState, tablePosition: number, startCell: CellCoordinates, endCell: CellCoordinates | undefined, options: DispatchSelectionOptions): void;
|
|
264
|
+
/**
|
|
265
|
+
* Get the position of a cell inside a table by relative row/col indices.
|
|
266
|
+
* Returns the position *before* the cell, which is what `CellSelection` expects.
|
|
267
|
+
*/
|
|
268
|
+
export declare function getCellPosition(state: EditorState, tablePosition: number, cellCoordinates: CellCoordinates): import("@tiptap/pm/model").ResolvedPos | null;
|
|
269
|
+
/**
|
|
270
|
+
* Selects table cells by their (row, col) coordinates.
|
|
271
|
+
*
|
|
272
|
+
* This function can be used in three modes:
|
|
273
|
+
* - `"state"` (default) → Returns a new `EditorState` with the selection applied, or null if failed.
|
|
274
|
+
* - `"transaction"` → Returns a `Transaction` with the selection set, or null if failed.
|
|
275
|
+
* - `"dispatch"` → Immediately dispatches the selection and returns boolean success status.
|
|
276
|
+
*
|
|
277
|
+
* @param editor - The editor instance
|
|
278
|
+
* @param tablePos - Position of the table in the document
|
|
279
|
+
* @param coords - Array of {row, col} coordinates to select
|
|
280
|
+
* @param options - Mode and dispatch options
|
|
281
|
+
*/
|
|
282
|
+
export declare function selectCellsByCoords(editor: Editor | null, tablePos: number, coords: {
|
|
283
|
+
row: number;
|
|
284
|
+
col: number;
|
|
285
|
+
}[], options?: StateSelectionOptions): EditorState;
|
|
286
|
+
export declare function selectCellsByCoords(editor: Editor | null, tablePos: number, coords: {
|
|
287
|
+
row: number;
|
|
288
|
+
col: number;
|
|
289
|
+
}[], options: TransactionSelectionOptions): Transaction;
|
|
290
|
+
export declare function selectCellsByCoords(editor: Editor | null, tablePos: number, coords: {
|
|
291
|
+
row: number;
|
|
292
|
+
col: number;
|
|
293
|
+
}[], options: DispatchSelectionOptions): void;
|
|
294
|
+
/**
|
|
295
|
+
* Select the cell at (row, col) using `cellAround` to respect merged cells.
|
|
296
|
+
*
|
|
297
|
+
* @param editor Tiptap editor
|
|
298
|
+
* @param row Row index (0-based)
|
|
299
|
+
* @param col Column index (0-based)
|
|
300
|
+
* @param tablePos Optional absolute position of the table node
|
|
301
|
+
* @param dispatch Optional dispatch; defaults to editor.view.dispatch
|
|
302
|
+
*/
|
|
303
|
+
export declare function selectCellAt({ editor, row, col, tablePos, dispatch, }: {
|
|
304
|
+
editor: Editor | null;
|
|
305
|
+
row: number;
|
|
306
|
+
col: number;
|
|
307
|
+
tablePos?: number;
|
|
308
|
+
dispatch?: (tr: Transaction) => void;
|
|
309
|
+
}): boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Selects a boundary cell of the table based on orientation.
|
|
312
|
+
*
|
|
313
|
+
* For row orientation, selects the bottom-left cell of the table.
|
|
314
|
+
* For column orientation, selects the top-right cell of the table.
|
|
315
|
+
*
|
|
316
|
+
* This function accounts for merged cells to ensure the correct cell is selected.
|
|
317
|
+
*
|
|
318
|
+
* @param editor The Tiptap editor instance
|
|
319
|
+
* @param tableNode The table node
|
|
320
|
+
* @param tablePos The position of the table node in the document
|
|
321
|
+
* @param orientation "row" to select bottom-left, "column" to select top-right
|
|
322
|
+
* @returns true if the selection was successful; false otherwise
|
|
323
|
+
*/
|
|
324
|
+
export declare function selectLastCell(editor: Editor, tableNode: Node, tablePos: number, orientation: Orientation): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Get all (row, col) coordinates for a given row or column index.
|
|
327
|
+
*
|
|
328
|
+
* - If `orientation` is "row", returns all columns in that row.
|
|
329
|
+
* - If `orientation` is "column", returns all rows in that column.
|
|
330
|
+
*
|
|
331
|
+
* Returns null if:
|
|
332
|
+
* - the editor or table is not found
|
|
333
|
+
* - the index is out of bounds
|
|
334
|
+
*
|
|
335
|
+
* @param editor The Tiptap editor instance
|
|
336
|
+
* @param index The row or column index (0-based)
|
|
337
|
+
* @param orientation "row" to get row coordinates, "column" for column coordinates
|
|
338
|
+
* @param tablePos Optional position of the table node in the document
|
|
339
|
+
* @returns Array of {row, col} objects or null if invalid
|
|
340
|
+
*/
|
|
341
|
+
export declare function getIndexCoordinates({ editor, index, orientation, tablePos, }: {
|
|
342
|
+
editor: Editor | null;
|
|
343
|
+
index: number;
|
|
344
|
+
orientation?: Orientation;
|
|
345
|
+
tablePos?: number;
|
|
346
|
+
}): {
|
|
347
|
+
row: number;
|
|
348
|
+
col: number;
|
|
349
|
+
}[] | null;
|
|
350
|
+
/**
|
|
351
|
+
* Given a DOM cell element, find its (row, col) indices within the table.
|
|
352
|
+
*
|
|
353
|
+
* This function:
|
|
354
|
+
* - Locates the nearest ancestor table element
|
|
355
|
+
* - Uses the editor's document model to resolve the cell's position
|
|
356
|
+
* - Traverses up the node hierarchy to find the corresponding table cell node
|
|
357
|
+
* - Uses `TableMap` to translate the cell's position into (row, col) indices
|
|
358
|
+
*
|
|
359
|
+
* Returns null if:
|
|
360
|
+
* - the table or cell cannot be found in the editor's document
|
|
361
|
+
* - any error occurs during position resolution
|
|
362
|
+
*
|
|
363
|
+
* @param cell The HTMLTableCellElement (td or th)
|
|
364
|
+
* @param tableNode The table node in the ProseMirror document
|
|
365
|
+
* @param editor The Tiptap editor instance
|
|
366
|
+
* @returns An object with { rowIndex, colIndex } or null if not found
|
|
367
|
+
*/
|
|
368
|
+
export declare function getCellIndicesFromDOM(cell: HTMLTableCellElement, tableNode: Node | null, editor: Editor): {
|
|
369
|
+
rowIndex: number;
|
|
370
|
+
colIndex: number;
|
|
371
|
+
} | null;
|
|
372
|
+
/**
|
|
373
|
+
* Given a DOM element inside a table, find the corresponding table node and its position.
|
|
374
|
+
*
|
|
375
|
+
* This function:
|
|
376
|
+
* - Locates the nearest ancestor table element
|
|
377
|
+
* - Uses the editor's document model to resolve the table's position
|
|
378
|
+
* - Traverses up the node hierarchy to find the corresponding table node
|
|
379
|
+
*
|
|
380
|
+
* Returns null if:
|
|
381
|
+
* - the table cannot be found in the editor's document
|
|
382
|
+
* - any error occurs during position resolution
|
|
383
|
+
*
|
|
384
|
+
* @param tableElement The HTMLTableElement or an element inside it
|
|
385
|
+
* @param editor The Tiptap editor instance
|
|
386
|
+
* @returns An object with { node: tableNode, pos: tablePos } or null if not found
|
|
387
|
+
*/
|
|
388
|
+
export declare function getTableFromDOM(tableElement: HTMLElement, editor: Editor): {
|
|
389
|
+
node: Node;
|
|
390
|
+
pos: number;
|
|
391
|
+
} | null;
|
|
392
|
+
/**
|
|
393
|
+
* Checks if a node is a table node
|
|
394
|
+
*/
|
|
395
|
+
export declare function isTableNode(node: Node | null | undefined): node is Node;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UseTableAddRowColumnConfig } from "@/components/tiptap-node/table-node/ui/table-add-row-column-button";
|
|
2
|
+
import type { ButtonProps } from "@/components/tiptap-ui-primitive/button";
|
|
3
|
+
export interface TableAddRowColumnButtonProps extends Omit<ButtonProps, "type">, UseTableAddRowColumnConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Button component for adding a table row/column in a Tiptap editor.
|
|
11
|
+
*
|
|
12
|
+
* For custom button implementations, use the `useTableAddRowColumn` hook instead.
|
|
13
|
+
*/
|
|
14
|
+
export declare const TableAddRowColumnButton: import("react").ForwardRefExoticComponent<TableAddRowColumnButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
import type { Orientation } from "@/components/tiptap-node/table-node/lib/tiptap-table-utils";
|
|
3
|
+
export type RowSide = "above" | "below";
|
|
4
|
+
export type ColSide = "left" | "right";
|
|
5
|
+
export interface UseTableAddRowColumnConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The Tiptap editor instance. If omitted, the hook will use
|
|
8
|
+
* the context/editor from `useTiptapEditor`.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* The index of the row or column to add relative to.
|
|
13
|
+
* If omitted, will use the current selection.
|
|
14
|
+
*/
|
|
15
|
+
index?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Whether you're adding a row or a column.
|
|
18
|
+
* If omitted, will use the current selection.
|
|
19
|
+
*/
|
|
20
|
+
orientation?: Orientation;
|
|
21
|
+
/**
|
|
22
|
+
* The side to add on - above/below for rows, left/right for columns.
|
|
23
|
+
*/
|
|
24
|
+
side: RowSide | ColSide;
|
|
25
|
+
/**
|
|
26
|
+
* The position of the table in the document.
|
|
27
|
+
*/
|
|
28
|
+
tablePos?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Hide the button when addition isn't currently possible.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
hideWhenUnavailable?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Callback function called after a successful addition.
|
|
36
|
+
*/
|
|
37
|
+
onAdded?: () => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const tableAddRowColumnLabels: {
|
|
40
|
+
readonly row: Record<RowSide, string>;
|
|
41
|
+
readonly column: Record<ColSide, string>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Custom hook that provides **table row/column addition**
|
|
45
|
+
* functionality for the Tiptap editor.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useTableAddRowColumn(config: UseTableAddRowColumnConfig): {
|
|
48
|
+
isVisible: boolean;
|
|
49
|
+
canAddRowColumn: boolean;
|
|
50
|
+
handleAdd: () => boolean;
|
|
51
|
+
label: string;
|
|
52
|
+
Icon: import("react").MemoExoticComponent<({ className, ...props }: Omit<import("react").SVGProps<SVGSVGElement>, "ref">) => import("react").JSX.Element>;
|
|
53
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { UseTableAlignCellConfig } from "@/components/tiptap-node/table-node/ui/table-align-cell-button";
|
|
2
|
+
import type { ButtonProps } from "@/components/tiptap-ui-primitive/button";
|
|
3
|
+
export interface TableAlignCellButtonProps extends Omit<ButtonProps, "type">, UseTableAlignCellConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Button component for aligning table cells in a Tiptap editor.
|
|
11
|
+
* Supports both text alignment (left, center, right, justify) and
|
|
12
|
+
* vertical alignment (top, middle, bottom).
|
|
13
|
+
*
|
|
14
|
+
* Can align either the currently selected cell(s) or all cells in a specific row/column.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Align the currently selected cell(s)
|
|
19
|
+
* <TableAlignCellButton
|
|
20
|
+
* alignmentType="text"
|
|
21
|
+
* alignment="center"
|
|
22
|
+
* />
|
|
23
|
+
*
|
|
24
|
+
* // Align all cells in row 0
|
|
25
|
+
* <TableAlignCellButton
|
|
26
|
+
* alignmentType="text"
|
|
27
|
+
* alignment="center"
|
|
28
|
+
* index={0}
|
|
29
|
+
* orientation="row"
|
|
30
|
+
* />
|
|
31
|
+
*
|
|
32
|
+
* // Align all cells in column 2
|
|
33
|
+
* <TableAlignCellButton
|
|
34
|
+
* alignmentType="vertical"
|
|
35
|
+
* alignment="middle"
|
|
36
|
+
* index={2}
|
|
37
|
+
* orientation="column"
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const TableAlignCellButton: import("react").ForwardRefExoticComponent<TableAlignCellButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
package/dist/components/tiptap-node/table-node/ui/table-align-cell-button/use-table-align-cell.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
import type { Orientation } from "@/components/tiptap-node/table-node/lib/tiptap-table-utils";
|
|
3
|
+
export type TextAlignment = "left" | "center" | "right" | "justify";
|
|
4
|
+
export type VerticalAlignment = "top" | "middle" | "bottom";
|
|
5
|
+
export type AlignmentType = "text" | "vertical";
|
|
6
|
+
export interface UseTableAlignCellConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Tiptap editor instance. If omitted, the hook will use
|
|
9
|
+
* the context/editor from `useTiptapEditor`.
|
|
10
|
+
*/
|
|
11
|
+
editor?: Editor | null;
|
|
12
|
+
/**
|
|
13
|
+
* The type of alignment to apply.
|
|
14
|
+
*/
|
|
15
|
+
alignmentType: AlignmentType;
|
|
16
|
+
/**
|
|
17
|
+
* The alignment value to set.
|
|
18
|
+
*/
|
|
19
|
+
alignment: TextAlignment | VerticalAlignment;
|
|
20
|
+
/**
|
|
21
|
+
* Optional index of the row or column to align.
|
|
22
|
+
* If provided along with orientation, aligns all cells in that row/column.
|
|
23
|
+
* If not provided, aligns the currently selected cell(s).
|
|
24
|
+
*/
|
|
25
|
+
index?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Optional orientation when using index.
|
|
28
|
+
* Determines whether to align a row or column.
|
|
29
|
+
*/
|
|
30
|
+
orientation?: Orientation;
|
|
31
|
+
/**
|
|
32
|
+
* Hide the button when alignment isn't currently possible.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
hideWhenUnavailable?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Callback function called after successful alignment change.
|
|
38
|
+
*/
|
|
39
|
+
onAligned?: (alignment: TextAlignment | VerticalAlignment) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare const tableAlignCellLabels: {
|
|
42
|
+
text: Record<TextAlignment, string>;
|
|
43
|
+
vertical: Record<VerticalAlignment, string>;
|
|
44
|
+
};
|
|
45
|
+
export declare const tableAlignCellIcons: {
|
|
46
|
+
text: Record<TextAlignment, React.ComponentType<{
|
|
47
|
+
className?: string;
|
|
48
|
+
}>>;
|
|
49
|
+
vertical: Record<VerticalAlignment, React.ComponentType<{
|
|
50
|
+
className?: string;
|
|
51
|
+
}>>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Custom hook that provides **table cell alignment**
|
|
55
|
+
* functionality for the Tiptap editor.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // Simple text alignment button
|
|
60
|
+
* function AlignLeftButton() {
|
|
61
|
+
* const { isVisible, handleAlign, canAlignCell, isActive, label, Icon } = useTableAlignCell({
|
|
62
|
+
* alignmentType: "text",
|
|
63
|
+
* alignment: "left",
|
|
64
|
+
* hideWhenUnavailable: true,
|
|
65
|
+
* onAligned: (alignment) => console.log(`Aligned to: ${alignment}`),
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* if (!isVisible) return null
|
|
69
|
+
*
|
|
70
|
+
* return (
|
|
71
|
+
* <button
|
|
72
|
+
* onClick={handleAlign}
|
|
73
|
+
* disabled={!canAlignCell}
|
|
74
|
+
* aria-pressed={isActive}
|
|
75
|
+
* aria-label={label}
|
|
76
|
+
* >
|
|
77
|
+
* <Icon /> {label}
|
|
78
|
+
* </button>
|
|
79
|
+
* )
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* // Align entire row vertically
|
|
83
|
+
* function AlignRowTopButton({ rowIndex }: { rowIndex: number }) {
|
|
84
|
+
* const { isVisible, handleAlign, label, Icon } = useTableAlignCell({
|
|
85
|
+
* alignmentType: "vertical",
|
|
86
|
+
* alignment: "top",
|
|
87
|
+
* index: rowIndex,
|
|
88
|
+
* orientation: "row",
|
|
89
|
+
* hideWhenUnavailable: true,
|
|
90
|
+
* })
|
|
91
|
+
*
|
|
92
|
+
* if (!isVisible) return null
|
|
93
|
+
*
|
|
94
|
+
* return (
|
|
95
|
+
* <button onClick={handleAlign} aria-label={label}>
|
|
96
|
+
* <Icon /> {label}
|
|
97
|
+
* </button>
|
|
98
|
+
* )
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* // Alignment toolbar for selected cell
|
|
102
|
+
* function CellAlignmentToolbar() {
|
|
103
|
+
* const alignments: TextAlignment[] = ["left", "center", "right", "justify"]
|
|
104
|
+
*
|
|
105
|
+
* return (
|
|
106
|
+
* <div role="toolbar" aria-label="Text alignment">
|
|
107
|
+
* {alignments.map((alignment) => {
|
|
108
|
+
* const { isVisible, handleAlign, canAlignCell, isActive, Icon } = useTableAlignCell({
|
|
109
|
+
* alignmentType: "text",
|
|
110
|
+
* alignment,
|
|
111
|
+
* hideWhenUnavailable: true,
|
|
112
|
+
* })
|
|
113
|
+
*
|
|
114
|
+
* if (!isVisible) return null
|
|
115
|
+
*
|
|
116
|
+
* return (
|
|
117
|
+
* <button
|
|
118
|
+
* key={alignment}
|
|
119
|
+
* onClick={handleAlign}
|
|
120
|
+
* disabled={!canAlignCell}
|
|
121
|
+
* aria-pressed={isActive}
|
|
122
|
+
* title={`Align ${alignment}`}
|
|
123
|
+
* >
|
|
124
|
+
* <Icon />
|
|
125
|
+
* </button>
|
|
126
|
+
* )
|
|
127
|
+
* })}
|
|
128
|
+
* </div>
|
|
129
|
+
* )
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export declare function useTableAlignCell(config: UseTableAlignCellConfig): {
|
|
134
|
+
isVisible: boolean;
|
|
135
|
+
canAlignCell: () => boolean;
|
|
136
|
+
handleAlign: () => boolean;
|
|
137
|
+
label: string;
|
|
138
|
+
Icon: import("react").ComponentClass<{
|
|
139
|
+
className?: string;
|
|
140
|
+
}, any> | import("react").FunctionComponent<{
|
|
141
|
+
className?: string;
|
|
142
|
+
}>;
|
|
143
|
+
isActive: boolean;
|
|
144
|
+
currentAlignment: () => TextAlignment | VerticalAlignment | null;
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./table-alignment-menu";
|
package/dist/components/tiptap-node/table-node/ui/table-alignment-menu/table-alignment-menu.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Orientation } from "@/components/tiptap-node/table-node/lib/tiptap-table-utils";
|
|
2
|
+
export interface ActionItemProps {
|
|
3
|
+
icon: React.ComponentType<{
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}>;
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
isActive?: boolean;
|
|
11
|
+
shortcutBadge?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const TableAlignMenu: ({ index, orientation, }: {
|
|
14
|
+
index?: number;
|
|
15
|
+
orientation?: Orientation;
|
|
16
|
+
}) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./table-cell-handle-menu";
|