@dooherceg/tiptap-controlled-editor-with-table 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/README.md +63 -0
- package/dist/Combination-CO0ZtURs.js +1333 -0
- package/dist/assets/badge.css +1 -0
- package/dist/assets/button.css +1 -0
- package/dist/assets/card.css +1 -0
- package/dist/assets/color-highlight-button.css +1 -0
- package/dist/assets/dropdown-menu.css +1 -0
- package/dist/assets/image-upload-node.css +1 -0
- package/dist/assets/input.css +1 -0
- package/dist/assets/popover.css +1 -0
- package/dist/assets/separator.css +1 -0
- package/dist/assets/simple-editor.css +1 -0
- package/dist/assets/toolbar.css +1 -0
- package/dist/assets/tooltip.css +1 -0
- package/dist/components/tiptap-icons/add-table-column-after-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/add-table-column-after-icon.js +26 -0
- package/dist/components/tiptap-icons/add-table-column-before-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/add-table-column-before-icon.js +26 -0
- package/dist/components/tiptap-icons/add-table-row-after-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/add-table-row-after-icon.js +26 -0
- package/dist/components/tiptap-icons/add-table-row-before-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/add-table-row-before-icon.js +26 -0
- package/dist/components/tiptap-icons/align-center-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-center-icon.js +47 -0
- package/dist/components/tiptap-icons/align-justify-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/align-justify-icon.js +47 -0
- package/dist/components/tiptap-icons/align-left-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/align-left-icon.js +49 -0
- package/dist/components/tiptap-icons/align-right-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/align-right-icon.js +49 -0
- package/dist/components/tiptap-icons/arrow-left-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/arrow-left-icon.js +27 -0
- package/dist/components/tiptap-icons/ban-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/ban-icon.js +29 -0
- package/dist/components/tiptap-icons/blockquote-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/blockquote-icon.js +58 -0
- package/dist/components/tiptap-icons/bold-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/bold-icon.js +29 -0
- package/dist/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/chevron-down-icon.js +27 -0
- package/dist/components/tiptap-icons/close-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/close-icon.js +27 -0
- package/dist/components/tiptap-icons/code-block-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/code-block-icon.js +49 -0
- package/dist/components/tiptap-icons/code2-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/code2-icon.js +43 -0
- package/dist/components/tiptap-icons/corner-down-left-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/corner-down-left-icon.js +29 -0
- package/dist/components/tiptap-icons/delete-table-column-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/delete-table-column-icon.js +26 -0
- package/dist/components/tiptap-icons/delete-table-row-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/delete-table-row-icon.js +33 -0
- package/dist/components/tiptap-icons/external-link-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/external-link-icon.js +36 -0
- package/dist/components/tiptap-icons/heading-five-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-five-icon.js +36 -0
- package/dist/components/tiptap-icons/heading-four-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-four-icon.js +36 -0
- package/dist/components/tiptap-icons/heading-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-icon.js +27 -0
- package/dist/components/tiptap-icons/heading-one-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-one-icon.js +36 -0
- package/dist/components/tiptap-icons/heading-six-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-six-icon.js +38 -0
- package/dist/components/tiptap-icons/heading-three-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-three-icon.js +47 -0
- package/dist/components/tiptap-icons/heading-two-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/heading-two-icon.js +36 -0
- package/dist/components/tiptap-icons/highlighter-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/highlighter-icon.js +29 -0
- package/dist/components/tiptap-icons/image-plus-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/image-plus-icon.js +29 -0
- package/dist/components/tiptap-icons/italic-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/italic-icon.js +27 -0
- package/dist/components/tiptap-icons/link-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/link-icon.js +36 -0
- package/dist/components/tiptap-icons/list-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/list-icon.js +76 -0
- package/dist/components/tiptap-icons/list-ordered-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/list-ordered-icon.js +76 -0
- package/dist/components/tiptap-icons/list-todo-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/list-todo-icon.js +67 -0
- package/dist/components/tiptap-icons/merge-table-cells-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/merge-table-cells-icon.js +26 -0
- package/dist/components/tiptap-icons/moon-star-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/moon-star-icon.js +38 -0
- package/dist/components/tiptap-icons/redo2-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/redo2-icon.js +29 -0
- package/dist/components/tiptap-icons/remove-table-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/remove-table-icon.js +26 -0
- package/dist/components/tiptap-icons/split-table-cells-icon copy.d.ts +1 -0
- package/dist/components/tiptap-icons/split-table-cells-icon copy.js +30 -0
- package/dist/components/tiptap-icons/strike-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/strike-icon.js +36 -0
- package/dist/components/tiptap-icons/subscript-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/subscript-icon.js +49 -0
- package/dist/components/tiptap-icons/sun-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/sun-icon.js +87 -0
- package/dist/components/tiptap-icons/superscript-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/superscript-icon.js +49 -0
- package/dist/components/tiptap-icons/table-icon.d.ts +3 -0
- package/dist/components/tiptap-icons/table-icon.js +24 -0
- package/dist/components/tiptap-icons/trash-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/trash-icon.js +29 -0
- package/dist/components/tiptap-icons/underline-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/underline-icon.js +29 -0
- package/dist/components/tiptap-icons/undo2-icon.d.ts +1 -0
- package/dist/components/tiptap-icons/undo2-icon.js +29 -0
- package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
- package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +67 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +58 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node-extension.js +77 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node.d.ts +68 -0
- package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +329 -0
- package/dist/components/tiptap-node/image-upload-node/index.d.ts +1 -0
- package/dist/components/tiptap-node/image-upload-node/index.js +4 -0
- package/dist/components/tiptap-templates/simple/simple-editor.d.ts +8 -0
- package/dist/components/tiptap-templates/simple/simple-editor.js +1956 -0
- package/dist/components/tiptap-templates/simple/theme-toggle.d.ts +1 -0
- package/dist/components/tiptap-templates/simple/theme-toggle.js +28 -0
- package/dist/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
- package/dist/components/tiptap-ui/blockquote-button/blockquote-button.js +71 -0
- package/dist/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/blockquote-button/index.js +11 -0
- package/dist/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
- package/dist/components/tiptap-ui/blockquote-button/use-blockquote.js +82 -0
- package/dist/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
- package/dist/components/tiptap-ui/code-block-button/code-block-button.js +71 -0
- package/dist/components/tiptap-ui/code-block-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/code-block-button/index.js +11 -0
- package/dist/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
- package/dist/components/tiptap-ui/code-block-button/use-code-block.js +83 -0
- package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +45 -0
- package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +89 -0
- package/dist/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/color-highlight-button/index.js +14 -0
- package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +82 -0
- package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +176 -0
- package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +25 -0
- package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +136 -0
- package/dist/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
- package/dist/components/tiptap-ui/color-highlight-popover/index.js +6 -0
- package/dist/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
- package/dist/components/tiptap-ui/heading-button/heading-button.js +74 -0
- package/dist/components/tiptap-ui/heading-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/heading-button/index.js +13 -0
- package/dist/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
- package/dist/components/tiptap-ui/heading-button/use-heading.js +112 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +20 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.js +67 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/index.js +7 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
- package/dist/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.js +38 -0
- package/dist/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
- package/dist/components/tiptap-ui/image-upload-button/image-upload-button.js +72 -0
- package/dist/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/image-upload-button/index.js +12 -0
- package/dist/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
- package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +76 -0
- package/dist/components/tiptap-ui/insert-table-button/insert-table-button.d.ts +4 -0
- package/dist/components/tiptap-ui/insert-table-button/insert-table-button.js +41 -0
- package/dist/components/tiptap-ui/link-popover/index.d.ts +2 -0
- package/dist/components/tiptap-ui/link-popover/index.js +13 -0
- package/dist/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
- package/dist/components/tiptap-ui/link-popover/link-popover.js +193 -0
- package/dist/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
- package/dist/components/tiptap-ui/link-popover/use-link-popover.js +103 -0
- package/dist/components/tiptap-ui/list-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/list-button/index.js +14 -0
- package/dist/components/tiptap-ui/list-button/list-button.d.ts +23 -0
- package/dist/components/tiptap-ui/list-button/list-button.js +74 -0
- package/dist/components/tiptap-ui/list-button/use-list.d.ts +97 -0
- package/dist/components/tiptap-ui/list-button/use-list.js +149 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/index.js +4 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +29 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.js +63 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +90 -0
- package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +84 -0
- package/dist/components/tiptap-ui/mark-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/mark-button/index.js +14 -0
- package/dist/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
- package/dist/components/tiptap-ui/mark-button/mark-button.js +74 -0
- package/dist/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
- package/dist/components/tiptap-ui/mark-button/use-mark.js +84 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-column-after-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-column-after-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-column-before-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-column-before-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-row-after-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-row-after-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-row-before-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/add-row-before-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/delete-column-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/delete-column-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/delete-row-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/delete-row-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/get-table-node-and-pos.d.ts +6 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/get-table-node-and-pos.js +15 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/merge-cells-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/merge-cells-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/remove-table-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/remove-table-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/split-table-cells-button.d.ts +4 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/split-table-cells-button.js +7 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.d.ts +2 -0
- package/dist/components/tiptap-ui/table-actions-toolbar/table-actions-toolbar.js +75 -0
- package/dist/components/tiptap-ui/text-align-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/text-align-button/index.js +15 -0
- package/dist/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
- package/dist/components/tiptap-ui/text-align-button/text-align-button.js +81 -0
- package/dist/components/tiptap-ui/text-align-button/use-text-align.d.ts +101 -0
- package/dist/components/tiptap-ui/text-align-button/use-text-align.js +84 -0
- package/dist/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
- package/dist/components/tiptap-ui/undo-redo-button/index.js +13 -0
- package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
- package/dist/components/tiptap-ui/undo-redo-button/undo-redo-button.js +70 -0
- package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
- package/dist/components/tiptap-ui/undo-redo-button/use-undo-redo.js +67 -0
- package/dist/components/tiptap-ui-primitive/badge/badge.d.ts +8 -0
- package/dist/components/tiptap-ui-primitive/badge/badge.js +30 -0
- package/dist/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/badge/index.js +4 -0
- package/dist/components/tiptap-ui-primitive/button/button.d.ts +14 -0
- package/dist/components/tiptap-ui-primitive/button/button.js +69 -0
- package/dist/components/tiptap-ui-primitive/button/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/button/index.js +6 -0
- package/dist/components/tiptap-ui-primitive/card/card.d.ts +9 -0
- package/dist/components/tiptap-ui-primitive/card/card.js +62 -0
- package/dist/components/tiptap-ui-primitive/card/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/card/index.js +9 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +16 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +1028 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/dropdown-menu/index.js +13 -0
- package/dist/components/tiptap-ui-primitive/input/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/input/index.js +5 -0
- package/dist/components/tiptap-ui-primitive/input/input.d.ts +3 -0
- package/dist/components/tiptap-ui-primitive/input/input.js +16 -0
- package/dist/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/popover/index.js +6 -0
- package/dist/components/tiptap-ui-primitive/popover/popover.d.ts +5 -0
- package/dist/components/tiptap-ui-primitive/popover/popover.js +244 -0
- package/dist/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/separator/index.js +4 -0
- package/dist/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
- package/dist/components/tiptap-ui-primitive/separator/separator.js +22 -0
- package/dist/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/spacer/index.js +4 -0
- package/dist/components/tiptap-ui-primitive/spacer/spacer.d.ts +6 -0
- package/dist/components/tiptap-ui-primitive/spacer/spacer.js +20 -0
- package/dist/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/toolbar/index.js +6 -0
- package/dist/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +8 -0
- package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +83 -0
- package/dist/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
- package/dist/components/tiptap-ui-primitive/tooltip/index.js +6 -0
- package/dist/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +28 -0
- package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +1374 -0
- package/dist/floating-ui.react-dom-DgOuULHo.js +1334 -0
- package/dist/hooks/use-composed-ref.d.ts +3 -0
- package/dist/hooks/use-composed-ref.js +16 -0
- package/dist/hooks/use-cursor-visibility.d.ts +20 -0
- package/dist/hooks/use-cursor-visibility.js +31 -0
- package/dist/hooks/use-element-rect.d.ts +35 -0
- package/dist/hooks/use-element-rect.js +79 -0
- package/dist/hooks/use-menu-navigation.d.ts +52 -0
- package/dist/hooks/use-menu-navigation.js +68 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +13 -0
- package/dist/hooks/use-scrolling.d.ts +8 -0
- package/dist/hooks/use-scrolling.js +17 -0
- package/dist/hooks/use-throttled-callback.d.ts +18 -0
- package/dist/hooks/use-throttled-callback.js +116 -0
- package/dist/hooks/use-tiptap-editor.d.ts +17 -0
- package/dist/hooks/use-tiptap-editor.js +25 -0
- package/dist/hooks/use-unmount.d.ts +7 -0
- package/dist/hooks/use-unmount.js +14 -0
- package/dist/hooks/use-window-size.d.ts +35 -0
- package/dist/hooks/use-window-size.js +33 -0
- package/dist/index-Bqw9S4qP.js +238 -0
- package/dist/lib/tiptap-utils.d.ts +160 -0
- package/dist/lib/tiptap-utils.js +229 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +4 -0
- package/package.json +67 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ChainedCommands, Editor } from '@tiptap/react';
|
|
2
|
+
export type TextAlign = "left" | "center" | "right" | "justify";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the text align functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTextAlignConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Tiptap editor instance.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* The text alignment to apply.
|
|
13
|
+
*/
|
|
14
|
+
align: TextAlign;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the button should hide when alignment is not available.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hideWhenUnavailable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Callback function called after a successful alignment change.
|
|
22
|
+
*/
|
|
23
|
+
onAligned?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const TEXT_ALIGN_SHORTCUT_KEYS: Record<TextAlign, string>;
|
|
26
|
+
export declare const textAlignIcons: {
|
|
27
|
+
left: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
|
|
28
|
+
center: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
right: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
|
|
30
|
+
justify: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react/jsx-runtime").JSX.Element>;
|
|
31
|
+
};
|
|
32
|
+
export declare const textAlignLabels: Record<TextAlign, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if text alignment can be performed in the current editor state
|
|
35
|
+
*/
|
|
36
|
+
export declare function canSetTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
37
|
+
export declare function hasSetTextAlign(commands: ChainedCommands): commands is ChainedCommands & {
|
|
38
|
+
setTextAlign: (align: TextAlign) => ChainedCommands;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Checks if the text alignment is currently active
|
|
42
|
+
*/
|
|
43
|
+
export declare function isTextAlignActive(editor: Editor | null, align: TextAlign): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Sets text alignment in the editor
|
|
46
|
+
*/
|
|
47
|
+
export declare function setTextAlign(editor: Editor | null, align: TextAlign): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Determines if the text align button should be shown
|
|
50
|
+
*/
|
|
51
|
+
export declare function shouldShowButton(props: {
|
|
52
|
+
editor: Editor | null;
|
|
53
|
+
hideWhenUnavailable: boolean;
|
|
54
|
+
align: TextAlign;
|
|
55
|
+
}): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Custom hook that provides text align functionality for Tiptap editor
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Simple usage
|
|
62
|
+
* function MySimpleAlignButton() {
|
|
63
|
+
* const { isVisible, handleTextAlign } = useTextAlign({ align: "center" })
|
|
64
|
+
*
|
|
65
|
+
* if (!isVisible) return null
|
|
66
|
+
*
|
|
67
|
+
* return <button onClick={handleTextAlign}>Align Center</button>
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // Advanced usage with configuration
|
|
71
|
+
* function MyAdvancedAlignButton() {
|
|
72
|
+
* const { isVisible, handleTextAlign, label, isActive } = useTextAlign({
|
|
73
|
+
* editor: myEditor,
|
|
74
|
+
* align: "right",
|
|
75
|
+
* hideWhenUnavailable: true,
|
|
76
|
+
* onAligned: () => console.log('Text aligned!')
|
|
77
|
+
* })
|
|
78
|
+
*
|
|
79
|
+
* if (!isVisible) return null
|
|
80
|
+
*
|
|
81
|
+
* return (
|
|
82
|
+
* <MyButton
|
|
83
|
+
* onClick={handleTextAlign}
|
|
84
|
+
* aria-pressed={isActive}
|
|
85
|
+
* aria-label={label}
|
|
86
|
+
* >
|
|
87
|
+
* Align Right
|
|
88
|
+
* </MyButton>
|
|
89
|
+
* )
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function useTextAlign(config: UseTextAlignConfig): {
|
|
94
|
+
isVisible: boolean;
|
|
95
|
+
isActive: boolean;
|
|
96
|
+
handleTextAlign: () => boolean;
|
|
97
|
+
canAlign: boolean;
|
|
98
|
+
label: string;
|
|
99
|
+
shortcutKeys: string;
|
|
100
|
+
Icon: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react/jsx-runtime").JSX.Element>;
|
|
101
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useState as h, useEffect as m, useCallback as d } from "react";
|
|
2
|
+
import "@tiptap/react";
|
|
3
|
+
import { useTiptapEditor as p } from "../../../hooks/use-tiptap-editor.js";
|
|
4
|
+
import { isExtensionAvailable as f, isNodeTypeSelected as x } from "../../../lib/tiptap-utils.js";
|
|
5
|
+
import { AlignCenterIcon as T } from "../../tiptap-icons/align-center-icon.js";
|
|
6
|
+
import { AlignJustifyIcon as b } from "../../tiptap-icons/align-justify-icon.js";
|
|
7
|
+
import { AlignLeftIcon as E } from "../../tiptap-icons/align-left-icon.js";
|
|
8
|
+
import { AlignRightIcon as v } from "../../tiptap-icons/align-right-icon.js";
|
|
9
|
+
const I = {
|
|
10
|
+
left: "mod+shift+l",
|
|
11
|
+
center: "mod+shift+e",
|
|
12
|
+
right: "mod+shift+r",
|
|
13
|
+
justify: "mod+shift+j"
|
|
14
|
+
}, S = {
|
|
15
|
+
left: E,
|
|
16
|
+
center: T,
|
|
17
|
+
right: v,
|
|
18
|
+
justify: b
|
|
19
|
+
}, y = {
|
|
20
|
+
left: "Align left",
|
|
21
|
+
center: "Align center",
|
|
22
|
+
right: "Align right",
|
|
23
|
+
justify: "Align justify"
|
|
24
|
+
};
|
|
25
|
+
function r(t, e) {
|
|
26
|
+
return !t || !t.isEditable || !f(t, "textAlign") || x(t, ["image", "horizontalRule"]) ? !1 : t.can().setTextAlign(e);
|
|
27
|
+
}
|
|
28
|
+
function U(t) {
|
|
29
|
+
return "setTextAlign" in t;
|
|
30
|
+
}
|
|
31
|
+
function j(t, e) {
|
|
32
|
+
return !t || !t.isEditable ? !1 : t.isActive({ textAlign: e });
|
|
33
|
+
}
|
|
34
|
+
function C(t, e) {
|
|
35
|
+
if (!t || !t.isEditable || !r(t, e)) return !1;
|
|
36
|
+
const n = t.chain().focus();
|
|
37
|
+
return U(n) ? n.setTextAlign(e).run() : !1;
|
|
38
|
+
}
|
|
39
|
+
function L(t) {
|
|
40
|
+
const { editor: e, hideWhenUnavailable: n, align: l } = t;
|
|
41
|
+
return !e || !e.isEditable || !f(e, "textAlign") ? !1 : n && !e.isActive("code") ? r(e, l) : !0;
|
|
42
|
+
}
|
|
43
|
+
function z(t) {
|
|
44
|
+
const {
|
|
45
|
+
editor: e,
|
|
46
|
+
align: n,
|
|
47
|
+
hideWhenUnavailable: l = !1,
|
|
48
|
+
onAligned: o
|
|
49
|
+
} = t, { editor: i } = p(e), [c, u] = h(!0), a = r(i, n), g = j(i, n);
|
|
50
|
+
m(() => {
|
|
51
|
+
if (!i) return;
|
|
52
|
+
const s = () => {
|
|
53
|
+
u(L({ editor: i, align: n, hideWhenUnavailable: l }));
|
|
54
|
+
};
|
|
55
|
+
return s(), i.on("selectionUpdate", s), () => {
|
|
56
|
+
i.off("selectionUpdate", s);
|
|
57
|
+
};
|
|
58
|
+
}, [i, l, n]);
|
|
59
|
+
const A = d(() => {
|
|
60
|
+
if (!i) return !1;
|
|
61
|
+
const s = C(i, n);
|
|
62
|
+
return s && o?.(), s;
|
|
63
|
+
}, [i, n, o]);
|
|
64
|
+
return {
|
|
65
|
+
isVisible: c,
|
|
66
|
+
isActive: g,
|
|
67
|
+
handleTextAlign: A,
|
|
68
|
+
canAlign: a,
|
|
69
|
+
label: y[n],
|
|
70
|
+
shortcutKeys: I[n],
|
|
71
|
+
Icon: S[n]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
I as TEXT_ALIGN_SHORTCUT_KEYS,
|
|
76
|
+
r as canSetTextAlign,
|
|
77
|
+
U as hasSetTextAlign,
|
|
78
|
+
j as isTextAlignActive,
|
|
79
|
+
C as setTextAlign,
|
|
80
|
+
L as shouldShowButton,
|
|
81
|
+
S as textAlignIcons,
|
|
82
|
+
y as textAlignLabels,
|
|
83
|
+
z as useTextAlign
|
|
84
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HistoryShortcutBadge as e, UndoRedoButton as n } from "./undo-redo-button.js";
|
|
2
|
+
import { UNDO_REDO_SHORTCUT_KEYS as c, canExecuteUndoRedoAction as r, executeUndoRedoAction as s, historyActionLabels as u, historyIcons as i, shouldShowButton as R, useUndoRedo as U } from "./use-undo-redo.js";
|
|
3
|
+
export {
|
|
4
|
+
e as HistoryShortcutBadge,
|
|
5
|
+
c as UNDO_REDO_SHORTCUT_KEYS,
|
|
6
|
+
n as UndoRedoButton,
|
|
7
|
+
r as canExecuteUndoRedoAction,
|
|
8
|
+
s as executeUndoRedoAction,
|
|
9
|
+
u as historyActionLabels,
|
|
10
|
+
i as historyIcons,
|
|
11
|
+
R as shouldShowButton,
|
|
12
|
+
U as useUndoRedo
|
|
13
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UndoRedoAction, UseUndoRedoConfig } from '.';
|
|
2
|
+
import { ButtonProps } from '../../tiptap-ui-primitive/button';
|
|
3
|
+
export interface UndoRedoButtonProps extends Omit<ButtonProps, "type">, UseUndoRedoConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional show shortcut keys in the button.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
showShortcut?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function HistoryShortcutBadge({ action, shortcutKeys, }: {
|
|
15
|
+
action: UndoRedoAction;
|
|
16
|
+
shortcutKeys?: string;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Button component for triggering undo/redo actions in a Tiptap editor.
|
|
20
|
+
*
|
|
21
|
+
* For custom button implementations, use the `useHistory` hook instead.
|
|
22
|
+
*/
|
|
23
|
+
export declare const UndoRedoButton: import('react').ForwardRefExoticComponent<UndoRedoButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as t, jsxs as B, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, useCallback as E } from "react";
|
|
3
|
+
import { parseShortcutKeys as N } from "../../../lib/tiptap-utils.js";
|
|
4
|
+
import { useTiptapEditor as S } from "../../../hooks/use-tiptap-editor.js";
|
|
5
|
+
import { useUndoRedo as C, UNDO_REDO_SHORTCUT_KEYS as K } from "./use-undo-redo.js";
|
|
6
|
+
import { Button as O } from "../../tiptap-ui-primitive/button/button.js";
|
|
7
|
+
import { Badge as T } from "../../tiptap-ui-primitive/badge/badge.js";
|
|
8
|
+
function _({
|
|
9
|
+
action: e,
|
|
10
|
+
shortcutKeys: o = K[e]
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ t(T, { children: N({ shortcutKeys: o }) });
|
|
13
|
+
}
|
|
14
|
+
const j = g(
|
|
15
|
+
({
|
|
16
|
+
editor: e,
|
|
17
|
+
action: o,
|
|
18
|
+
text: r,
|
|
19
|
+
hideWhenUnavailable: l = !1,
|
|
20
|
+
onExecuted: u,
|
|
21
|
+
showShortcut: c = !1,
|
|
22
|
+
onClick: a,
|
|
23
|
+
children: p,
|
|
24
|
+
...m
|
|
25
|
+
}, f) => {
|
|
26
|
+
const { editor: b } = S(e), { isVisible: h, handleAction: n, label: i, canExecute: s, Icon: y, shortcutKeys: R } = C({
|
|
27
|
+
editor: b,
|
|
28
|
+
action: o,
|
|
29
|
+
hideWhenUnavailable: l,
|
|
30
|
+
onExecuted: u
|
|
31
|
+
}), x = E(
|
|
32
|
+
(d) => {
|
|
33
|
+
a?.(d), !d.defaultPrevented && n();
|
|
34
|
+
},
|
|
35
|
+
[n, a]
|
|
36
|
+
);
|
|
37
|
+
return h ? /* @__PURE__ */ t(
|
|
38
|
+
O,
|
|
39
|
+
{
|
|
40
|
+
type: "button",
|
|
41
|
+
disabled: !s,
|
|
42
|
+
"data-style": "ghost",
|
|
43
|
+
"data-disabled": !s,
|
|
44
|
+
role: "button",
|
|
45
|
+
tabIndex: -1,
|
|
46
|
+
"aria-label": i,
|
|
47
|
+
tooltip: i,
|
|
48
|
+
onClick: x,
|
|
49
|
+
...m,
|
|
50
|
+
ref: f,
|
|
51
|
+
children: p ?? /* @__PURE__ */ B(U, { children: [
|
|
52
|
+
/* @__PURE__ */ t(y, { className: "tiptap-button-icon" }),
|
|
53
|
+
r && /* @__PURE__ */ t("span", { className: "tiptap-button-text", children: r }),
|
|
54
|
+
c && /* @__PURE__ */ t(
|
|
55
|
+
_,
|
|
56
|
+
{
|
|
57
|
+
action: o,
|
|
58
|
+
shortcutKeys: R
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] })
|
|
62
|
+
}
|
|
63
|
+
) : null;
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
j.displayName = "UndoRedoButton";
|
|
67
|
+
export {
|
|
68
|
+
_ as HistoryShortcutBadge,
|
|
69
|
+
j as UndoRedoButton
|
|
70
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
export type UndoRedoAction = "undo" | "redo";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the history functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseUndoRedoConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Tiptap editor instance.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* The history action to perform (undo or redo).
|
|
13
|
+
*/
|
|
14
|
+
action: UndoRedoAction;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the button should hide when action is not available.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
hideWhenUnavailable?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Callback function called after a successful action execution.
|
|
22
|
+
*/
|
|
23
|
+
onExecuted?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const UNDO_REDO_SHORTCUT_KEYS: Record<UndoRedoAction, string>;
|
|
26
|
+
export declare const historyActionLabels: Record<UndoRedoAction, string>;
|
|
27
|
+
export declare const historyIcons: {
|
|
28
|
+
undo: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
|
|
29
|
+
redo: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a history action can be executed
|
|
33
|
+
*/
|
|
34
|
+
export declare function canExecuteUndoRedoAction(editor: Editor | null, action: UndoRedoAction): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Executes a history action on the editor
|
|
37
|
+
*/
|
|
38
|
+
export declare function executeUndoRedoAction(editor: Editor | null, action: UndoRedoAction): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Determines if the history button should be shown
|
|
41
|
+
*/
|
|
42
|
+
export declare function shouldShowButton(props: {
|
|
43
|
+
editor: Editor | null;
|
|
44
|
+
hideWhenUnavailable: boolean;
|
|
45
|
+
action: UndoRedoAction;
|
|
46
|
+
}): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Custom hook that provides history functionality for Tiptap editor
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Simple usage
|
|
53
|
+
* function MySimpleUndoButton() {
|
|
54
|
+
* const { isVisible, handleAction } = useHistory({ action: "undo" })
|
|
55
|
+
*
|
|
56
|
+
* if (!isVisible) return null
|
|
57
|
+
*
|
|
58
|
+
* return <button onClick={handleAction}>Undo</button>
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* // Advanced usage with configuration
|
|
62
|
+
* function MyAdvancedRedoButton() {
|
|
63
|
+
* const { isVisible, handleAction, label } = useHistory({
|
|
64
|
+
* editor: myEditor,
|
|
65
|
+
* action: "redo",
|
|
66
|
+
* hideWhenUnavailable: true,
|
|
67
|
+
* onExecuted: () => console.log('Action executed!')
|
|
68
|
+
* })
|
|
69
|
+
*
|
|
70
|
+
* if (!isVisible) return null
|
|
71
|
+
*
|
|
72
|
+
* return (
|
|
73
|
+
* <MyButton
|
|
74
|
+
* onClick={handleAction}
|
|
75
|
+
* aria-label={label}
|
|
76
|
+
* >
|
|
77
|
+
* Redo
|
|
78
|
+
* </MyButton>
|
|
79
|
+
* )
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function useUndoRedo(config: UseUndoRedoConfig): {
|
|
84
|
+
isVisible: boolean;
|
|
85
|
+
handleAction: () => boolean;
|
|
86
|
+
canExecute: boolean;
|
|
87
|
+
label: string;
|
|
88
|
+
shortcutKeys: string;
|
|
89
|
+
Icon: import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element> | import('react').MemoExoticComponent<({ className, ...props }: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element>;
|
|
90
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useState as l, useEffect as h, useCallback as m } from "react";
|
|
2
|
+
import "@tiptap/react";
|
|
3
|
+
import { useTiptapEditor as p } from "../../../hooks/use-tiptap-editor.js";
|
|
4
|
+
import { isNodeTypeSelected as E } from "../../../lib/tiptap-utils.js";
|
|
5
|
+
import { Redo2Icon as b } from "../../tiptap-icons/redo2-icon.js";
|
|
6
|
+
import { Undo2Icon as U } from "../../tiptap-icons/undo2-icon.js";
|
|
7
|
+
const R = {
|
|
8
|
+
undo: "mod+z",
|
|
9
|
+
redo: "mod+shift+z"
|
|
10
|
+
}, x = {
|
|
11
|
+
undo: "Undo",
|
|
12
|
+
redo: "Redo"
|
|
13
|
+
}, A = {
|
|
14
|
+
undo: U,
|
|
15
|
+
redo: b
|
|
16
|
+
};
|
|
17
|
+
function s(n, o) {
|
|
18
|
+
return !n || !n.isEditable || E(n, ["image"]) ? !1 : o === "undo" ? n.can().undo() : n.can().redo();
|
|
19
|
+
}
|
|
20
|
+
function I(n, o) {
|
|
21
|
+
if (!n || !n.isEditable || !s(n, o)) return !1;
|
|
22
|
+
const e = n.chain().focus();
|
|
23
|
+
return o === "undo" ? e.undo().run() : e.redo().run();
|
|
24
|
+
}
|
|
25
|
+
function S(n) {
|
|
26
|
+
const { editor: o, hideWhenUnavailable: e, action: i } = n;
|
|
27
|
+
return !o || !o.isEditable ? !1 : e && !o.isActive("code") ? s(o, i) : !0;
|
|
28
|
+
}
|
|
29
|
+
function C(n) {
|
|
30
|
+
const {
|
|
31
|
+
editor: o,
|
|
32
|
+
action: e,
|
|
33
|
+
hideWhenUnavailable: i = !1,
|
|
34
|
+
onExecuted: c
|
|
35
|
+
} = n, { editor: t } = p(o), [u, a] = l(!0), d = s(t, e);
|
|
36
|
+
h(() => {
|
|
37
|
+
if (!t) return;
|
|
38
|
+
const r = () => {
|
|
39
|
+
a(S({ editor: t, hideWhenUnavailable: i, action: e }));
|
|
40
|
+
};
|
|
41
|
+
return r(), t.on("transaction", r), () => {
|
|
42
|
+
t.off("transaction", r);
|
|
43
|
+
};
|
|
44
|
+
}, [t, i, e]);
|
|
45
|
+
const f = m(() => {
|
|
46
|
+
if (!t) return !1;
|
|
47
|
+
const r = I(t, e);
|
|
48
|
+
return r && c?.(), r;
|
|
49
|
+
}, [t, e, c]);
|
|
50
|
+
return {
|
|
51
|
+
isVisible: u,
|
|
52
|
+
handleAction: f,
|
|
53
|
+
canExecute: d,
|
|
54
|
+
label: x[e],
|
|
55
|
+
shortcutKeys: R[e],
|
|
56
|
+
Icon: A[e]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
R as UNDO_REDO_SHORTCUT_KEYS,
|
|
61
|
+
s as canExecuteUndoRedoAction,
|
|
62
|
+
I as executeUndoRedoAction,
|
|
63
|
+
x as historyActionLabels,
|
|
64
|
+
A as historyIcons,
|
|
65
|
+
S as shouldShowButton,
|
|
66
|
+
C as useUndoRedo
|
|
67
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
variant?: "ghost" | "white" | "gray" | "green" | "default";
|
|
3
|
+
size?: "default" | "small";
|
|
4
|
+
appearance?: "default" | "subdued" | "emphasized";
|
|
5
|
+
trimText?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Badge: import('react').ForwardRefExoticComponent<BadgeProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default Badge;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as i } from "react";
|
|
3
|
+
import '../../../assets/badge.css';const l = i(
|
|
4
|
+
({
|
|
5
|
+
variant: a,
|
|
6
|
+
size: t = "default",
|
|
7
|
+
appearance: e = "default",
|
|
8
|
+
trimText: d = !1,
|
|
9
|
+
className: r,
|
|
10
|
+
children: f,
|
|
11
|
+
...o
|
|
12
|
+
}, s) => /* @__PURE__ */ p(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
ref: s,
|
|
16
|
+
className: `tiptap-badge ${r || ""}`,
|
|
17
|
+
"data-style": a,
|
|
18
|
+
"data-size": t,
|
|
19
|
+
"data-appearance": e,
|
|
20
|
+
"data-text-trim": d ? "on" : "off",
|
|
21
|
+
...o,
|
|
22
|
+
children: f
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
l.displayName = "Badge";
|
|
27
|
+
export {
|
|
28
|
+
l as Badge,
|
|
29
|
+
l as default
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './badge';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
className?: string;
|
|
3
|
+
showTooltip?: boolean;
|
|
4
|
+
tooltip?: React.ReactNode;
|
|
5
|
+
shortcutKeys?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ShortcutDisplay: React.FC<{
|
|
8
|
+
shortcuts: string[];
|
|
9
|
+
}>;
|
|
10
|
+
export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export declare const ButtonGroup: import('react').ForwardRefExoticComponent<Omit<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & {
|
|
12
|
+
orientation?: "horizontal" | "vertical";
|
|
13
|
+
}, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default Button;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as o, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s, useMemo as d, Fragment as b } from "react";
|
|
3
|
+
import { parseShortcutKeys as f, cn as l } from "../../../lib/tiptap-utils.js";
|
|
4
|
+
import { Tooltip as h, TooltipTrigger as g, TooltipContent as y } from "../tooltip/tooltip.js";
|
|
5
|
+
import '../../../assets/button.css';const B = ({
|
|
6
|
+
shortcuts: t
|
|
7
|
+
}) => t.length === 0 ? null : /* @__PURE__ */ o("div", { children: t.map((a, r) => /* @__PURE__ */ i(b, { children: [
|
|
8
|
+
r > 0 && /* @__PURE__ */ o("kbd", { children: "+" }),
|
|
9
|
+
/* @__PURE__ */ o("kbd", { children: a })
|
|
10
|
+
] }, r)) }), N = s(
|
|
11
|
+
({
|
|
12
|
+
className: t,
|
|
13
|
+
children: a,
|
|
14
|
+
tooltip: r,
|
|
15
|
+
showTooltip: n = !0,
|
|
16
|
+
shortcutKeys: e,
|
|
17
|
+
"aria-label": u,
|
|
18
|
+
...p
|
|
19
|
+
}, m) => {
|
|
20
|
+
const c = d(
|
|
21
|
+
() => f({ shortcutKeys: e }),
|
|
22
|
+
[e]
|
|
23
|
+
);
|
|
24
|
+
return !r || !n ? /* @__PURE__ */ o(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
className: l("tiptap-button", t),
|
|
28
|
+
ref: m,
|
|
29
|
+
"aria-label": u,
|
|
30
|
+
...p,
|
|
31
|
+
children: a
|
|
32
|
+
}
|
|
33
|
+
) : /* @__PURE__ */ i(h, { delay: 200, children: [
|
|
34
|
+
/* @__PURE__ */ o(
|
|
35
|
+
g,
|
|
36
|
+
{
|
|
37
|
+
className: l("tiptap-button", t),
|
|
38
|
+
ref: m,
|
|
39
|
+
"aria-label": u,
|
|
40
|
+
...p,
|
|
41
|
+
children: a
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ i(y, { children: [
|
|
45
|
+
r,
|
|
46
|
+
/* @__PURE__ */ o(B, { shortcuts: c })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
N.displayName = "Button";
|
|
52
|
+
const T = s(({ className: t, children: a, orientation: r = "vertical", ...n }, e) => /* @__PURE__ */ o(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
ref: e,
|
|
56
|
+
className: l("tiptap-button-group", t),
|
|
57
|
+
"data-orientation": r,
|
|
58
|
+
role: "group",
|
|
59
|
+
...n,
|
|
60
|
+
children: a
|
|
61
|
+
}
|
|
62
|
+
));
|
|
63
|
+
T.displayName = "ButtonGroup";
|
|
64
|
+
export {
|
|
65
|
+
N as Button,
|
|
66
|
+
T as ButtonGroup,
|
|
67
|
+
B as ShortcutDisplay,
|
|
68
|
+
N as default
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const Card: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
2
|
+
declare const CardHeader: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardBody: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardItemGroup: import('react').ForwardRefExoticComponent<Omit<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
6
|
+
}, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardGroupLabel: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const CardFooter: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardBody, CardItemGroup, CardGroupLabel };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as e } from "react";
|
|
3
|
+
import { cn as o } from "../../../lib/tiptap-utils.js";
|
|
4
|
+
import '../../../assets/card.css';const i = e(
|
|
5
|
+
({ className: a, ...r }, d) => /* @__PURE__ */ t("div", { ref: d, className: o("tiptap-card", a), ...r })
|
|
6
|
+
);
|
|
7
|
+
i.displayName = "Card";
|
|
8
|
+
const s = e(
|
|
9
|
+
({ className: a, ...r }, d) => /* @__PURE__ */ t(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
ref: d,
|
|
13
|
+
className: o("tiptap-card-header", a),
|
|
14
|
+
...r
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
s.displayName = "CardHeader";
|
|
19
|
+
const m = e(
|
|
20
|
+
({ className: a, ...r }, d) => /* @__PURE__ */ t("div", { ref: d, className: o("tiptap-card-body", a), ...r })
|
|
21
|
+
);
|
|
22
|
+
m.displayName = "CardBody";
|
|
23
|
+
const c = e(({ className: a, orientation: r = "vertical", ...d }, p) => /* @__PURE__ */ t(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
ref: p,
|
|
27
|
+
"data-orientation": r,
|
|
28
|
+
className: o("tiptap-card-item-group", a),
|
|
29
|
+
...d
|
|
30
|
+
}
|
|
31
|
+
));
|
|
32
|
+
c.displayName = "CardItemGroup";
|
|
33
|
+
const l = e(
|
|
34
|
+
({ className: a, ...r }, d) => /* @__PURE__ */ t(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
ref: d,
|
|
38
|
+
className: o("tiptap-card-group-label", a),
|
|
39
|
+
...r
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
l.displayName = "CardGroupLabel";
|
|
44
|
+
const n = e(
|
|
45
|
+
({ className: a, ...r }, d) => /* @__PURE__ */ t(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
ref: d,
|
|
49
|
+
className: o("tiptap-card-footer", a),
|
|
50
|
+
...r
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
n.displayName = "CardFooter";
|
|
55
|
+
export {
|
|
56
|
+
i as Card,
|
|
57
|
+
m as CardBody,
|
|
58
|
+
n as CardFooter,
|
|
59
|
+
l as CardGroupLabel,
|
|
60
|
+
s as CardHeader,
|
|
61
|
+
c as CardItemGroup
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './card';
|