@import-ai/omnibox-editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +526 -0
- package/dist/components/tiptap-extension/ai-generation-widget-extension.d.ts +41 -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/ai-sparkles-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-ai-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/mic-ai-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-ai-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/stop-circle-2-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-icons/x-icon.d.ts +3 -0
- package/dist/components/tiptap-node/code-block-node/code-block-node-extension.d.ts +6 -0
- package/dist/components/tiptap-node/code-block-node/code-block-node-view.d.ts +2 -0
- package/dist/components/tiptap-node/code-block-node/diagram-render.d.ts +7 -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-load-state.d.ts +9 -0
- package/dist/components/tiptap-node/image-node/image-node-extension.d.ts +7 -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 +26 -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 +32 -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 +18 -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-context-menu/index.d.ts +1 -0
- package/dist/components/tiptap-node/table-node/ui/table-context-menu/table-context-menu-utils.d.ts +20 -0
- package/dist/components/tiptap-node/table-node/ui/table-context-menu/table-context-menu.d.ts +7 -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 +15 -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 +32 -0
- package/dist/components/tiptap-ui/ai-composer/ai-composer.d.ts +21 -0
- package/dist/components/tiptap-ui/ai-composer/ai-generation-state.d.ts +6 -0
- package/dist/components/tiptap-ui/ai-composer/ai-markdown-preview.d.ts +4 -0
- package/dist/components/tiptap-ui/ai-composer/ai-review-controls.d.ts +13 -0
- package/dist/components/tiptap-ui/ai-composer/ai-writing-indicator.d.ts +10 -0
- package/dist/components/tiptap-ui/ai-composer/index.d.ts +3 -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-utils.d.ts +8 -0
- package/dist/components/tiptap-ui/color-menu/color-menu.d.ts +43 -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 +92 -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 +102 -0
- package/dist/components/tiptap-ui/math-editor/index.d.ts +1 -0
- package/dist/components/tiptap-ui/math-editor/math-editor.d.ts +10 -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 +7 -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 +146 -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 +103 -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 +153 -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/contexts/user-context.d.ts +16 -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 +7 -0
- package/dist/lib/clipboard.d.ts +6 -0
- package/dist/lib/editor-collaboration.d.ts +6 -0
- package/dist/lib/editor-content.d.ts +5 -0
- package/dist/lib/editor-users.d.ts +27 -0
- package/dist/lib/html-table.d.ts +5 -0
- package/dist/lib/i18n.d.ts +170 -0
- package/dist/lib/markdown.d.ts +12 -0
- package/dist/lib/math-editor.d.ts +19 -0
- package/dist/lib/tiptap-advanced-utils.d.ts +120 -0
- package/dist/lib/tiptap-collab-utils.d.ts +47 -0
- package/dist/lib/tiptap-utils.d.ts +174 -0
- package/dist/omnibox-editor.css +1 -0
- package/dist/omnibox-editor.js +19816 -0
- package/dist/omnibox-editor.umd.cjs +15 -0
- package/dist/types.d.ts +77 -0
- package/package.json +114 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 omnibox-editor contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
# @import-ai/omnibox-editor
|
|
2
|
+
|
|
3
|
+
A production-ready React block editor built on Tiptap. It ships a complete editor UI, Markdown/JSON conversion helpers, table editing, image upload, math, diagrams, table of contents, optional AI writing hooks, and optional Yjs collaboration support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- React component with a batteries-included Tiptap editor experience
|
|
8
|
+
- Editable and read-only rendering modes
|
|
9
|
+
- Markdown input, Tiptap JSON input, and Markdown export helpers
|
|
10
|
+
- GitHub-like Markdown styling for headings, lists, links, code, blockquotes, tables, images, and math
|
|
11
|
+
- Notion-like table editing with row/column handles, context menus, resizing, merge/split, sorting, alignment, and fit-to-width actions
|
|
12
|
+
- Image upload pipeline with progress, abort, success, error, size, and count controls
|
|
13
|
+
- KaTeX math rendering and in-editor formula editing
|
|
14
|
+
- Mermaid/ECharts-style diagram rendering from code blocks
|
|
15
|
+
- Optional table of contents sidebar
|
|
16
|
+
- Optional AI writing integration through host-provided handlers
|
|
17
|
+
- Optional Yjs collaboration and collaborative cursors
|
|
18
|
+
- English and Simplified Chinese UI copy with translation overrides
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @import-ai/omnibox-editor
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm add @import-ai/omnibox-editor
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn add @import-ai/omnibox-editor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`react` and `react-dom` are peer dependencies and must be installed by the consuming app.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install react react-dom
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
Import the component and the compiled CSS once in your app.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { OmniboxEditor } from "@import-ai/omnibox-editor"
|
|
46
|
+
import "@import-ai/omnibox-editor/style.css"
|
|
47
|
+
|
|
48
|
+
export function App() {
|
|
49
|
+
return (
|
|
50
|
+
<OmniboxEditor
|
|
51
|
+
placeholder="Start writing..."
|
|
52
|
+
onUpdate={({ json, html, markdown }) => {
|
|
53
|
+
console.log(json, html, markdown)
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Recommended Production Data Flow
|
|
61
|
+
|
|
62
|
+
Use Tiptap JSON as the canonical format in production. It preserves editor-specific structures such as tables, math, images, alignment, colors, and custom nodes more reliably than plain Markdown.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { OmniboxEditor, contentToMarkdown } from "@import-ai/omnibox-editor"
|
|
66
|
+
import "@import-ai/omnibox-editor/style.css"
|
|
67
|
+
|
|
68
|
+
export function ResourceEditor({
|
|
69
|
+
initialContent,
|
|
70
|
+
saveResource,
|
|
71
|
+
}: {
|
|
72
|
+
initialContent: string
|
|
73
|
+
saveResource: (content: unknown) => Promise<void>
|
|
74
|
+
}) {
|
|
75
|
+
return (
|
|
76
|
+
<OmniboxEditor
|
|
77
|
+
content={initialContent}
|
|
78
|
+
onUpdate={({ json }) => {
|
|
79
|
+
void saveResource(json)
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function exportMarkdown(savedContent: unknown) {
|
|
86
|
+
return contentToMarkdown(savedContent as Parameters<typeof contentToMarkdown>[0], {
|
|
87
|
+
debug: false,
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For backward compatibility, `content` accepts both existing Markdown strings and serialized JSON strings. New writes should store `json` from `onUpdate`.
|
|
93
|
+
|
|
94
|
+
## Basic Usage
|
|
95
|
+
|
|
96
|
+
### Markdown Input
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<OmniboxEditor content={"# Hello\n\nThis content starts as Markdown."} />
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Tiptap JSON Input
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<OmniboxEditor
|
|
106
|
+
content={{
|
|
107
|
+
type: "doc",
|
|
108
|
+
content: [
|
|
109
|
+
{
|
|
110
|
+
type: "heading",
|
|
111
|
+
attrs: { level: 1 },
|
|
112
|
+
content: [{ type: "text", text: "Hello" }],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Serialized JSON String Input
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<OmniboxEditor content={JSON.stringify(savedTiptapJson)} />
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Read-Only Rendering
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<OmniboxEditor content={savedContent} editable={false} showHeader={false} />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Embedded Mode
|
|
132
|
+
|
|
133
|
+
Use `variant="embedded"` when the editor is rendered inside an existing page shell or panel.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
<OmniboxEditor
|
|
137
|
+
variant="embedded"
|
|
138
|
+
content={savedContent}
|
|
139
|
+
contentWidth="100%"
|
|
140
|
+
showHeader={false}
|
|
141
|
+
showToc={false}
|
|
142
|
+
/>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Component API
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import type { OmniboxEditorProps } from "@import-ai/omnibox-editor"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
| Prop | Type | Default | Description |
|
|
152
|
+
| --- | --- | --- | --- |
|
|
153
|
+
| `content` | `Content \| string` | demo content | Initial or externally controlled content. Accepts Markdown, serialized JSON, Tiptap JSON documents, or Tiptap node arrays. |
|
|
154
|
+
| `editable` | `boolean` | `true` | Enables editing. Set to `false` for read-only rendering. |
|
|
155
|
+
| `placeholder` | `string` | locale placeholder | Placeholder shown in empty editable blocks. |
|
|
156
|
+
| `onUpdate` | `(payload) => void` | `undefined` | Called after editor content changes. Use `payload.json` as the preferred saved value. |
|
|
157
|
+
| `imageUpload` | `UploadFunction` | built-in object URL fallback | Custom image uploader. Should return the final image URL. |
|
|
158
|
+
| `imageUploadMaxSize` | `number` | package default | Maximum image size in bytes. |
|
|
159
|
+
| `imageUploadLimit` | `number` | `3` | Maximum number of images accepted per upload operation. |
|
|
160
|
+
| `onImageUploadError` | `(error: Error) => void` | logs to console | Called when image upload fails. |
|
|
161
|
+
| `onImageUploadSuccess` | `(url: string) => void` | `undefined` | Called when image upload succeeds. |
|
|
162
|
+
| `linkBase` | `string` | `undefined` | Base URL used to resolve relative links and image sources while parsing Markdown/content. |
|
|
163
|
+
| `locale` | `"en" \| "zh-CN" \| string` | `"en"` | Built-in UI locale. |
|
|
164
|
+
| `translations` | `OmniboxEditorTranslations` | `undefined` | Overrides individual UI labels. |
|
|
165
|
+
| `theme` | `"light" \| "dark"` | `undefined` | Applies package dark-mode classes when set to `"dark"`. |
|
|
166
|
+
| `variant` | `"page" \| "embedded"` | `"page"` | Page mode shows the default editor chrome; embedded mode is more compact. |
|
|
167
|
+
| `contentWidth` | `number \| string` | CSS default | Sets the editor content width. Numbers are treated as pixels. |
|
|
168
|
+
| `showHeader` | `boolean` | `true` in page mode | Controls the top editor header. |
|
|
169
|
+
| `showToc` | `boolean` | `true` in page mode | Controls the table of contents sidebar. |
|
|
170
|
+
| `mentionUsers` | `OmniboxEditorMentionUser[]` | `undefined` | Users shown in the mention dropdown. |
|
|
171
|
+
| `user` | `OmniboxEditorCollaborationUser` | `undefined` | Current user identity for local UI and collaboration fallback. |
|
|
172
|
+
| `collaboration` | `false \| object` | `undefined` | Yjs collaboration config. |
|
|
173
|
+
| `ai` | `boolean \| OmniboxEditorAiConfig` | `undefined` | Enables the AI UI and optionally provides an AI submit handler. |
|
|
174
|
+
|
|
175
|
+
## Update Payload
|
|
176
|
+
|
|
177
|
+
`onUpdate` receives the live editor instance plus multiple content formats.
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import type { OmniboxEditorUpdatePayload } from "@import-ai/omnibox-editor"
|
|
181
|
+
|
|
182
|
+
type OmniboxEditorUpdatePayload = {
|
|
183
|
+
editor: Editor
|
|
184
|
+
json: JSONContent
|
|
185
|
+
html: string
|
|
186
|
+
markdown: string
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Recommended usage:
|
|
191
|
+
|
|
192
|
+
- Save `json` to your backend.
|
|
193
|
+
- Use `markdown` for export/download/copy workflows.
|
|
194
|
+
- Use `html` only when your application explicitly needs HTML output.
|
|
195
|
+
- Debounce or autosave outside the package if the backend should not receive every keystroke.
|
|
196
|
+
|
|
197
|
+
## Markdown and JSON Helpers
|
|
198
|
+
|
|
199
|
+
The package exports conversion helpers for import/export workflows.
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import {
|
|
203
|
+
contentToMarkdown,
|
|
204
|
+
contentToTiptapJson,
|
|
205
|
+
htmlTableToTiptapNode,
|
|
206
|
+
markdownToTiptapJson,
|
|
207
|
+
markdownWithHtmlTablesToTiptapJson,
|
|
208
|
+
tiptapJsonToMarkdown,
|
|
209
|
+
type MarkdownParseOptions,
|
|
210
|
+
type TiptapJsonContent,
|
|
211
|
+
} from "@import-ai/omnibox-editor"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
| API | Description |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| `markdownToTiptapJson(markdown, options?)` | Parses Markdown into a Tiptap JSON document using Tiptap's official `MarkdownManager`, then applies package normalization for links, images, tables, and diagrams. |
|
|
217
|
+
| `markdownWithHtmlTablesToTiptapJson(markdown, options?)` | Parses Markdown that may contain raw HTML `<table>` blocks. HTML tables are converted into Tiptap table nodes. |
|
|
218
|
+
| `contentToTiptapJson(content, options?)` | Accepts Markdown, serialized JSON, or JSON content and returns a normalized Tiptap JSON document. Use this when the input format is unknown. |
|
|
219
|
+
| `tiptapJsonToMarkdown(json, options?)` | Serializes Tiptap JSON back to Markdown. Merged tables are emitted as HTML tables when Markdown tables cannot represent them safely. |
|
|
220
|
+
| `contentToMarkdown(content, options?)` | Accepts Markdown, serialized JSON, or JSON content and returns Markdown. Use this for export from saved server content. |
|
|
221
|
+
| `htmlTableToTiptapNode(html)` | Converts a single HTML table string into a Tiptap table node. |
|
|
222
|
+
|
|
223
|
+
### Markdown Parse Options
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
type MarkdownParseOptions = {
|
|
227
|
+
debug?: boolean
|
|
228
|
+
linkBase?: string
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
| Option | Default | Description |
|
|
233
|
+
| --- | --- | --- |
|
|
234
|
+
| `debug` | `true` | Logs conversion input/output to the console. Set `debug: false` in production import/export paths. |
|
|
235
|
+
| `linkBase` | `undefined` | Resolves relative links and image sources against a base URL. |
|
|
236
|
+
|
|
237
|
+
Production example:
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
const json = contentToTiptapJson(serverContent, {
|
|
241
|
+
linkBase: "https://example.com/resources/current-folder",
|
|
242
|
+
debug: false,
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
const markdown = contentToMarkdown(json, { debug: false })
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Image Upload
|
|
249
|
+
|
|
250
|
+
Provide `imageUpload` to connect the editor to your storage service.
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
import { OmniboxEditor, type UploadFunction } from "@import-ai/omnibox-editor"
|
|
254
|
+
import "@import-ai/omnibox-editor/style.css"
|
|
255
|
+
|
|
256
|
+
const uploadImage: UploadFunction = async (file, onProgress, abortSignal) => {
|
|
257
|
+
const formData = new FormData()
|
|
258
|
+
formData.append("file", file)
|
|
259
|
+
|
|
260
|
+
const response = await fetch("/api/uploads", {
|
|
261
|
+
method: "POST",
|
|
262
|
+
body: formData,
|
|
263
|
+
signal: abortSignal,
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
if (!response.ok) {
|
|
267
|
+
throw new Error("Image upload failed")
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
onProgress?.({ progress: 100 })
|
|
271
|
+
|
|
272
|
+
const result = (await response.json()) as { url: string }
|
|
273
|
+
return result.url
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export function Editor() {
|
|
277
|
+
return (
|
|
278
|
+
<OmniboxEditor
|
|
279
|
+
imageUpload={uploadImage}
|
|
280
|
+
imageUploadMaxSize={10 * 1024 * 1024}
|
|
281
|
+
imageUploadLimit={5}
|
|
282
|
+
onImageUploadError={(error) => {
|
|
283
|
+
console.error(error)
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
The upload function must resolve with the final URL that should be stored in the document.
|
|
291
|
+
|
|
292
|
+
## AI Integration
|
|
293
|
+
|
|
294
|
+
The package renders the AI UI only when `ai` is enabled. The host application owns the actual model call.
|
|
295
|
+
|
|
296
|
+
```tsx
|
|
297
|
+
import type { OmniboxEditorAiSubmitPayload } from "@import-ai/omnibox-editor"
|
|
298
|
+
|
|
299
|
+
async function handleAiSubmit({
|
|
300
|
+
action,
|
|
301
|
+
prompt,
|
|
302
|
+
signal,
|
|
303
|
+
onChunk,
|
|
304
|
+
}: OmniboxEditorAiSubmitPayload) {
|
|
305
|
+
const response = await fetch("/api/ai/write", {
|
|
306
|
+
method: "POST",
|
|
307
|
+
headers: { "Content-Type": "application/json" },
|
|
308
|
+
body: JSON.stringify({ action, prompt }),
|
|
309
|
+
signal,
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
if (!response.ok || !response.body) {
|
|
313
|
+
throw new Error("AI request failed")
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const reader = response.body.getReader()
|
|
317
|
+
const decoder = new TextDecoder()
|
|
318
|
+
|
|
319
|
+
while (true) {
|
|
320
|
+
const { done, value } = await reader.read()
|
|
321
|
+
if (done) break
|
|
322
|
+
onChunk?.(decoder.decode(value))
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
<OmniboxEditor
|
|
327
|
+
ai={{
|
|
328
|
+
enabled: true,
|
|
329
|
+
onSubmit: handleAiSubmit,
|
|
330
|
+
}}
|
|
331
|
+
/>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
`onSubmit` can stream plain Markdown through `onChunk`, or provide structured Tiptap JSON through `onContent` / `onContentPreview`.
|
|
335
|
+
|
|
336
|
+
## Collaboration
|
|
337
|
+
|
|
338
|
+
Collaboration uses Yjs through Tiptap's collaboration extensions. Pass a Yjs document and, optionally, a provider with awareness support.
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
import * as Y from "yjs"
|
|
342
|
+
import { OmniboxEditor } from "@import-ai/omnibox-editor"
|
|
343
|
+
import "@import-ai/omnibox-editor/style.css"
|
|
344
|
+
|
|
345
|
+
const document = new Y.Doc()
|
|
346
|
+
|
|
347
|
+
<OmniboxEditor
|
|
348
|
+
collaboration={{
|
|
349
|
+
document,
|
|
350
|
+
provider,
|
|
351
|
+
user: {
|
|
352
|
+
id: "user-1",
|
|
353
|
+
name: "Ada",
|
|
354
|
+
color: "#3b82f6",
|
|
355
|
+
avatar: "https://example.com/avatar.png",
|
|
356
|
+
},
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
When collaboration is enabled, the package disables StarterKit undo/redo and does not sync external `content` prop updates after initialization. Treat the Yjs document as the source of truth.
|
|
362
|
+
|
|
363
|
+
## Mentions
|
|
364
|
+
|
|
365
|
+
```tsx
|
|
366
|
+
<OmniboxEditor
|
|
367
|
+
mentionUsers={[
|
|
368
|
+
{
|
|
369
|
+
id: "user-1",
|
|
370
|
+
name: "Ada Lovelace",
|
|
371
|
+
color: "#3b82f6",
|
|
372
|
+
avatar: "https://example.com/avatar.png",
|
|
373
|
+
position: "Engineer",
|
|
374
|
+
},
|
|
375
|
+
]}
|
|
376
|
+
/>
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## Internationalization
|
|
380
|
+
|
|
381
|
+
Use `locale` for the built-in language, and `translations` for targeted overrides.
|
|
382
|
+
|
|
383
|
+
```tsx
|
|
384
|
+
<OmniboxEditor
|
|
385
|
+
locale="zh-CN"
|
|
386
|
+
translations={{
|
|
387
|
+
placeholder: "开始写点什么...",
|
|
388
|
+
uploadFailed: "图片上传失败",
|
|
389
|
+
}}
|
|
390
|
+
/>
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
You can also read the merged labels:
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
import { getEditorTranslations } from "@import-ai/omnibox-editor"
|
|
397
|
+
|
|
398
|
+
const labels = getEditorTranslations("zh-CN", {
|
|
399
|
+
placeholder: "开始写点什么...",
|
|
400
|
+
})
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## Styling
|
|
404
|
+
|
|
405
|
+
The package ships compiled CSS at:
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
import "@import-ai/omnibox-editor/style.css"
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The CSS includes editor layout, toolbar UI, table controls, GitHub-like Markdown rules, image states, KaTeX styles, and component variables. It is generated from Tailwind CSS v4 layers and does not require Sass.
|
|
412
|
+
|
|
413
|
+
Set dark mode with the component prop:
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
<OmniboxEditor theme="dark" />
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Constrain content width with `contentWidth`:
|
|
420
|
+
|
|
421
|
+
```tsx
|
|
422
|
+
<OmniboxEditor contentWidth={860} />
|
|
423
|
+
<OmniboxEditor contentWidth="min(100%, 920px)" />
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
## Exported API
|
|
427
|
+
|
|
428
|
+
### Components
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
export { OmniboxEditor }
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Conversion Helpers
|
|
435
|
+
|
|
436
|
+
```ts
|
|
437
|
+
export {
|
|
438
|
+
contentToMarkdown,
|
|
439
|
+
contentToTiptapJson,
|
|
440
|
+
htmlTableToTiptapNode,
|
|
441
|
+
markdownToTiptapJson,
|
|
442
|
+
markdownWithHtmlTablesToTiptapJson,
|
|
443
|
+
tiptapJsonToMarkdown,
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Utilities
|
|
448
|
+
|
|
449
|
+
```ts
|
|
450
|
+
export { getEditorTranslations }
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Types
|
|
454
|
+
|
|
455
|
+
```ts
|
|
456
|
+
export type {
|
|
457
|
+
EditorProviderProps,
|
|
458
|
+
MarkdownParseOptions,
|
|
459
|
+
OmniboxEditorAiAction,
|
|
460
|
+
OmniboxEditorAiConfig,
|
|
461
|
+
OmniboxEditorAiFeature,
|
|
462
|
+
OmniboxEditorAiSubmitPayload,
|
|
463
|
+
OmniboxEditorCollaborationConfig,
|
|
464
|
+
OmniboxEditorCollaborationProvider,
|
|
465
|
+
OmniboxEditorCollaborationUser,
|
|
466
|
+
OmniboxEditorLocale,
|
|
467
|
+
OmniboxEditorMentionUser,
|
|
468
|
+
OmniboxEditorProps,
|
|
469
|
+
OmniboxEditorTheme,
|
|
470
|
+
OmniboxEditorTranslations,
|
|
471
|
+
OmniboxEditorUpdatePayload,
|
|
472
|
+
TiptapJsonContent,
|
|
473
|
+
UploadFunction,
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## Production Checklist
|
|
478
|
+
|
|
479
|
+
- Import `@import-ai/omnibox-editor/style.css` once at the application entry.
|
|
480
|
+
- Save `onUpdate().json` as the canonical document value.
|
|
481
|
+
- Use `contentToMarkdown(content, { debug: false })` for Markdown export.
|
|
482
|
+
- Set `debug: false` in conversion helpers used by production code.
|
|
483
|
+
- Provide a real `imageUpload` implementation before enabling image uploads for users.
|
|
484
|
+
- Enforce file size, MIME type, authentication, authorization, and malware scanning on the upload API.
|
|
485
|
+
- Debounce autosave outside the editor if you persist on `onUpdate`.
|
|
486
|
+
- Use `editable={false}` for read-only views.
|
|
487
|
+
- Pass `linkBase` when rendering legacy Markdown with relative links or images.
|
|
488
|
+
- Keep collaboration state in Yjs when `collaboration` is enabled.
|
|
489
|
+
- Keep AI credentials and model calls on your server; never expose secrets in the browser.
|
|
490
|
+
|
|
491
|
+
## Browser and SSR Notes
|
|
492
|
+
|
|
493
|
+
`@import-ai/omnibox-editor` is a browser-facing React component. In SSR frameworks, render it only on the client.
|
|
494
|
+
|
|
495
|
+
Next.js example:
|
|
496
|
+
|
|
497
|
+
```tsx
|
|
498
|
+
"use client"
|
|
499
|
+
|
|
500
|
+
import { OmniboxEditor } from "@import-ai/omnibox-editor"
|
|
501
|
+
import "@import-ai/omnibox-editor/style.css"
|
|
502
|
+
|
|
503
|
+
export default function EditorPage() {
|
|
504
|
+
return <OmniboxEditor />
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## Local Development
|
|
509
|
+
|
|
510
|
+
From the repository root:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
pnpm install
|
|
514
|
+
pnpm --filter @import-ai/omnibox-editor test
|
|
515
|
+
pnpm --filter @import-ai/omnibox-editor build
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Create a local tarball:
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
pnpm --filter @import-ai/omnibox-editor pack:local
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
## License
|
|
525
|
+
|
|
526
|
+
MIT
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { PluginKey } from "@tiptap/pm/state";
|
|
3
|
+
import type { AiGenerationStatus } from "@/components/tiptap-ui/ai-composer/ai-generation-state";
|
|
4
|
+
import type { OmniboxEditorI18n } from "@/lib/i18n";
|
|
5
|
+
type AiGenerationWidgetState = {
|
|
6
|
+
pos: number | null;
|
|
7
|
+
status: AiGenerationStatus;
|
|
8
|
+
};
|
|
9
|
+
type AiGenerationWidgetMeta = {
|
|
10
|
+
type: "set";
|
|
11
|
+
pos: number;
|
|
12
|
+
status: Exclude<AiGenerationStatus, "idle">;
|
|
13
|
+
} | {
|
|
14
|
+
type: "clear";
|
|
15
|
+
};
|
|
16
|
+
type AiGenerationWidgetActions = {
|
|
17
|
+
labels?: Pick<OmniboxEditorI18n, "aiIsWriting" | "aiReviewPrompt" | "apply" | "discard" | "submitAiPrompt" | "stopAiGeneration" | "tryAgain">;
|
|
18
|
+
onApply?: () => void;
|
|
19
|
+
onDiscard?: () => void;
|
|
20
|
+
onRetry?: () => void;
|
|
21
|
+
onStop?: () => void;
|
|
22
|
+
onSubmitInstruction?: (instruction: string) => void;
|
|
23
|
+
};
|
|
24
|
+
declare module "@tiptap/core" {
|
|
25
|
+
interface Commands<ReturnType> {
|
|
26
|
+
aiGenerationWidget: {
|
|
27
|
+
clearAiGenerationWidget: () => ReturnType;
|
|
28
|
+
setAiGenerationWidget: (payload: {
|
|
29
|
+
pos: number;
|
|
30
|
+
status: Exclude<AiGenerationStatus, "idle">;
|
|
31
|
+
}) => ReturnType;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface Storage {
|
|
35
|
+
aiGenerationWidget: AiGenerationWidgetActions;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export declare const aiGenerationWidgetPluginKey: PluginKey<AiGenerationWidgetState>;
|
|
39
|
+
export declare function getMappedAiGenerationWidgetState(previousState: AiGenerationWidgetState, meta: AiGenerationWidgetMeta | undefined, mapPosition: (pos: number) => number): AiGenerationWidgetState;
|
|
40
|
+
export declare const AiGenerationWidget: Extension<AiGenerationWidgetActions, any>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { type EditorState } from "@tiptap/pm/state";
|
|
3
|
+
declare module "@tiptap/core" {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
indent: {
|
|
6
|
+
/**
|
|
7
|
+
* Increase the indent level of the selected blocks by 1.
|
|
8
|
+
* In lists, nests the list item under the previous sibling.
|
|
9
|
+
*/
|
|
10
|
+
indent: () => ReturnType;
|
|
11
|
+
/**
|
|
12
|
+
* Decrease the indent level of the selected blocks by 1.
|
|
13
|
+
* In lists, lifts the list item out of its parent.
|
|
14
|
+
*/
|
|
15
|
+
outdent: () => ReturnType;
|
|
16
|
+
/**
|
|
17
|
+
* Set the indent level of the selected blocks to a specific value.
|
|
18
|
+
*/
|
|
19
|
+
setIndent: (level: number) => ReturnType;
|
|
20
|
+
/**
|
|
21
|
+
* Remove indentation from the selected blocks.
|
|
22
|
+
*/
|
|
23
|
+
unsetIndent: () => ReturnType;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export interface IndentOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Block node types that support indentation.
|
|
30
|
+
* List items are handled separately via sinkListItem/liftListItem.
|
|
31
|
+
* @default ["paragraph", "heading", "blockquote"]
|
|
32
|
+
*/
|
|
33
|
+
types: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Node types that are treated as list items.
|
|
36
|
+
* When the cursor is inside one of these, indent/outdent delegates to
|
|
37
|
+
* sinkListItem/liftListItem instead of applying block-level indent.
|
|
38
|
+
* @default ["listItem", "taskItem"]
|
|
39
|
+
*/
|
|
40
|
+
listItemTypes: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Ancestor node types that should disable the Tab / Shift-Tab indent
|
|
43
|
+
* shortcut so the surrounding extension can handle Tab itself.
|
|
44
|
+
*
|
|
45
|
+
* Tables are the canonical example: ProseMirror's table plugin uses Tab to
|
|
46
|
+
* move the caret between cells. Without this opt-out, the Indent
|
|
47
|
+
* extension would consume Tab first and apply a paragraph indent inside
|
|
48
|
+
* the active cell instead of moving to the next cell.
|
|
49
|
+
*
|
|
50
|
+
* @default ["tableCell", "tableHeader"]
|
|
51
|
+
*/
|
|
52
|
+
bypassAncestors: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Minimum indent level.
|
|
55
|
+
* @default 0
|
|
56
|
+
*/
|
|
57
|
+
minLevel: number;
|
|
58
|
+
/**
|
|
59
|
+
* Maximum indent level.
|
|
60
|
+
* @default 8
|
|
61
|
+
*/
|
|
62
|
+
maxLevel: number;
|
|
63
|
+
/**
|
|
64
|
+
* Use inline style instead of data attribute.
|
|
65
|
+
* When false, only the `data-indent` attribute is set — use CSS to style indentation.
|
|
66
|
+
* When true, adds `style="margin-left: {level * indentUnit}px"` for immediate visual feedback.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
useStyle?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Pixels per indent level when useStyle is enabled.
|
|
72
|
+
* @default 24
|
|
73
|
+
*/
|
|
74
|
+
indentUnit: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse an indent level from an HTML element by checking:
|
|
78
|
+
* 1. Our own `data-indent` attribute (canonical source).
|
|
79
|
+
* 2. Common CSS properties used by external editors like Google Docs and Word
|
|
80
|
+
* (`margin-left`, `padding-left`, `text-indent`).
|
|
81
|
+
*
|
|
82
|
+
* Returns 0 when no indentation is detected.
|
|
83
|
+
*/
|
|
84
|
+
export declare function parseIndentLevel(element: HTMLElement, minLevel: number, maxLevel: number, indentUnit: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Walk up the document tree from the cursor and return the first list-item
|
|
87
|
+
* node name found, or `null` if the cursor is not inside a list.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getListItemName(state: EditorState, listItemTypes: Set<string>): string | null;
|
|
90
|
+
export declare const Indent: Extension<IndentOptions, any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
/**
|
|
3
|
+
* ListNormalization Extension
|
|
4
|
+
*
|
|
5
|
+
* This extension solves the "stuck vertical spacing" problem that occurs when working
|
|
6
|
+
* with lists in Tiptap editor.
|
|
7
|
+
*
|
|
8
|
+
* ## The Problem
|
|
9
|
+
*
|
|
10
|
+
* By default, Tiptap treats each list as a separate structural node. When a user
|
|
11
|
+
* presses Enter twice at the end of a list item, they exit the list and a new
|
|
12
|
+
* paragraph is created between two list blocks:
|
|
13
|
+
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <ul>
|
|
16
|
+
* <li>Task A</li>
|
|
17
|
+
* </ul>
|
|
18
|
+
*
|
|
19
|
+
* <p></p> <!-- Empty paragraph created on double-enter -->
|
|
20
|
+
*
|
|
21
|
+
* <ul>
|
|
22
|
+
* <li>Task B</li>
|
|
23
|
+
* </ul>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* When the user tries to backspace this empty paragraph, Tiptap deletes the paragraph
|
|
27
|
+
* but does NOT automatically merge the two <ul> blocks back into one list. This results
|
|
28
|
+
* in visual "stuck" vertical spacing that users cannot remove, which feels broken.
|
|
29
|
+
*/
|
|
30
|
+
export declare const ListNormalizationExtension: Extension<any, any>;
|