@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,329 @@
|
|
|
1
|
+
import { jsxs as l, jsx as a, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useState as N } from "react";
|
|
3
|
+
import { NodeViewWrapper as k } from "@tiptap/react";
|
|
4
|
+
import { CloseIcon as M } from "../../tiptap-icons/close-icon.js";
|
|
5
|
+
import { isValidPosition as z, focusNextNode as P } from "../../../lib/tiptap-utils.js";
|
|
6
|
+
import { Button as D } from "../../tiptap-ui-primitive/button/button.js";
|
|
7
|
+
import '../../../assets/image-upload-node.css';function A(e) {
|
|
8
|
+
const [p, n] = N([]), i = async (t) => {
|
|
9
|
+
if (t.size > e.maxSize) {
|
|
10
|
+
const o = new Error(
|
|
11
|
+
`File size exceeds maximum allowed (${e.maxSize / 1024 / 1024}MB)`
|
|
12
|
+
);
|
|
13
|
+
return e.onError?.(o), null;
|
|
14
|
+
}
|
|
15
|
+
const d = new AbortController(), c = crypto.randomUUID(), r = {
|
|
16
|
+
id: c,
|
|
17
|
+
file: t,
|
|
18
|
+
progress: 0,
|
|
19
|
+
status: "uploading",
|
|
20
|
+
abortController: d
|
|
21
|
+
};
|
|
22
|
+
n((o) => [...o, r]);
|
|
23
|
+
try {
|
|
24
|
+
if (!e.upload)
|
|
25
|
+
throw new Error("Upload function is not defined");
|
|
26
|
+
const o = await e.upload(
|
|
27
|
+
t,
|
|
28
|
+
(h) => {
|
|
29
|
+
n(
|
|
30
|
+
(g) => g.map(
|
|
31
|
+
(f) => f.id === c ? { ...f, progress: h.progress } : f
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
d.signal
|
|
36
|
+
);
|
|
37
|
+
if (!o) throw new Error("Upload failed: No URL returned");
|
|
38
|
+
return d.signal.aborted ? null : (n(
|
|
39
|
+
(h) => h.map(
|
|
40
|
+
(g) => g.id === c ? { ...g, status: "success", url: o, progress: 100 } : g
|
|
41
|
+
)
|
|
42
|
+
), e.onSuccess?.(o), o);
|
|
43
|
+
} catch (o) {
|
|
44
|
+
return d.signal.aborted || (n(
|
|
45
|
+
(h) => h.map(
|
|
46
|
+
(g) => g.id === c ? { ...g, status: "error", progress: 0 } : g
|
|
47
|
+
)
|
|
48
|
+
), e.onError?.(
|
|
49
|
+
o instanceof Error ? o : new Error("Upload failed")
|
|
50
|
+
)), null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
fileItems: p,
|
|
55
|
+
uploadFiles: async (t) => {
|
|
56
|
+
if (!t || t.length === 0)
|
|
57
|
+
return e.onError?.(new Error("No files to upload")), [];
|
|
58
|
+
if (e.limit && t.length > e.limit)
|
|
59
|
+
return e.onError?.(
|
|
60
|
+
new Error(
|
|
61
|
+
`Maximum ${e.limit} file${e.limit === 1 ? "" : "s"} allowed`
|
|
62
|
+
)
|
|
63
|
+
), [];
|
|
64
|
+
const d = t.map((r) => i(r));
|
|
65
|
+
return (await Promise.all(d)).filter((r) => r !== null);
|
|
66
|
+
},
|
|
67
|
+
removeFileItem: (t) => {
|
|
68
|
+
n((d) => {
|
|
69
|
+
const c = d.find((r) => r.id === t);
|
|
70
|
+
return c?.abortController && c.abortController.abort(), c?.url && URL.revokeObjectURL(c.url), d.filter((r) => r.id !== t);
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
clearAllFiles: () => {
|
|
74
|
+
p.forEach((t) => {
|
|
75
|
+
t.abortController && t.abortController.abort(), t.url && URL.revokeObjectURL(t.url);
|
|
76
|
+
}), n([]);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const F = () => /* @__PURE__ */ l(
|
|
81
|
+
"svg",
|
|
82
|
+
{
|
|
83
|
+
width: "24",
|
|
84
|
+
height: "24",
|
|
85
|
+
viewBox: "0 0 24 24",
|
|
86
|
+
className: "tiptap-image-upload-icon",
|
|
87
|
+
fill: "currentColor",
|
|
88
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ a(
|
|
91
|
+
"path",
|
|
92
|
+
{
|
|
93
|
+
d: "M11.1953 4.41771C10.3478 4.08499 9.43578 3.94949 8.5282 4.02147C7.62062 4.09345 6.74133 4.37102 5.95691 4.83316C5.1725 5.2953 4.50354 5.92989 4.00071 6.68886C3.49788 7.44783 3.17436 8.31128 3.05465 9.2138C2.93495 10.1163 3.0222 11.0343 3.3098 11.8981C3.5974 12.7619 4.07781 13.5489 4.71463 14.1995C5.10094 14.5942 5.09414 15.2274 4.69945 15.6137C4.30476 16 3.67163 15.9932 3.28532 15.5985C2.43622 14.731 1.79568 13.6816 1.41221 12.5299C1.02875 11.3781 0.91241 10.1542 1.07201 8.95084C1.23162 7.74748 1.66298 6.59621 2.33343 5.58425C3.00387 4.57229 3.89581 3.72617 4.9417 3.10998C5.98758 2.4938 7.15998 2.1237 8.37008 2.02773C9.58018 1.93176 10.7963 2.11243 11.9262 2.55605C13.0561 2.99968 14.0703 3.69462 14.8919 4.58825C15.5423 5.29573 16.0585 6.11304 16.4177 7.00002H17.4999C18.6799 6.99991 19.8288 7.37933 20.7766 8.08222C21.7245 8.78515 22.4212 9.7743 22.7637 10.9036C23.1062 12.0328 23.0765 13.2423 22.6788 14.3534C22.2812 15.4644 21.5367 16.4181 20.5554 17.0736C20.0962 17.3803 19.4752 17.2567 19.1684 16.7975C18.8617 16.3382 18.9853 15.7172 19.4445 15.4105C20.069 14.9934 20.5427 14.3865 20.7958 13.6794C21.0488 12.9724 21.0678 12.2027 20.8498 11.4841C20.6318 10.7655 20.1885 10.136 19.5853 9.6887C18.9821 9.24138 18.251 8.99993 17.5001 9.00002H15.71C15.2679 9.00002 14.8783 8.70973 14.7518 8.28611C14.4913 7.41374 14.0357 6.61208 13.4195 5.94186C12.8034 5.27164 12.0427 4.75043 11.1953 4.41771Z",
|
|
94
|
+
fill: "currentColor"
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ a(
|
|
98
|
+
"path",
|
|
99
|
+
{
|
|
100
|
+
d: "M11 14.4142V21C11 21.5523 11.4477 22 12 22C12.5523 22 13 21.5523 13 21V14.4142L15.2929 16.7071C15.6834 17.0976 16.3166 17.0976 16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929L12.7078 11.2936C12.7054 11.2912 12.703 11.2888 12.7005 11.2864C12.5208 11.1099 12.2746 11.0008 12.003 11L12 11L11.997 11C11.8625 11.0004 11.7343 11.0273 11.6172 11.0759C11.502 11.1236 11.3938 11.1937 11.2995 11.2864C11.297 11.2888 11.2946 11.2912 11.2922 11.2936L7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071C7.68342 17.0976 8.31658 17.0976 8.70711 16.7071L11 14.4142Z",
|
|
101
|
+
fill: "currentColor"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
), B = () => /* @__PURE__ */ a(
|
|
107
|
+
"svg",
|
|
108
|
+
{
|
|
109
|
+
width: "43",
|
|
110
|
+
height: "57",
|
|
111
|
+
viewBox: "0 0 43 57",
|
|
112
|
+
fill: "currentColor",
|
|
113
|
+
className: "tiptap-image-upload-dropzone-rect-primary",
|
|
114
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
115
|
+
children: /* @__PURE__ */ a(
|
|
116
|
+
"path",
|
|
117
|
+
{
|
|
118
|
+
d: "M0.75 10.75C0.75 5.64137 4.89137 1.5 10 1.5H32.3431C33.2051 1.5 34.0317 1.84241 34.6412 2.4519L40.2981 8.10876C40.9076 8.71825 41.25 9.5449 41.25 10.4069V46.75C41.25 51.8586 37.1086 56 32 56H10C4.89137 56 0.75 51.8586 0.75 46.75V10.75Z",
|
|
119
|
+
fill: "currentColor",
|
|
120
|
+
fillOpacity: "0.11",
|
|
121
|
+
stroke: "currentColor",
|
|
122
|
+
strokeWidth: "1.5"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
), I = () => /* @__PURE__ */ a(
|
|
127
|
+
"svg",
|
|
128
|
+
{
|
|
129
|
+
width: "10",
|
|
130
|
+
height: "10",
|
|
131
|
+
className: "tiptap-image-upload-dropzone-rect-secondary",
|
|
132
|
+
viewBox: "0 0 10 10",
|
|
133
|
+
fill: "currentColor",
|
|
134
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
135
|
+
children: /* @__PURE__ */ a(
|
|
136
|
+
"path",
|
|
137
|
+
{
|
|
138
|
+
d: "M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z",
|
|
139
|
+
fill: "currentColor"
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
), R = ({
|
|
144
|
+
onFile: e,
|
|
145
|
+
children: p
|
|
146
|
+
}) => {
|
|
147
|
+
const [n, i] = N(!1), [m, s] = N(!1);
|
|
148
|
+
return /* @__PURE__ */ a(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
className: `tiptap-image-upload-drag-area ${m ? "drag-active" : ""} ${n ? "drag-over" : ""}`,
|
|
152
|
+
onDragEnter: (r) => {
|
|
153
|
+
r.preventDefault(), r.stopPropagation(), s(!0);
|
|
154
|
+
},
|
|
155
|
+
onDragLeave: (r) => {
|
|
156
|
+
r.preventDefault(), r.stopPropagation(), r.currentTarget.contains(r.relatedTarget) || (s(!1), i(!1));
|
|
157
|
+
},
|
|
158
|
+
onDragOver: (r) => {
|
|
159
|
+
r.preventDefault(), r.stopPropagation(), i(!0);
|
|
160
|
+
},
|
|
161
|
+
onDrop: (r) => {
|
|
162
|
+
r.preventDefault(), r.stopPropagation(), s(!1), i(!1);
|
|
163
|
+
const o = Array.from(r.dataTransfer.files);
|
|
164
|
+
o.length > 0 && e(o);
|
|
165
|
+
},
|
|
166
|
+
children: p
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}, O = ({
|
|
170
|
+
fileItem: e,
|
|
171
|
+
onRemove: p
|
|
172
|
+
}) => {
|
|
173
|
+
const n = (i) => {
|
|
174
|
+
if (i === 0) return "0 Bytes";
|
|
175
|
+
const m = 1024, s = ["Bytes", "KB", "MB", "GB"], C = Math.floor(Math.log(i) / Math.log(m));
|
|
176
|
+
return `${parseFloat((i / Math.pow(m, C)).toFixed(2))} ${s[C]}`;
|
|
177
|
+
};
|
|
178
|
+
return /* @__PURE__ */ l("div", { className: "tiptap-image-upload-preview", children: [
|
|
179
|
+
e.status === "uploading" && /* @__PURE__ */ a(
|
|
180
|
+
"div",
|
|
181
|
+
{
|
|
182
|
+
className: "tiptap-image-upload-progress",
|
|
183
|
+
style: { width: `${e.progress}%` }
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ l("div", { className: "tiptap-image-upload-preview-content", children: [
|
|
187
|
+
/* @__PURE__ */ l("div", { className: "tiptap-image-upload-file-info", children: [
|
|
188
|
+
/* @__PURE__ */ a("div", { className: "tiptap-image-upload-file-icon", children: /* @__PURE__ */ a(F, {}) }),
|
|
189
|
+
/* @__PURE__ */ l("div", { className: "tiptap-image-upload-details", children: [
|
|
190
|
+
/* @__PURE__ */ a("span", { className: "tiptap-image-upload-text", children: e.file.name }),
|
|
191
|
+
/* @__PURE__ */ a("span", { className: "tiptap-image-upload-subtext", children: n(e.file.size) })
|
|
192
|
+
] })
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ l("div", { className: "tiptap-image-upload-actions", children: [
|
|
195
|
+
e.status === "uploading" && /* @__PURE__ */ l("span", { className: "tiptap-image-upload-progress-text", children: [
|
|
196
|
+
e.progress,
|
|
197
|
+
"%"
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ a(
|
|
200
|
+
D,
|
|
201
|
+
{
|
|
202
|
+
type: "button",
|
|
203
|
+
"data-style": "ghost",
|
|
204
|
+
onClick: (i) => {
|
|
205
|
+
i.stopPropagation(), p();
|
|
206
|
+
},
|
|
207
|
+
children: /* @__PURE__ */ a(M, { className: "tiptap-button-icon" })
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] })
|
|
211
|
+
] })
|
|
212
|
+
] });
|
|
213
|
+
}, S = ({
|
|
214
|
+
maxSize: e,
|
|
215
|
+
limit: p
|
|
216
|
+
}) => /* @__PURE__ */ l(b, { children: [
|
|
217
|
+
/* @__PURE__ */ l("div", { className: "tiptap-image-upload-dropzone", children: [
|
|
218
|
+
/* @__PURE__ */ a(B, {}),
|
|
219
|
+
/* @__PURE__ */ a(I, {}),
|
|
220
|
+
/* @__PURE__ */ a("div", { className: "tiptap-image-upload-icon-container", children: /* @__PURE__ */ a(F, {}) })
|
|
221
|
+
] }),
|
|
222
|
+
/* @__PURE__ */ l("div", { className: "tiptap-image-upload-content", children: [
|
|
223
|
+
/* @__PURE__ */ l("span", { className: "tiptap-image-upload-text", children: [
|
|
224
|
+
/* @__PURE__ */ a("em", { children: "Click to upload" }),
|
|
225
|
+
" or drag and drop"
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ l("span", { className: "tiptap-image-upload-subtext", children: [
|
|
228
|
+
"Maximum ",
|
|
229
|
+
p,
|
|
230
|
+
" file",
|
|
231
|
+
p === 1 ? "" : "s",
|
|
232
|
+
", ",
|
|
233
|
+
e / 1024 / 1024,
|
|
234
|
+
"MB each."
|
|
235
|
+
] })
|
|
236
|
+
] })
|
|
237
|
+
] }), W = (e) => {
|
|
238
|
+
const { accept: p, limit: n, maxSize: i } = e.node.attrs, m = L(null), s = e.extension, C = {
|
|
239
|
+
maxSize: i,
|
|
240
|
+
limit: n,
|
|
241
|
+
accept: p,
|
|
242
|
+
upload: s.options.upload,
|
|
243
|
+
onSuccess: s.options.onSuccess,
|
|
244
|
+
onError: s.options.onError
|
|
245
|
+
}, { fileItems: t, uploadFiles: d, removeFileItem: c, clearAllFiles: r } = A(C), o = async (u) => {
|
|
246
|
+
const v = await d(u);
|
|
247
|
+
if (v.length > 0) {
|
|
248
|
+
const w = e.getPos();
|
|
249
|
+
if (z(w)) {
|
|
250
|
+
const E = v.map((y, U) => {
|
|
251
|
+
const x = u[U]?.name.replace(/\.[^/.]+$/, "") || "unknown";
|
|
252
|
+
return {
|
|
253
|
+
type: s.options.type,
|
|
254
|
+
attrs: {
|
|
255
|
+
...s.options,
|
|
256
|
+
src: y,
|
|
257
|
+
alt: x,
|
|
258
|
+
title: x
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
});
|
|
262
|
+
e.editor.chain().focus().deleteRange({ from: w, to: w + e.node.nodeSize }).insertContentAt(w, E).run(), P(e.editor);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}, h = (u) => {
|
|
266
|
+
const v = u.target.files;
|
|
267
|
+
if (!v || v.length === 0) {
|
|
268
|
+
s.options.onError?.(new Error("No file selected"));
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
o(Array.from(v));
|
|
272
|
+
}, g = () => {
|
|
273
|
+
m.current && t.length === 0 && (m.current.value = "", m.current.click());
|
|
274
|
+
}, f = t.length > 0;
|
|
275
|
+
return /* @__PURE__ */ l(
|
|
276
|
+
k,
|
|
277
|
+
{
|
|
278
|
+
className: "tiptap-image-upload",
|
|
279
|
+
tabIndex: 0,
|
|
280
|
+
onClick: g,
|
|
281
|
+
children: [
|
|
282
|
+
!f && /* @__PURE__ */ a(R, { onFile: o, children: /* @__PURE__ */ a(S, { maxSize: i, limit: n }) }),
|
|
283
|
+
f && /* @__PURE__ */ l("div", { className: "tiptap-image-upload-previews", children: [
|
|
284
|
+
t.length > 1 && /* @__PURE__ */ l("div", { className: "tiptap-image-upload-header", children: [
|
|
285
|
+
/* @__PURE__ */ l("span", { children: [
|
|
286
|
+
"Uploading ",
|
|
287
|
+
t.length,
|
|
288
|
+
" files"
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ a(
|
|
291
|
+
D,
|
|
292
|
+
{
|
|
293
|
+
type: "button",
|
|
294
|
+
"data-style": "ghost",
|
|
295
|
+
onClick: (u) => {
|
|
296
|
+
u.stopPropagation(), r();
|
|
297
|
+
},
|
|
298
|
+
children: "Clear All"
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] }),
|
|
302
|
+
t.map((u) => /* @__PURE__ */ a(
|
|
303
|
+
O,
|
|
304
|
+
{
|
|
305
|
+
fileItem: u,
|
|
306
|
+
onRemove: () => c(u.id)
|
|
307
|
+
},
|
|
308
|
+
u.id
|
|
309
|
+
))
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ a(
|
|
312
|
+
"input",
|
|
313
|
+
{
|
|
314
|
+
ref: m,
|
|
315
|
+
name: "file",
|
|
316
|
+
accept: p,
|
|
317
|
+
type: "file",
|
|
318
|
+
multiple: n > 1,
|
|
319
|
+
onChange: h,
|
|
320
|
+
onClick: (u) => u.stopPropagation()
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
};
|
|
327
|
+
export {
|
|
328
|
+
W as ImageUploadNode
|
|
329
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image-upload-node-extension';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorOptions } from '@tiptap/react';
|
|
2
|
+
interface SimpleEditorProps extends Omit<Partial<EditorOptions>, "content"> {
|
|
3
|
+
themeMode: "dark" | "light";
|
|
4
|
+
content?: string;
|
|
5
|
+
onContentChange?: (content: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function SimpleEditor({ themeMode, content, onContentChange, }: SimpleEditorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|