reactjs-tiptap-editor-pro 0.2.31 → 0.2.33
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/lib/ColorPicker-MEAh4MhG.js +28181 -0
- package/lib/ColorPicker-ZncOwjAP.cjs +142 -0
- package/lib/extension-bundle.cjs +133 -0
- package/lib/extension-bundle.d.cts +947 -0
- package/lib/extension-bundle.d.ts +947 -0
- package/lib/extension-bundle.js +23921 -0
- package/lib/index.cjs +140 -0
- package/lib/index.d.cts +513 -0
- package/lib/index.d.ts +513 -0
- package/lib/index.js +3700 -0
- package/lib/locale-bundle-DiqW5jwb.cjs +1 -0
- package/lib/locale-bundle-DxCAtRDI.js +1487 -0
- package/lib/locale-bundle.cjs +1 -0
- package/lib/locale-bundle.d.cts +1140 -0
- package/lib/locale-bundle.d.ts +1140 -0
- package/lib/locale-bundle.js +9 -0
- package/lib/lucide-react-BFZtMawV.js +30462 -0
- package/lib/lucide-react-CMPhLW1m.cjs +7851 -0
- package/lib/style.css +1 -0
- package/package.json +58 -5
- package/src/components/ActionButton.tsx +0 -103
- package/src/components/ActionMenuButton.tsx +0 -76
- package/src/components/BubbleMenu.tsx +0 -93
- package/src/components/CharactorCount.tsx +0 -50
- package/src/components/ColorPicker.tsx +0 -272
- package/src/components/RichTextEditor.tsx +0 -212
- package/src/components/SizeSetter/SizeSetter.tsx +0 -102
- package/src/components/Toolbar.tsx +0 -108
- package/src/components/icons/Activity.tsx +0 -19
- package/src/components/icons/Animas.tsx +0 -24
- package/src/components/icons/AspectRatio.tsx +0 -13
- package/src/components/icons/Blockquote.tsx +0 -17
- package/src/components/icons/ColumnAddLeft.tsx +0 -7
- package/src/components/icons/ColumnAddRight.tsx +0 -7
- package/src/components/icons/DeleteColumn.tsx +0 -26
- package/src/components/icons/DeleteRow.tsx +0 -26
- package/src/components/icons/Direction.tsx +0 -7
- package/src/components/icons/Excalidraw.tsx +0 -7
- package/src/components/icons/ExportPdf.tsx +0 -8
- package/src/components/icons/ExportWord.tsx +0 -24
- package/src/components/icons/FileWordOutline.tsx +0 -13
- package/src/components/icons/Flag.tsx +0 -19
- package/src/components/icons/Food.tsx +0 -20
- package/src/components/icons/GIfIcon.tsx +0 -10
- package/src/components/icons/Icon.tsx +0 -30
- package/src/components/icons/ImportWord.tsx +0 -23
- package/src/components/icons/LeftToRight.tsx +0 -7
- package/src/components/icons/LineHeight.tsx +0 -13
- package/src/components/icons/MenuDown.tsx +0 -24
- package/src/components/icons/Mermaid.tsx +0 -13
- package/src/components/icons/NoFill.tsx +0 -7
- package/src/components/icons/Object.tsx +0 -24
- package/src/components/icons/RightToLeft.tsx +0 -7
- package/src/components/icons/SizeL.tsx +0 -9
- package/src/components/icons/SizeM.tsx +0 -13
- package/src/components/icons/SizeS.tsx +0 -13
- package/src/components/icons/Symbol.tsx +0 -19
- package/src/components/icons/Travel.tsx +0 -24
- package/src/components/icons/Twitter.tsx +0 -7
- package/src/components/icons/icons.ts +0 -212
- package/src/components/icons/index.ts +0 -12
- package/src/components/index.ts +0 -9
- package/src/components/menus/bubble.ts +0 -395
- package/src/components/menus/components/BubbleMenuContent.tsx +0 -15
- package/src/components/menus/components/BubbleMenuDrawer.tsx +0 -128
- package/src/components/menus/components/BubbleMenuExcalidraw.tsx +0 -91
- package/src/components/menus/components/BubbleMenuIframe.tsx +0 -143
- package/src/components/menus/components/BubbleMenuKatex.tsx +0 -136
- package/src/components/menus/components/BubbleMenuLink.tsx +0 -99
- package/src/components/menus/components/BubbleMenuMedia.tsx +0 -235
- package/src/components/menus/components/BubbleMenuMermaid.tsx +0 -128
- package/src/components/menus/components/BubbleMenuText.tsx +0 -102
- package/src/components/menus/components/BubbleMenuTwitter.tsx +0 -91
- package/src/components/menus/components/ColumnsBubbleMenu.tsx +0 -59
- package/src/components/menus/components/ContentMenu.tsx +0 -396
- package/src/components/menus/components/TableBubbleMenu.tsx +0 -362
- package/src/components/menus/index.ts +0 -7
- package/src/components/ui/button.tsx +0 -56
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/dialog.tsx +0 -128
- package/src/components/ui/dropdown-menu.tsx +0 -203
- package/src/components/ui/emoji-picker.tsx +0 -166
- package/src/components/ui/index.ts +0 -14
- package/src/components/ui/input.tsx +0 -25
- package/src/components/ui/label.tsx +0 -26
- package/src/components/ui/popover.tsx +0 -31
- package/src/components/ui/select.tsx +0 -162
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/switch.tsx +0 -29
- package/src/components/ui/tabs.tsx +0 -55
- package/src/components/ui/textarea.tsx +0 -24
- package/src/components/ui/toast.tsx +0 -129
- package/src/components/ui/toaster.tsx +0 -44
- package/src/components/ui/toggle.tsx +0 -45
- package/src/components/ui/tooltip.tsx +0 -30
- package/src/components/ui/use-toast.ts +0 -197
- package/src/constants/index.ts +0 -223
- package/src/constants/resetCSS.ts +0 -139
- package/src/extension-bundle.ts +0 -2
- package/src/extensions/Attachment/Attachment.ts +0 -144
- package/src/extensions/Attachment/components/NodeViewAttachment/FileIcon.tsx +0 -69
- package/src/extensions/Attachment/components/NodeViewAttachment/FileIconString.ts +0 -28
- package/src/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.tsx +0 -155
- package/src/extensions/Attachment/components/NodeViewAttachment/index.module.scss +0 -23
- package/src/extensions/Attachment/index.ts +0 -1
- package/src/extensions/BaseKit.ts +0 -253
- package/src/extensions/Blockquote/Blockquote.ts +0 -31
- package/src/extensions/Blockquote/index.ts +0 -1
- package/src/extensions/Bold/Bold.ts +0 -26
- package/src/extensions/Bold/index.ts +0 -1
- package/src/extensions/BulletList/BulletList.ts +0 -28
- package/src/extensions/BulletList/index.ts +0 -1
- package/src/extensions/Clear/Clear.ts +0 -24
- package/src/extensions/Clear/index.ts +0 -1
- package/src/extensions/Code/Code.ts +0 -26
- package/src/extensions/Code/index.ts +0 -1
- package/src/extensions/CodeBlock/CodeBlock.ts +0 -54
- package/src/extensions/CodeBlock/components/CodeBlockActiveButton.tsx +0 -66
- package/src/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.tsx +0 -89
- package/src/extensions/CodeBlock/components/NodeViewCodeBlock/index.module.scss +0 -81
- package/src/extensions/CodeBlock/highlighter.ts +0 -132
- package/src/extensions/CodeBlock/index.ts +0 -1
- package/src/extensions/CodeBlock/shiki-plugin.ts +0 -213
- package/src/extensions/Color/Color.ts +0 -52
- package/src/extensions/Color/components/ColorActionButton.tsx +0 -104
- package/src/extensions/Color/index.ts +0 -1
- package/src/extensions/Document/Document.ts +0 -8
- package/src/extensions/Document/index.ts +0 -1
- package/src/extensions/Drawer/Drawer.ts +0 -177
- package/src/extensions/Drawer/components/ControlDrawer/ControlDrawer.module.scss +0 -85
- package/src/extensions/Drawer/components/ControlDrawer/ControlDrawer.tsx +0 -598
- package/src/extensions/Drawer/components/ControlDrawer/icon.tsx +0 -500
- package/src/extensions/Drawer/components/DrawerActiveButton.tsx +0 -239
- package/src/extensions/Drawer/components/EditDrawerBlock.tsx +0 -238
- package/src/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.tsx +0 -260
- package/src/extensions/Drawer/index.ts +0 -1
- package/src/extensions/Emoji/Emoji.ts +0 -146
- package/src/extensions/Emoji/components/EmojiList/EmojiList.tsx +0 -103
- package/src/extensions/Emoji/components/EmojiList/emojis.ts +0 -1858
- package/src/extensions/Emoji/components/EmojiPicker/EmojiPicker.tsx +0 -61
- package/src/extensions/Emoji/index.ts +0 -1
- package/src/extensions/Excalidraw/Excalidraw.ts +0 -123
- package/src/extensions/Excalidraw/components/ExcalidrawActiveButton.tsx +0 -138
- package/src/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.tsx +0 -178
- package/src/extensions/Excalidraw/components/NodeViewExcalidraw/index.module.scss +0 -43
- package/src/extensions/Excalidraw/index.ts +0 -1
- package/src/extensions/ExportPdf/ExportPdf.ts +0 -25
- package/src/extensions/ExportPdf/index.ts +0 -1
- package/src/extensions/ExportWord/ExportWord.ts +0 -87
- package/src/extensions/ExportWord/index.ts +0 -1
- package/src/extensions/FontFamily/FontFamily.ts +0 -64
- package/src/extensions/FontFamily/components/FontFamilyButton.tsx +0 -97
- package/src/extensions/FontFamily/index.ts +0 -1
- package/src/extensions/FontSize/FontSize.ts +0 -119
- package/src/extensions/FontSize/components/FontSizeMenuButton.tsx +0 -84
- package/src/extensions/FontSize/index.ts +0 -1
- package/src/extensions/FormatPainter/FormatPainter.ts +0 -121
- package/src/extensions/FormatPainter/index.ts +0 -1
- package/src/extensions/Heading/Heading.ts +0 -57
- package/src/extensions/Heading/components/HeadingButton.tsx +0 -96
- package/src/extensions/Heading/index.ts +0 -1
- package/src/extensions/Highlight/Highlight.ts +0 -36
- package/src/extensions/Highlight/components/HighlightActionButton.tsx +0 -108
- package/src/extensions/Highlight/index.ts +0 -1
- package/src/extensions/History/History.ts +0 -39
- package/src/extensions/History/components/HistoryActionButton.tsx +0 -74
- package/src/extensions/History/index.ts +0 -1
- package/src/extensions/HorizontalRule/HorizontalRule.ts +0 -42
- package/src/extensions/HorizontalRule/index.ts +0 -1
- package/src/extensions/Iframe/Iframe.ts +0 -140
- package/src/extensions/Iframe/components/IframeNodeView.tsx +0 -92
- package/src/extensions/Iframe/components/index.module.scss +0 -40
- package/src/extensions/Iframe/embed.ts +0 -487
- package/src/extensions/Iframe/index.ts +0 -1
- package/src/extensions/Image/Image.ts +0 -303
- package/src/extensions/Image/components/ActionImageButton.tsx +0 -186
- package/src/extensions/Image/components/ImageCropper.tsx +0 -198
- package/src/extensions/Image/components/ImageView.tsx +0 -271
- package/src/extensions/Image/index.ts +0 -1
- package/src/extensions/Image/store.ts +0 -15
- package/src/extensions/ImageGif/ImageGif.ts +0 -176
- package/src/extensions/ImageGif/components/ImageGifActionButton.tsx +0 -138
- package/src/extensions/ImageGif/components/ImageGifView.tsx +0 -260
- package/src/extensions/ImageGif/index.ts +0 -1
- package/src/extensions/ImportWord/ImportWord.ts +0 -52
- package/src/extensions/ImportWord/components/ImportWordButton.tsx +0 -151
- package/src/extensions/ImportWord/index.ts +0 -1
- package/src/extensions/Indent/Indent.ts +0 -110
- package/src/extensions/Indent/index.ts +0 -1
- package/src/extensions/Italic/Italic.ts +0 -29
- package/src/extensions/Italic/index.ts +0 -1
- package/src/extensions/Katex/Katex.ts +0 -109
- package/src/extensions/Katex/components/KatexActiveButton.tsx +0 -117
- package/src/extensions/Katex/components/KatexWrapper.tsx +0 -53
- package/src/extensions/Katex/index.ts +0 -1
- package/src/extensions/LineHeight/LineHeight.ts +0 -76
- package/src/extensions/LineHeight/components/LineHeightDropdown.tsx +0 -93
- package/src/extensions/LineHeight/index.ts +0 -1
- package/src/extensions/Link/Link.ts +0 -92
- package/src/extensions/Link/components/LinkEditBlock.tsx +0 -110
- package/src/extensions/Link/components/LinkEditPopover.tsx +0 -46
- package/src/extensions/Link/components/LinkViewBlock.tsx +0 -54
- package/src/extensions/Link/index.ts +0 -1
- package/src/extensions/ListItem/ListItem.ts +0 -1
- package/src/extensions/ListItem/index.ts +0 -1
- package/src/extensions/Mention/Mention.ts +0 -100
- package/src/extensions/Mention/components/NodeViewMentionList/NodeViewMentionList.tsx +0 -94
- package/src/extensions/Mention/components/NodeViewMentionList/index.module.scss +0 -38
- package/src/extensions/Mention/index.ts +0 -1
- package/src/extensions/Mermaid/Mermaid.ts +0 -177
- package/src/extensions/Mermaid/components/EditMermaidBlock.tsx +0 -155
- package/src/extensions/Mermaid/components/MermaidActiveButton.tsx +0 -151
- package/src/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.tsx +0 -260
- package/src/extensions/Mermaid/index.ts +0 -1
- package/src/extensions/MoreMark/MoreMark.ts +0 -102
- package/src/extensions/MoreMark/components/ActionMoreButton.tsx +0 -97
- package/src/extensions/MoreMark/index.ts +0 -1
- package/src/extensions/MultiColumn/Column.ts +0 -36
- package/src/extensions/MultiColumn/MultiColumn.ts +0 -111
- package/src/extensions/MultiColumn/components/ColumnActionButton.ts +0 -22
- package/src/extensions/MultiColumn/index.ts +0 -3
- package/src/extensions/OrderedList/OrderedList.ts +0 -28
- package/src/extensions/OrderedList/index.ts +0 -1
- package/src/extensions/SearchAndReplace/SearchAndReplace.ts +0 -395
- package/src/extensions/SearchAndReplace/components/SearchAndReplaceButton.tsx +0 -190
- package/src/extensions/SearchAndReplace/index.ts +0 -1
- package/src/extensions/Selection/Selection.ts +0 -32
- package/src/extensions/Selection/index.ts +0 -1
- package/src/extensions/SlashCommand/SlashCommand.ts +0 -255
- package/src/extensions/SlashCommand/components/CommandsList.tsx +0 -180
- package/src/extensions/SlashCommand/groups.ts +0 -183
- package/src/extensions/SlashCommand/index.ts +0 -1
- package/src/extensions/SlashCommand/types.ts +0 -24
- package/src/extensions/Strike/Strike.ts +0 -26
- package/src/extensions/Strike/index.ts +0 -1
- package/src/extensions/Subscript/Subscript.ts +0 -88
- package/src/extensions/Subscript/index.ts +0 -1
- package/src/extensions/Table/Cell.ts +0 -131
- package/src/extensions/Table/Header.ts +0 -93
- package/src/extensions/Table/Row.ts +0 -8
- package/src/extensions/Table/Table.ts +0 -60
- package/src/extensions/Table/cell-background.ts +0 -112
- package/src/extensions/Table/components/CreateTablePopover.tsx +0 -132
- package/src/extensions/Table/components/TableActionButton.tsx +0 -42
- package/src/extensions/Table/index.ts +0 -6
- package/src/extensions/Table/utils.ts +0 -352
- package/src/extensions/TableOfContent/TableOfContent.ts +0 -124
- package/src/extensions/TableOfContent/components/NodeViewTableOfContent.tsx +0 -116
- package/src/extensions/TableOfContent/components/TableOfContentActionButton.tsx +0 -27
- package/src/extensions/TableOfContent/components/index.module.scss +0 -40
- package/src/extensions/TableOfContent/index.ts +0 -1
- package/src/extensions/TaskList/TaskList.ts +0 -46
- package/src/extensions/TaskList/index.ts +0 -1
- package/src/extensions/TextAlign/TextAlign.ts +0 -68
- package/src/extensions/TextAlign/components/TextAlignMenuButton.tsx +0 -103
- package/src/extensions/TextAlign/index.ts +0 -1
- package/src/extensions/TextBubble/TextBubble.ts +0 -22
- package/src/extensions/TextBubble/components/TextDropdown.tsx +0 -146
- package/src/extensions/TextBubble/index.ts +0 -1
- package/src/extensions/TextDirection/TextDirection.ts +0 -97
- package/src/extensions/TextDirection/components/TextDirectionButton.tsx +0 -103
- package/src/extensions/TextDirection/index.ts +0 -1
- package/src/extensions/TrailingNode/TrailingNode.ts +0 -71
- package/src/extensions/TrailingNode/index.ts +0 -1
- package/src/extensions/Twitter/Twitter.ts +0 -161
- package/src/extensions/Twitter/components/FormEditLinkTwitter.tsx +0 -68
- package/src/extensions/Twitter/components/NodeViewTweet.tsx +0 -30
- package/src/extensions/Twitter/components/TwitterActiveButton.tsx +0 -41
- package/src/extensions/Twitter/index.ts +0 -1
- package/src/extensions/UnderLine/Underline.ts +0 -30
- package/src/extensions/UnderLine/index.ts +0 -1
- package/src/extensions/Video/Video.ts +0 -204
- package/src/extensions/Video/components/ActiveVideoButton.tsx +0 -191
- package/src/extensions/Video/index.ts +0 -1
- package/src/extensions/Video/store.ts +0 -15
- package/src/extensions/index.ts +0 -122
- package/src/hooks/useActive.tsx +0 -24
- package/src/hooks/useAttributes.tsx +0 -45
- package/src/hooks/useCopy.tsx +0 -20
- package/src/hooks/useEditorState.tsx +0 -23
- package/src/hooks/useExtension.tsx +0 -29
- package/src/index.ts +0 -8
- package/src/lib/utils.ts +0 -7
- package/src/locale-bundle.ts +0 -3
- package/src/locales/en.ts +0 -173
- package/src/locales/hu.ts +0 -173
- package/src/locales/index.tsx +0 -163
- package/src/locales/pt-br.ts +0 -173
- package/src/locales/vi.ts +0 -173
- package/src/locales/zh-cn.ts +0 -173
- package/src/plugins/DragHandle/index.ts +0 -375
- package/src/plugins/DragHandle/range.ts +0 -114
- package/src/plugins/DragHandle/utils.ts +0 -80
- package/src/plugins/image-upload.ts +0 -160
- package/src/store/ProviderRichText.tsx +0 -53
- package/src/store/editableEditor.ts +0 -15
- package/src/store/fast-context.tsx +0 -70
- package/src/store/store.ts +0 -35
- package/src/styles/ProseMirror.scss +0 -176
- package/src/styles/columns.scss +0 -23
- package/src/styles/editor.scss +0 -411
- package/src/styles/global.scss +0 -87
- package/src/styles/index.scss +0 -5
- package/src/styles/mention.scss +0 -6
- package/src/theme/theme.ts +0 -15
- package/src/types.ts +0 -271
- package/src/utils/_event.ts +0 -55
- package/src/utils/color.ts +0 -67
- package/src/utils/columns.ts +0 -142
- package/src/utils/customEvents/customEvents.ts +0 -18
- package/src/utils/customEvents/events.constant.ts +0 -11
- package/src/utils/delete-node.ts +0 -46
- package/src/utils/dom-dataset.ts +0 -121
- package/src/utils/download.ts +0 -17
- package/src/utils/dynamicCSS.ts +0 -192
- package/src/utils/editor-container-size.ts +0 -28
- package/src/utils/file.ts +0 -112
- package/src/utils/getRenderContainer.ts +0 -41
- package/src/utils/indent.ts +0 -99
- package/src/utils/is-mobile.ts +0 -57
- package/src/utils/json.ts +0 -18
- package/src/utils/line-height.ts +0 -109
- package/src/utils/lru-cache.ts +0 -145
- package/src/utils/mitt.ts +0 -114
- package/src/utils/node.ts +0 -92
- package/src/utils/pdf.ts +0 -72
- package/src/utils/plateform.ts +0 -49
- package/src/utils/shortId.ts +0 -5
- package/src/utils/storage.ts +0 -18
- package/src/utils/utils.ts +0 -71
- package/src/vite-env.d.ts +0 -3
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { Fragment, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { Editor } from '@tiptap/react';
|
|
4
|
-
import { BubbleMenu as BubbleMenuReact } from '@tiptap/react';
|
|
5
|
-
|
|
6
|
-
import { Separator, getBubbleImage, getBubbleImageGif, getBubbleVideo } from 'reactjs-tiptap-editor-pro/components';
|
|
7
|
-
import { Image, ImageGif, Video } from 'reactjs-tiptap-editor-pro/extensions';
|
|
8
|
-
import { useLocale } from 'reactjs-tiptap-editor-pro/locales';
|
|
9
|
-
|
|
10
|
-
interface IPropsBubbleMenu {
|
|
11
|
-
editor: Editor
|
|
12
|
-
disabled?: boolean
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const tippyOptions = {
|
|
16
|
-
maxWidth: 'auto',
|
|
17
|
-
zIndex: 20,
|
|
18
|
-
appendTo: 'parent',
|
|
19
|
-
moveTransition: 'transform 0.1s ease-out',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
function ItemA({ item, disabled, editor }: any) {
|
|
23
|
-
const Comp = item.component;
|
|
24
|
-
|
|
25
|
-
if (!Comp) {
|
|
26
|
-
return <></>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Fragment>
|
|
31
|
-
{item.type === 'divider'
|
|
32
|
-
? (
|
|
33
|
-
<Separator className="!mx-1 !my-2 !h-[16px]"
|
|
34
|
-
orientation="vertical"
|
|
35
|
-
/>
|
|
36
|
-
)
|
|
37
|
-
: (
|
|
38
|
-
<Comp
|
|
39
|
-
{...item.componentProps}
|
|
40
|
-
disabled={disabled || item?.componentProps?.disabled}
|
|
41
|
-
editor={editor}
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
</Fragment>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function isImageNode(node: any) {
|
|
49
|
-
return node.type.name === Image.name;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function isImageGifNode(node: any) {
|
|
53
|
-
return node.type.name === ImageGif.name;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function isVideoNode(node: any) {
|
|
57
|
-
return node.type.name === Video.name;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function BubbleMenuImage(props: IPropsBubbleMenu) {
|
|
61
|
-
const { lang } = useLocale();
|
|
62
|
-
|
|
63
|
-
const shouldShow = ({ editor }: any) => {
|
|
64
|
-
const { selection } = editor.view.state;
|
|
65
|
-
const { $from, to } = selection;
|
|
66
|
-
let isImage = false;
|
|
67
|
-
|
|
68
|
-
editor.view.state.doc.nodesBetween($from.pos, to, (node: any) => {
|
|
69
|
-
if (isImageNode(node)) {
|
|
70
|
-
isImage = true;
|
|
71
|
-
return false; // Stop iteration if an image is found
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
return isImage;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const items = useMemo(() => {
|
|
79
|
-
if (props.disabled) {
|
|
80
|
-
return [];
|
|
81
|
-
}
|
|
82
|
-
return getBubbleImage(props.editor);
|
|
83
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
-
}, [props.disabled, props.editor, lang]);
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<>
|
|
88
|
-
<BubbleMenuReact
|
|
89
|
-
editor={props?.editor}
|
|
90
|
-
shouldShow={shouldShow}
|
|
91
|
-
tippyOptions={tippyOptions as any}
|
|
92
|
-
>
|
|
93
|
-
{items?.length
|
|
94
|
-
? (
|
|
95
|
-
<div className="pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800">
|
|
96
|
-
<div className="relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap">
|
|
97
|
-
{items?.map((item: any, key: any) => {
|
|
98
|
-
return (
|
|
99
|
-
<ItemA
|
|
100
|
-
disabled={props.disabled}
|
|
101
|
-
editor={props.editor}
|
|
102
|
-
item={item}
|
|
103
|
-
key={`bubbleMenu-image-${key}`}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
})}
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
)
|
|
110
|
-
: (
|
|
111
|
-
<></>
|
|
112
|
-
)}
|
|
113
|
-
</BubbleMenuReact>
|
|
114
|
-
</>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function BubbleMenuImageGif(props: IPropsBubbleMenu) {
|
|
119
|
-
const { lang } = useLocale();
|
|
120
|
-
|
|
121
|
-
const shouldShow = ({ editor }: any) => {
|
|
122
|
-
const { selection } = editor.view.state;
|
|
123
|
-
const { $from, to } = selection;
|
|
124
|
-
let isImage = false;
|
|
125
|
-
|
|
126
|
-
editor.view.state.doc.nodesBetween($from.pos, to, (node: any) => {
|
|
127
|
-
if (isImageGifNode(node)) {
|
|
128
|
-
isImage = true;
|
|
129
|
-
return false; // Stop iteration if an image is found
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return isImage;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const items = useMemo(() => {
|
|
137
|
-
if (props.disabled) {
|
|
138
|
-
return [];
|
|
139
|
-
}
|
|
140
|
-
return getBubbleImageGif(props.editor);
|
|
141
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
142
|
-
}, [props.disabled, props.editor, lang]);
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<>
|
|
146
|
-
<BubbleMenuReact
|
|
147
|
-
editor={props?.editor}
|
|
148
|
-
shouldShow={shouldShow}
|
|
149
|
-
tippyOptions={tippyOptions as any}
|
|
150
|
-
>
|
|
151
|
-
{items?.length
|
|
152
|
-
? (
|
|
153
|
-
<div className="pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800">
|
|
154
|
-
<div className="relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap">
|
|
155
|
-
{items?.map((item: any, key: any) => {
|
|
156
|
-
return (
|
|
157
|
-
<ItemA
|
|
158
|
-
disabled={props.disabled}
|
|
159
|
-
editor={props.editor}
|
|
160
|
-
item={item}
|
|
161
|
-
key={`bubbleMenu-image-gif-${key}`}
|
|
162
|
-
/>
|
|
163
|
-
);
|
|
164
|
-
})}
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
)
|
|
168
|
-
: (
|
|
169
|
-
<></>
|
|
170
|
-
)}
|
|
171
|
-
</BubbleMenuReact>
|
|
172
|
-
</>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function BubbleMenuVideo(props: IPropsBubbleMenu) {
|
|
177
|
-
const { lang } = useLocale();
|
|
178
|
-
|
|
179
|
-
const shouldShow = ({ editor }: any) => {
|
|
180
|
-
const { selection } = editor.view.state;
|
|
181
|
-
const { $from, to } = selection;
|
|
182
|
-
let isVideo = false;
|
|
183
|
-
|
|
184
|
-
editor.view.state.doc.nodesBetween($from.pos, to, (node: any) => {
|
|
185
|
-
if (isVideoNode(node)) {
|
|
186
|
-
isVideo = true;
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
return isVideo;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
const items = useMemo(() => {
|
|
195
|
-
if (props.disabled) {
|
|
196
|
-
return [];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return getBubbleVideo(props.editor);
|
|
200
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
201
|
-
}, [props.editor, props.disabled, lang]);
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<>
|
|
205
|
-
<BubbleMenuReact
|
|
206
|
-
editor={props?.editor}
|
|
207
|
-
shouldShow={shouldShow}
|
|
208
|
-
tippyOptions={tippyOptions as any}
|
|
209
|
-
>
|
|
210
|
-
{items?.length
|
|
211
|
-
? (
|
|
212
|
-
<div className="pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800">
|
|
213
|
-
<div className="relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap">
|
|
214
|
-
{items?.map((item: any, key: any) => {
|
|
215
|
-
return (
|
|
216
|
-
<ItemA
|
|
217
|
-
disabled={props.disabled}
|
|
218
|
-
editor={props.editor}
|
|
219
|
-
item={item}
|
|
220
|
-
key={`bubbleMenu-video-${key}`}
|
|
221
|
-
/>
|
|
222
|
-
);
|
|
223
|
-
})}
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
)
|
|
227
|
-
: (
|
|
228
|
-
<></>
|
|
229
|
-
)}
|
|
230
|
-
</BubbleMenuReact>
|
|
231
|
-
</>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export { BubbleMenuImage, BubbleMenuVideo, BubbleMenuImageGif };
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Fragment, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { Editor } from '@tiptap/react';
|
|
4
|
-
import { BubbleMenu as BubbleMenuReact } from '@tiptap/react';
|
|
5
|
-
|
|
6
|
-
import { Separator, getBubbleMermaid } from 'reactjs-tiptap-editor-pro/components';
|
|
7
|
-
import { Mermaid } from 'reactjs-tiptap-editor-pro/extensions';
|
|
8
|
-
import { EditMermaidBlock } from 'reactjs-tiptap-editor-pro/extensions/Mermaid/components/EditMermaidBlock';
|
|
9
|
-
import { useAttributes } from 'reactjs-tiptap-editor-pro/hooks/useAttributes';
|
|
10
|
-
import { useExtension } from 'reactjs-tiptap-editor-pro/hooks/useExtension';
|
|
11
|
-
import { useLocale } from 'reactjs-tiptap-editor-pro/locales';
|
|
12
|
-
|
|
13
|
-
interface IPropsBubbleMenu {
|
|
14
|
-
editor: Editor
|
|
15
|
-
disabled?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const tippyOptions = {
|
|
19
|
-
maxWidth: 'auto',
|
|
20
|
-
zIndex: 20,
|
|
21
|
-
appendTo: 'parent',
|
|
22
|
-
moveTransition: 'transform 0.1s ease-out',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function ItemA({ item, disabled, editor }: any) {
|
|
26
|
-
const Comp = item.component;
|
|
27
|
-
|
|
28
|
-
if (!Comp) {
|
|
29
|
-
return <></>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Fragment>
|
|
34
|
-
{item.type === 'divider'
|
|
35
|
-
? (
|
|
36
|
-
<Separator className="!mx-1 !my-2 !h-[16px]"
|
|
37
|
-
orientation="vertical"
|
|
38
|
-
/>
|
|
39
|
-
)
|
|
40
|
-
: (
|
|
41
|
-
<Comp
|
|
42
|
-
{...item.componentProps}
|
|
43
|
-
disabled={disabled || item?.componentProps?.disabled}
|
|
44
|
-
editor={editor}
|
|
45
|
-
/>
|
|
46
|
-
)}
|
|
47
|
-
</Fragment>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function isMermaidNode(node: any) {
|
|
52
|
-
return node.type.name === 'mermaid';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function BubbleMenuMermaid(props: IPropsBubbleMenu) {
|
|
56
|
-
const { lang } = useLocale();
|
|
57
|
-
|
|
58
|
-
const attrs = useAttributes<any>(props.editor, Mermaid.name);
|
|
59
|
-
|
|
60
|
-
const extension = useExtension(props.editor, Mermaid.name);
|
|
61
|
-
|
|
62
|
-
const shouldShow = ({ editor }: any) => {
|
|
63
|
-
const { selection } = editor.view.state;
|
|
64
|
-
const { $from, to } = selection;
|
|
65
|
-
let isMermaid = false;
|
|
66
|
-
|
|
67
|
-
editor.view.state.doc.nodesBetween($from.pos, to, (node: any) => {
|
|
68
|
-
if (isMermaidNode(node)) {
|
|
69
|
-
isMermaid = true;
|
|
70
|
-
return false; // Stop iteration if an mermaid is found
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
return isMermaid;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const items = useMemo(() => {
|
|
78
|
-
if (props.disabled) {
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
return getBubbleMermaid(props.editor);
|
|
82
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
|
-
}, [props.disabled, props.editor, lang]);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
<BubbleMenuReact
|
|
88
|
-
editor={props?.editor}
|
|
89
|
-
shouldShow={shouldShow}
|
|
90
|
-
tippyOptions={tippyOptions as any}
|
|
91
|
-
>
|
|
92
|
-
{items?.length
|
|
93
|
-
? (
|
|
94
|
-
<div className="pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800">
|
|
95
|
-
<div className="relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap">
|
|
96
|
-
{items?.map((item: any, key: any) => {
|
|
97
|
-
if (item.type === 'edit' && attrs?.src) {
|
|
98
|
-
return (
|
|
99
|
-
<EditMermaidBlock
|
|
100
|
-
attrs={attrs}
|
|
101
|
-
editor={props.editor}
|
|
102
|
-
extension={extension}
|
|
103
|
-
key={`bubbleMenu-mermaid-${key}`}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<ItemA
|
|
110
|
-
disabled={props.disabled}
|
|
111
|
-
editor={props.editor}
|
|
112
|
-
item={item}
|
|
113
|
-
key={`bubbleMenu-mermaid-${key}`}
|
|
114
|
-
/>
|
|
115
|
-
);
|
|
116
|
-
})}
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
)
|
|
120
|
-
: (
|
|
121
|
-
<></>
|
|
122
|
-
)}
|
|
123
|
-
</BubbleMenuReact>
|
|
124
|
-
</>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export { BubbleMenuMermaid };
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { Editor } from '@tiptap/core';
|
|
4
|
-
import { TextSelection } from '@tiptap/pm/state';
|
|
5
|
-
import { BubbleMenu } from '@tiptap/react';
|
|
6
|
-
|
|
7
|
-
import { Separator, getBubbleText } from 'reactjs-tiptap-editor-pro/components';
|
|
8
|
-
import { useLocale } from 'reactjs-tiptap-editor-pro/locales';
|
|
9
|
-
import { type ShouldShowProps } from 'reactjs-tiptap-editor-pro/types';
|
|
10
|
-
|
|
11
|
-
export interface BubbleMenuTextProps {
|
|
12
|
-
editor: Editor
|
|
13
|
-
disabled?: boolean
|
|
14
|
-
items?: string[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const tippyOptions = {
|
|
18
|
-
maxWidth: 'auto',
|
|
19
|
-
zIndex: 20,
|
|
20
|
-
moveTransition: 'transform 0.1s ease-out',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function ItemA({ item, disabled, editor }: any) {
|
|
24
|
-
const Comp = item.component;
|
|
25
|
-
|
|
26
|
-
if (!Comp) {
|
|
27
|
-
return <></>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Comp
|
|
32
|
-
{...item.componentProps}
|
|
33
|
-
disabled={disabled || item?.componentProps?.disabled}
|
|
34
|
-
editor={editor}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function BubbleMenuText(props: BubbleMenuTextProps) {
|
|
40
|
-
const { t, lang } = useLocale();
|
|
41
|
-
|
|
42
|
-
const shouldShow = ({ editor }: ShouldShowProps) => {
|
|
43
|
-
const { selection } = editor.view.state;
|
|
44
|
-
const { $from, to } = selection;
|
|
45
|
-
|
|
46
|
-
// check content select length is not empty
|
|
47
|
-
if ($from.pos === to) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return selection instanceof TextSelection;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const items = useMemo(() => {
|
|
55
|
-
if (props.disabled || !props?.editor) {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return getBubbleText(props.editor, t, props.items);
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
}, [props.disabled, props.editor, props.items, lang, t]);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<BubbleMenu editor={props?.editor}
|
|
65
|
-
shouldShow={shouldShow}
|
|
66
|
-
tippyOptions={tippyOptions as any}
|
|
67
|
-
>
|
|
68
|
-
{items?.length
|
|
69
|
-
? (
|
|
70
|
-
<div className="pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800">
|
|
71
|
-
<div className="relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap">
|
|
72
|
-
{items?.map((item: any, key: any) => {
|
|
73
|
-
if (item?.type === 'divider') {
|
|
74
|
-
return (
|
|
75
|
-
<Separator
|
|
76
|
-
className="!mx-1 !my-2 !h-[16px]"
|
|
77
|
-
key={`bubbleMenu-divider-${key}`}
|
|
78
|
-
orientation="vertical"
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<ItemA
|
|
85
|
-
disabled={props.disabled}
|
|
86
|
-
editor={props.editor}
|
|
87
|
-
item={item}
|
|
88
|
-
key={`bubbleMenu-text-${key}`}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
})}
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
)
|
|
95
|
-
: (
|
|
96
|
-
<></>
|
|
97
|
-
)}
|
|
98
|
-
</BubbleMenu>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export { BubbleMenuText };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { Editor } from '@tiptap/react';
|
|
4
|
-
import { BubbleMenu } from '@tiptap/react';
|
|
5
|
-
|
|
6
|
-
import { ActionButton } from 'reactjs-tiptap-editor-pro/components/ActionButton';
|
|
7
|
-
import { Twitter } from 'reactjs-tiptap-editor-pro/extensions';
|
|
8
|
-
import FormEditLinkTwitter from 'reactjs-tiptap-editor-pro/extensions/Twitter/components/FormEditLinkTwitter';
|
|
9
|
-
import { useLocale } from 'reactjs-tiptap-editor-pro/locales';
|
|
10
|
-
import { deleteNode } from 'reactjs-tiptap-editor-pro/utils/delete-node';
|
|
11
|
-
|
|
12
|
-
export interface BubbleMenuTwitterProps {
|
|
13
|
-
editor: Editor
|
|
14
|
-
disabled?: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function BubbleMenuTwitter({ editor, disabled }: BubbleMenuTwitterProps) {
|
|
18
|
-
const [showEdit, setShowEdit] = useState(false);
|
|
19
|
-
const { t } = useLocale();
|
|
20
|
-
|
|
21
|
-
const shouldShow = useCallback(({ editor }: { editor: Editor }) => {
|
|
22
|
-
const isActive = editor.isActive(Twitter.name);
|
|
23
|
-
return isActive;
|
|
24
|
-
}, []);
|
|
25
|
-
|
|
26
|
-
const onSetLink = (src: string) => {
|
|
27
|
-
editor.commands.updateTweet({ src });
|
|
28
|
-
setShowEdit(false);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const deleteMe = useCallback(() => deleteNode(Twitter.name, editor), [editor]);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
<BubbleMenu
|
|
36
|
-
editor={editor}
|
|
37
|
-
shouldShow={shouldShow}
|
|
38
|
-
tippyOptions={{
|
|
39
|
-
popperOptions: {
|
|
40
|
-
modifiers: [{ name: 'flip', enabled: false }],
|
|
41
|
-
},
|
|
42
|
-
placement: 'bottom-start',
|
|
43
|
-
offset: [-2, 16],
|
|
44
|
-
zIndex: 9999,
|
|
45
|
-
onHidden: () => {
|
|
46
|
-
setShowEdit(false);
|
|
47
|
-
},
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
{disabled
|
|
51
|
-
? (
|
|
52
|
-
<></>
|
|
53
|
-
)
|
|
54
|
-
: (
|
|
55
|
-
<>
|
|
56
|
-
{showEdit
|
|
57
|
-
? (
|
|
58
|
-
<FormEditLinkTwitter
|
|
59
|
-
editor={editor}
|
|
60
|
-
onSetLink={onSetLink}
|
|
61
|
-
/>
|
|
62
|
-
)
|
|
63
|
-
: (
|
|
64
|
-
<div className="flex items-center gap-2 rounded-lg !border border-neutral-200 bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black">
|
|
65
|
-
<div className="flex flex-nowrap">
|
|
66
|
-
<ActionButton
|
|
67
|
-
icon="Pencil"
|
|
68
|
-
tooltip={t('editor.link.edit.tooltip')}
|
|
69
|
-
tooltipOptions={{ sideOffset: 15 }}
|
|
70
|
-
action={() => {
|
|
71
|
-
setShowEdit(true);
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
|
|
75
|
-
<ActionButton
|
|
76
|
-
action={deleteMe}
|
|
77
|
-
icon="Trash"
|
|
78
|
-
tooltip={t('editor.delete')}
|
|
79
|
-
tooltipOptions={{ sideOffset: 15 }}
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
)}
|
|
84
|
-
</>
|
|
85
|
-
)}
|
|
86
|
-
</BubbleMenu>
|
|
87
|
-
</>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { BubbleMenuTwitter };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
|
|
3
|
-
import { BubbleMenu } from '@tiptap/react';
|
|
4
|
-
import { ActionButton } from 'reactjs-tiptap-editor-pro/components/ActionButton';
|
|
5
|
-
import { deleteNode } from 'reactjs-tiptap-editor-pro/utils/delete-node';
|
|
6
|
-
import { MultiColumn } from 'reactjs-tiptap-editor-pro/extensions';
|
|
7
|
-
import { useLocale } from 'reactjs-tiptap-editor-pro/locales';
|
|
8
|
-
|
|
9
|
-
export function ColumnsBubbleMenu({ editor }: any) {
|
|
10
|
-
const { t } = useLocale();
|
|
11
|
-
|
|
12
|
-
const shouldShow = useCallback(() => editor.isActive(MultiColumn.name), [editor]);
|
|
13
|
-
const deleteMe = useCallback(() => deleteNode(MultiColumn.name, editor), [editor]);
|
|
14
|
-
const addColBefore = useCallback(() => editor.chain().focus().addColBefore().run(), [editor]);
|
|
15
|
-
const addColAfter = useCallback(() => editor.chain().focus().addColAfter().run(), [editor]);
|
|
16
|
-
const deleteCol = useCallback(() => editor.chain().focus().deleteCol().run(), [editor]);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<BubbleMenu
|
|
20
|
-
pluginKey="columns-bubble-menu"
|
|
21
|
-
editor={editor}
|
|
22
|
-
shouldShow={shouldShow}
|
|
23
|
-
tippyOptions={{
|
|
24
|
-
popperOptions: {
|
|
25
|
-
modifiers: [{ name: 'flip', enabled: false }],
|
|
26
|
-
},
|
|
27
|
-
placement: 'bottom-start',
|
|
28
|
-
offset: [-2, 16],
|
|
29
|
-
zIndex: 9999,
|
|
30
|
-
// onHidden: () => {
|
|
31
|
-
// toggleVisible(false)
|
|
32
|
-
// },
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<div className="w-auto px-3 py-2 transition-all !border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-background">
|
|
36
|
-
<ActionButton
|
|
37
|
-
action={addColBefore}
|
|
38
|
-
icon="ColumnAddLeft"
|
|
39
|
-
tooltip={t('editor.table.menu.insertColumnBefore')}
|
|
40
|
-
/>
|
|
41
|
-
<ActionButton
|
|
42
|
-
action={addColAfter}
|
|
43
|
-
icon="ColumnAddRight"
|
|
44
|
-
tooltip={t('editor.table.menu.insertColumnAfter')}
|
|
45
|
-
/>
|
|
46
|
-
<ActionButton
|
|
47
|
-
action={deleteCol}
|
|
48
|
-
icon="DeleteColumn"
|
|
49
|
-
tooltip={t('editor.table.menu.deleteColumn')}
|
|
50
|
-
/>
|
|
51
|
-
<ActionButton
|
|
52
|
-
action={deleteMe}
|
|
53
|
-
icon="Trash2"
|
|
54
|
-
tooltip={t('editor.table.menu.delete_column')}
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
</BubbleMenu>
|
|
58
|
-
);
|
|
59
|
-
}
|