reactjs-tiptap-editor-pro 0.2.28 → 0.2.30
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/package.json +4 -60
- package/src/components/ActionButton.tsx +103 -0
- package/src/components/ActionMenuButton.tsx +76 -0
- package/src/components/BubbleMenu.tsx +93 -0
- package/src/components/CharactorCount.tsx +50 -0
- package/src/components/ColorPicker.tsx +272 -0
- package/src/components/RichTextEditor.tsx +212 -0
- package/src/components/SizeSetter/SizeSetter.tsx +102 -0
- package/src/components/Toolbar.tsx +108 -0
- package/src/components/icons/Activity.tsx +19 -0
- package/src/components/icons/Animas.tsx +24 -0
- package/src/components/icons/AspectRatio.tsx +13 -0
- package/src/components/icons/Blockquote.tsx +17 -0
- package/src/components/icons/ColumnAddLeft.tsx +7 -0
- package/src/components/icons/ColumnAddRight.tsx +7 -0
- package/src/components/icons/DeleteColumn.tsx +26 -0
- package/src/components/icons/DeleteRow.tsx +26 -0
- package/src/components/icons/Direction.tsx +7 -0
- package/src/components/icons/Excalidraw.tsx +7 -0
- package/src/components/icons/ExportPdf.tsx +8 -0
- package/src/components/icons/ExportWord.tsx +24 -0
- package/src/components/icons/FileWordOutline.tsx +13 -0
- package/src/components/icons/Flag.tsx +19 -0
- package/src/components/icons/Food.tsx +20 -0
- package/src/components/icons/GIfIcon.tsx +10 -0
- package/src/components/icons/Icon.tsx +30 -0
- package/src/components/icons/ImportWord.tsx +23 -0
- package/src/components/icons/LeftToRight.tsx +7 -0
- package/src/components/icons/LineHeight.tsx +13 -0
- package/src/components/icons/MenuDown.tsx +24 -0
- package/src/components/icons/Mermaid.tsx +13 -0
- package/src/components/icons/NoFill.tsx +7 -0
- package/src/components/icons/Object.tsx +24 -0
- package/src/components/icons/RightToLeft.tsx +7 -0
- package/src/components/icons/SizeL.tsx +9 -0
- package/src/components/icons/SizeM.tsx +13 -0
- package/src/components/icons/SizeS.tsx +13 -0
- package/src/components/icons/Symbol.tsx +19 -0
- package/src/components/icons/Travel.tsx +24 -0
- package/src/components/icons/Twitter.tsx +7 -0
- package/src/components/icons/icons.ts +212 -0
- package/src/components/icons/index.ts +12 -0
- package/src/components/index.ts +9 -0
- package/src/components/menus/bubble.ts +395 -0
- package/src/components/menus/components/BubbleMenuContent.tsx +15 -0
- package/src/components/menus/components/BubbleMenuDrawer.tsx +128 -0
- package/src/components/menus/components/BubbleMenuExcalidraw.tsx +91 -0
- package/src/components/menus/components/BubbleMenuIframe.tsx +143 -0
- package/src/components/menus/components/BubbleMenuKatex.tsx +136 -0
- package/src/components/menus/components/BubbleMenuLink.tsx +99 -0
- package/src/components/menus/components/BubbleMenuMedia.tsx +235 -0
- package/src/components/menus/components/BubbleMenuMermaid.tsx +128 -0
- package/src/components/menus/components/BubbleMenuText.tsx +102 -0
- package/src/components/menus/components/BubbleMenuTwitter.tsx +91 -0
- package/src/components/menus/components/ColumnsBubbleMenu.tsx +59 -0
- package/src/components/menus/components/ContentMenu.tsx +396 -0
- package/src/components/menus/components/TableBubbleMenu.tsx +362 -0
- package/src/components/menus/index.ts +7 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/dialog.tsx +128 -0
- package/src/components/ui/dropdown-menu.tsx +203 -0
- package/src/components/ui/emoji-picker.tsx +166 -0
- package/src/components/ui/index.ts +14 -0
- package/src/components/ui/input.tsx +25 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/select.tsx +162 -0
- package/src/components/ui/separator.tsx +31 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/tabs.tsx +55 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +129 -0
- package/src/components/ui/toaster.tsx +44 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/components/ui/use-toast.ts +197 -0
- package/src/constants/index.ts +223 -0
- package/src/constants/resetCSS.ts +139 -0
- package/src/extension-bundle.ts +2 -0
- package/src/extensions/Attachment/Attachment.ts +144 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/FileIcon.tsx +69 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/FileIconString.ts +28 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.tsx +155 -0
- package/src/extensions/Attachment/components/NodeViewAttachment/index.module.scss +23 -0
- package/src/extensions/Attachment/index.ts +1 -0
- package/src/extensions/BaseKit.ts +253 -0
- package/src/extensions/Blockquote/Blockquote.ts +31 -0
- package/src/extensions/Blockquote/index.ts +1 -0
- package/src/extensions/Bold/Bold.ts +26 -0
- package/src/extensions/Bold/index.ts +1 -0
- package/src/extensions/BulletList/BulletList.ts +28 -0
- package/src/extensions/BulletList/index.ts +1 -0
- package/src/extensions/Clear/Clear.ts +24 -0
- package/src/extensions/Clear/index.ts +1 -0
- package/src/extensions/Code/Code.ts +26 -0
- package/src/extensions/Code/index.ts +1 -0
- package/src/extensions/CodeBlock/CodeBlock.ts +54 -0
- package/src/extensions/CodeBlock/components/CodeBlockActiveButton.tsx +66 -0
- package/src/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.tsx +89 -0
- package/src/extensions/CodeBlock/components/NodeViewCodeBlock/index.module.scss +81 -0
- package/src/extensions/CodeBlock/highlighter.ts +132 -0
- package/src/extensions/CodeBlock/index.ts +1 -0
- package/src/extensions/CodeBlock/shiki-plugin.ts +213 -0
- package/src/extensions/Color/Color.ts +52 -0
- package/src/extensions/Color/components/ColorActionButton.tsx +104 -0
- package/src/extensions/Color/index.ts +1 -0
- package/src/extensions/Document/Document.ts +8 -0
- package/src/extensions/Document/index.ts +1 -0
- package/src/extensions/Drawer/Drawer.ts +177 -0
- package/src/extensions/Drawer/components/ControlDrawer/ControlDrawer.module.scss +85 -0
- package/src/extensions/Drawer/components/ControlDrawer/ControlDrawer.tsx +598 -0
- package/src/extensions/Drawer/components/ControlDrawer/icon.tsx +500 -0
- package/src/extensions/Drawer/components/DrawerActiveButton.tsx +239 -0
- package/src/extensions/Drawer/components/EditDrawerBlock.tsx +238 -0
- package/src/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.tsx +260 -0
- package/src/extensions/Drawer/index.ts +1 -0
- package/src/extensions/Emoji/Emoji.ts +146 -0
- package/src/extensions/Emoji/components/EmojiList/EmojiList.tsx +103 -0
- package/src/extensions/Emoji/components/EmojiList/emojis.ts +1858 -0
- package/src/extensions/Emoji/components/EmojiPicker/EmojiPicker.tsx +61 -0
- package/src/extensions/Emoji/index.ts +1 -0
- package/src/extensions/Excalidraw/Excalidraw.ts +123 -0
- package/src/extensions/Excalidraw/components/ExcalidrawActiveButton.tsx +138 -0
- package/src/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.tsx +178 -0
- package/src/extensions/Excalidraw/components/NodeViewExcalidraw/index.module.scss +43 -0
- package/src/extensions/Excalidraw/index.ts +1 -0
- package/src/extensions/ExportPdf/ExportPdf.ts +25 -0
- package/src/extensions/ExportPdf/index.ts +1 -0
- package/src/extensions/ExportWord/ExportWord.ts +87 -0
- package/src/extensions/ExportWord/index.ts +1 -0
- package/src/extensions/FontFamily/FontFamily.ts +64 -0
- package/src/extensions/FontFamily/components/FontFamilyButton.tsx +97 -0
- package/src/extensions/FontFamily/index.ts +1 -0
- package/src/extensions/FontSize/FontSize.ts +119 -0
- package/src/extensions/FontSize/components/FontSizeMenuButton.tsx +84 -0
- package/src/extensions/FontSize/index.ts +1 -0
- package/src/extensions/FormatPainter/FormatPainter.ts +121 -0
- package/src/extensions/FormatPainter/index.ts +1 -0
- package/src/extensions/Heading/Heading.ts +57 -0
- package/src/extensions/Heading/components/HeadingButton.tsx +96 -0
- package/src/extensions/Heading/index.ts +1 -0
- package/src/extensions/Highlight/Highlight.ts +36 -0
- package/src/extensions/Highlight/components/HighlightActionButton.tsx +108 -0
- package/src/extensions/Highlight/index.ts +1 -0
- package/src/extensions/History/History.ts +39 -0
- package/src/extensions/History/components/HistoryActionButton.tsx +74 -0
- package/src/extensions/History/index.ts +1 -0
- package/src/extensions/HorizontalRule/HorizontalRule.ts +42 -0
- package/src/extensions/HorizontalRule/index.ts +1 -0
- package/src/extensions/Iframe/Iframe.ts +140 -0
- package/src/extensions/Iframe/components/IframeNodeView.tsx +92 -0
- package/src/extensions/Iframe/components/index.module.scss +40 -0
- package/src/extensions/Iframe/embed.ts +487 -0
- package/src/extensions/Iframe/index.ts +1 -0
- package/src/extensions/Image/Image.ts +303 -0
- package/src/extensions/Image/components/ActionImageButton.tsx +186 -0
- package/src/extensions/Image/components/ImageCropper.tsx +198 -0
- package/src/extensions/Image/components/ImageView.tsx +271 -0
- package/src/extensions/Image/index.ts +1 -0
- package/src/extensions/Image/store.ts +15 -0
- package/src/extensions/ImageGif/ImageGif.ts +176 -0
- package/src/extensions/ImageGif/components/ImageGifActionButton.tsx +138 -0
- package/src/extensions/ImageGif/components/ImageGifView.tsx +260 -0
- package/src/extensions/ImageGif/index.ts +1 -0
- package/src/extensions/ImportWord/ImportWord.ts +52 -0
- package/src/extensions/ImportWord/components/ImportWordButton.tsx +151 -0
- package/src/extensions/ImportWord/index.ts +1 -0
- package/src/extensions/Indent/Indent.ts +110 -0
- package/src/extensions/Indent/index.ts +1 -0
- package/src/extensions/Italic/Italic.ts +29 -0
- package/src/extensions/Italic/index.ts +1 -0
- package/src/extensions/Katex/Katex.ts +109 -0
- package/src/extensions/Katex/components/KatexActiveButton.tsx +117 -0
- package/src/extensions/Katex/components/KatexWrapper.tsx +53 -0
- package/src/extensions/Katex/index.ts +1 -0
- package/src/extensions/LineHeight/LineHeight.ts +76 -0
- package/src/extensions/LineHeight/components/LineHeightDropdown.tsx +93 -0
- package/src/extensions/LineHeight/index.ts +1 -0
- package/src/extensions/Link/Link.ts +92 -0
- package/src/extensions/Link/components/LinkEditBlock.tsx +110 -0
- package/src/extensions/Link/components/LinkEditPopover.tsx +46 -0
- package/src/extensions/Link/components/LinkViewBlock.tsx +54 -0
- package/src/extensions/Link/index.ts +1 -0
- package/src/extensions/ListItem/ListItem.ts +1 -0
- package/src/extensions/ListItem/index.ts +1 -0
- package/src/extensions/Mention/Mention.ts +100 -0
- package/src/extensions/Mention/components/NodeViewMentionList/NodeViewMentionList.tsx +94 -0
- package/src/extensions/Mention/components/NodeViewMentionList/index.module.scss +38 -0
- package/src/extensions/Mention/index.ts +1 -0
- package/src/extensions/Mermaid/Mermaid.ts +177 -0
- package/src/extensions/Mermaid/components/EditMermaidBlock.tsx +155 -0
- package/src/extensions/Mermaid/components/MermaidActiveButton.tsx +151 -0
- package/src/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.tsx +260 -0
- package/src/extensions/Mermaid/index.ts +1 -0
- package/src/extensions/MoreMark/MoreMark.ts +102 -0
- package/src/extensions/MoreMark/components/ActionMoreButton.tsx +97 -0
- package/src/extensions/MoreMark/index.ts +1 -0
- package/src/extensions/MultiColumn/Column.ts +36 -0
- package/src/extensions/MultiColumn/MultiColumn.ts +111 -0
- package/src/extensions/MultiColumn/components/ColumnActionButton.ts +22 -0
- package/src/extensions/MultiColumn/index.ts +3 -0
- package/src/extensions/OrderedList/OrderedList.ts +28 -0
- package/src/extensions/OrderedList/index.ts +1 -0
- package/src/extensions/SearchAndReplace/SearchAndReplace.ts +395 -0
- package/src/extensions/SearchAndReplace/components/SearchAndReplaceButton.tsx +190 -0
- package/src/extensions/SearchAndReplace/index.ts +1 -0
- package/src/extensions/Selection/Selection.ts +32 -0
- package/src/extensions/Selection/index.ts +1 -0
- package/src/extensions/SlashCommand/SlashCommand.ts +255 -0
- package/src/extensions/SlashCommand/components/CommandsList.tsx +180 -0
- package/src/extensions/SlashCommand/groups.ts +183 -0
- package/src/extensions/SlashCommand/index.ts +1 -0
- package/src/extensions/SlashCommand/types.ts +24 -0
- package/src/extensions/Strike/Strike.ts +26 -0
- package/src/extensions/Strike/index.ts +1 -0
- package/src/extensions/Subscript/Subscript.ts +88 -0
- package/src/extensions/Subscript/index.ts +1 -0
- package/src/extensions/Table/Cell.ts +131 -0
- package/src/extensions/Table/Header.ts +93 -0
- package/src/extensions/Table/Row.ts +8 -0
- package/src/extensions/Table/Table.ts +60 -0
- package/src/extensions/Table/cell-background.ts +112 -0
- package/src/extensions/Table/components/CreateTablePopover.tsx +132 -0
- package/src/extensions/Table/components/TableActionButton.tsx +42 -0
- package/src/extensions/Table/index.ts +6 -0
- package/src/extensions/Table/utils.ts +352 -0
- package/src/extensions/TableOfContent/TableOfContent.ts +124 -0
- package/src/extensions/TableOfContent/components/NodeViewTableOfContent.tsx +116 -0
- package/src/extensions/TableOfContent/components/TableOfContentActionButton.tsx +27 -0
- package/src/extensions/TableOfContent/components/index.module.scss +40 -0
- package/src/extensions/TableOfContent/index.ts +1 -0
- package/src/extensions/TaskList/TaskList.ts +46 -0
- package/src/extensions/TaskList/index.ts +1 -0
- package/src/extensions/TextAlign/TextAlign.ts +68 -0
- package/src/extensions/TextAlign/components/TextAlignMenuButton.tsx +103 -0
- package/src/extensions/TextAlign/index.ts +1 -0
- package/src/extensions/TextBubble/TextBubble.ts +22 -0
- package/src/extensions/TextBubble/components/TextDropdown.tsx +146 -0
- package/src/extensions/TextBubble/index.ts +1 -0
- package/src/extensions/TextDirection/TextDirection.ts +97 -0
- package/src/extensions/TextDirection/components/TextDirectionButton.tsx +103 -0
- package/src/extensions/TextDirection/index.ts +1 -0
- package/src/extensions/TrailingNode/TrailingNode.ts +71 -0
- package/src/extensions/TrailingNode/index.ts +1 -0
- package/src/extensions/Twitter/Twitter.ts +161 -0
- package/src/extensions/Twitter/components/FormEditLinkTwitter.tsx +68 -0
- package/src/extensions/Twitter/components/NodeViewTweet.tsx +30 -0
- package/src/extensions/Twitter/components/TwitterActiveButton.tsx +41 -0
- package/src/extensions/Twitter/index.ts +1 -0
- package/src/extensions/UnderLine/Underline.ts +30 -0
- package/src/extensions/UnderLine/index.ts +1 -0
- package/src/extensions/Video/Video.ts +204 -0
- package/src/extensions/Video/components/ActiveVideoButton.tsx +191 -0
- package/src/extensions/Video/index.ts +1 -0
- package/src/extensions/Video/store.ts +15 -0
- package/src/extensions/index.ts +122 -0
- package/src/hooks/useActive.tsx +24 -0
- package/src/hooks/useAttributes.tsx +45 -0
- package/src/hooks/useCopy.tsx +20 -0
- package/src/hooks/useEditorState.tsx +23 -0
- package/src/hooks/useExtension.tsx +29 -0
- package/src/index.ts +8 -0
- package/src/lib/utils.ts +7 -0
- package/src/locale-bundle.ts +3 -0
- package/src/locales/en.ts +173 -0
- package/src/locales/hu.ts +173 -0
- package/src/locales/index.tsx +163 -0
- package/src/locales/pt-br.ts +173 -0
- package/src/locales/vi.ts +173 -0
- package/src/locales/zh-cn.ts +173 -0
- package/src/plugins/DragHandle/index.ts +375 -0
- package/src/plugins/DragHandle/range.ts +114 -0
- package/src/plugins/DragHandle/utils.ts +80 -0
- package/src/plugins/image-upload.ts +160 -0
- package/src/store/ProviderRichText.tsx +53 -0
- package/src/store/editableEditor.ts +15 -0
- package/src/store/fast-context.tsx +70 -0
- package/src/store/store.ts +35 -0
- package/src/styles/ProseMirror.scss +176 -0
- package/src/styles/columns.scss +23 -0
- package/src/styles/editor.scss +411 -0
- package/src/styles/global.scss +87 -0
- package/src/styles/index.scss +5 -0
- package/src/styles/mention.scss +6 -0
- package/src/theme/theme.ts +15 -0
- package/src/types.ts +271 -0
- package/src/utils/_event.ts +55 -0
- package/src/utils/color.ts +67 -0
- package/src/utils/columns.ts +142 -0
- package/src/utils/customEvents/customEvents.ts +18 -0
- package/src/utils/customEvents/events.constant.ts +11 -0
- package/src/utils/delete-node.ts +46 -0
- package/src/utils/dom-dataset.ts +121 -0
- package/src/utils/download.ts +17 -0
- package/src/utils/dynamicCSS.ts +192 -0
- package/src/utils/editor-container-size.ts +28 -0
- package/src/utils/file.ts +112 -0
- package/src/utils/getRenderContainer.ts +41 -0
- package/src/utils/indent.ts +99 -0
- package/src/utils/is-mobile.ts +57 -0
- package/src/utils/json.ts +18 -0
- package/src/utils/line-height.ts +109 -0
- package/src/utils/lru-cache.ts +145 -0
- package/src/utils/mitt.ts +114 -0
- package/src/utils/node.ts +92 -0
- package/src/utils/pdf.ts +72 -0
- package/src/utils/plateform.ts +49 -0
- package/src/utils/shortId.ts +5 -0
- package/src/utils/storage.ts +18 -0
- package/src/utils/utils.ts +71 -0
- package/src/vite-env.d.ts +3 -0
- package/lib/RichTextEditor-BC85Dn21.js +0 -8826
- package/lib/RichTextEditor-Cxm0yJdr.cjs +0 -141
- package/lib/extension-bundle.cjs +0 -33
- package/lib/extension-bundle.d.cts +0 -947
- package/lib/extension-bundle.d.ts +0 -947
- package/lib/extension-bundle.js +0 -5755
- package/lib/index-DV-nXpU1.cjs +0 -1
- package/lib/index-M6H3FoBi.js +0 -1147
- package/lib/index.cjs +0 -1
- package/lib/index.d.cts +0 -511
- package/lib/index.d.ts +0 -511
- package/lib/index.js +0 -16
- package/lib/locale-bundle.cjs +0 -1
- package/lib/locale-bundle.d.cts +0 -1140
- package/lib/locale-bundle.d.ts +0 -1140
- package/lib/locale-bundle.js +0 -9
- package/lib/style.css +0 -1
- package/lib/tiptap-DkWHMWDt.js +0 -6061
- package/lib/tiptap-gBG-1T-V.cjs +0 -116
- package/lib/vendor-BJ0Yf78E.cjs +0 -8114
- package/lib/vendor-Cpa6z-M0.js +0 -67575
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BubbleMenu } from '@tiptap/react';
|
|
4
|
+
import { useAttributes } from '@/hooks/useAttributes';
|
|
5
|
+
import { ActionButton } from '@/components/ActionButton';
|
|
6
|
+
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
|
7
|
+
import { Button, Input } from '@/components/ui';
|
|
8
|
+
import { SizeSetter } from '@/components/SizeSetter/SizeSetter';
|
|
9
|
+
import { useLocale } from '@/locales';
|
|
10
|
+
import type { IIframeAttrs } from '@/extensions/Iframe';
|
|
11
|
+
import { Iframe } from '@/extensions/Iframe';
|
|
12
|
+
import { deleteNode } from '@/utils/delete-node';
|
|
13
|
+
|
|
14
|
+
export function BubbleMenuIframe({ editor }: any) {
|
|
15
|
+
const { t } = useLocale();
|
|
16
|
+
const { width, height, url } = useAttributes<IIframeAttrs>(editor, Iframe.name, {
|
|
17
|
+
width: 0,
|
|
18
|
+
height: 0,
|
|
19
|
+
url: '',
|
|
20
|
+
defaultShowPicker: false,
|
|
21
|
+
});
|
|
22
|
+
const [visible, toggleVisible] = useState(false);
|
|
23
|
+
const [formUrl, setFormUrl] = useState('');
|
|
24
|
+
|
|
25
|
+
const handleCancel = useCallback(() => {
|
|
26
|
+
toggleVisible(false);
|
|
27
|
+
}, [toggleVisible]);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (visible)
|
|
31
|
+
setFormUrl(url as any);
|
|
32
|
+
}, [visible, url]);
|
|
33
|
+
|
|
34
|
+
const handleOk = useCallback(() => {
|
|
35
|
+
editor
|
|
36
|
+
.chain()
|
|
37
|
+
.updateAttributes(Iframe.name, {
|
|
38
|
+
url: formUrl,
|
|
39
|
+
})
|
|
40
|
+
.setNodeSelection(editor.state.selection.from)
|
|
41
|
+
.focus()
|
|
42
|
+
.run();
|
|
43
|
+
toggleVisible(false);
|
|
44
|
+
}, [editor, formUrl, toggleVisible]);
|
|
45
|
+
|
|
46
|
+
const visitLink = useCallback(() => {
|
|
47
|
+
window.open(url, '_blank');
|
|
48
|
+
}, [url]);
|
|
49
|
+
|
|
50
|
+
const openEditLinkModal = useCallback(() => {
|
|
51
|
+
toggleVisible(true);
|
|
52
|
+
}, [toggleVisible]);
|
|
53
|
+
|
|
54
|
+
const setSize = useCallback(
|
|
55
|
+
(size: any) => {
|
|
56
|
+
editor.chain().updateAttributes(Iframe.name, size).setNodeSelection(editor.state.selection.from).focus().run();
|
|
57
|
+
},
|
|
58
|
+
[editor],
|
|
59
|
+
);
|
|
60
|
+
const shouldShow = useCallback(() => editor.isActive(Iframe.name) && !url, [editor, url]);
|
|
61
|
+
const deleteMe = useCallback(() => deleteNode(Iframe.name, editor), [editor]);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<BubbleMenu
|
|
66
|
+
className="bubble-menu"
|
|
67
|
+
editor={editor}
|
|
68
|
+
pluginKey="iframe-bubble-menu"
|
|
69
|
+
shouldShow={shouldShow}
|
|
70
|
+
tippyOptions={{
|
|
71
|
+
popperOptions: {
|
|
72
|
+
modifiers: [{ name: 'flip', enabled: false }],
|
|
73
|
+
},
|
|
74
|
+
placement: 'bottom-start',
|
|
75
|
+
offset: [-2, 16],
|
|
76
|
+
zIndex: 9999,
|
|
77
|
+
// onHidden: () => {
|
|
78
|
+
// toggleVisible(false)
|
|
79
|
+
// },
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
|
|
83
|
+
<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">
|
|
84
|
+
<ActionButton
|
|
85
|
+
action={visitLink}
|
|
86
|
+
icon="Eye"
|
|
87
|
+
tooltip="Visit Link"
|
|
88
|
+
/>
|
|
89
|
+
<ActionButton
|
|
90
|
+
action={openEditLinkModal}
|
|
91
|
+
icon="Pencil"
|
|
92
|
+
tooltip="Open Edit Link"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<SizeSetter width={width as any} height={height as any} onOk={setSize}>
|
|
96
|
+
<ActionButton
|
|
97
|
+
icon="Settings"
|
|
98
|
+
tooltip={t('editor.settings')}
|
|
99
|
+
/>
|
|
100
|
+
</SizeSetter>
|
|
101
|
+
|
|
102
|
+
<ActionButton
|
|
103
|
+
action={deleteMe}
|
|
104
|
+
icon="Trash2"
|
|
105
|
+
tooltip={t('editor.delete')}
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</BubbleMenu>
|
|
109
|
+
|
|
110
|
+
<Dialog
|
|
111
|
+
open={visible}
|
|
112
|
+
onOpenChange={toggleVisible}
|
|
113
|
+
>
|
|
114
|
+
<DialogTrigger />
|
|
115
|
+
|
|
116
|
+
<DialogContent>
|
|
117
|
+
<DialogHeader>
|
|
118
|
+
<DialogTitle>
|
|
119
|
+
Edit Link Iframe
|
|
120
|
+
</DialogTitle>
|
|
121
|
+
</DialogHeader>
|
|
122
|
+
|
|
123
|
+
<Input
|
|
124
|
+
value={formUrl}
|
|
125
|
+
onInput={(e: any) => setFormUrl(e.target.value)}
|
|
126
|
+
type="url"
|
|
127
|
+
autoFocus
|
|
128
|
+
placeholder="Enter link"
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
<DialogFooter>
|
|
132
|
+
<Button onClick={handleCancel}>
|
|
133
|
+
Cancel
|
|
134
|
+
</Button>
|
|
135
|
+
<Button onClick={handleOk}>
|
|
136
|
+
OK
|
|
137
|
+
</Button>
|
|
138
|
+
</DialogFooter>
|
|
139
|
+
</DialogContent>
|
|
140
|
+
</Dialog>
|
|
141
|
+
</>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { BubbleMenu } from '@tiptap/react';
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { HelpCircle, Pencil, Trash2 } from 'lucide-react';
|
|
4
|
+
import katex from 'katex';
|
|
5
|
+
import { Katex } from '@/extensions';
|
|
6
|
+
import { deleteNode } from '@/utils/delete-node';
|
|
7
|
+
import { useAttributes } from '@/hooks/useAttributes';
|
|
8
|
+
import type { IKatexAttrs } from '@/extensions/Katex';
|
|
9
|
+
import { Textarea } from '@/components/ui/textarea';
|
|
10
|
+
import { ActionButton } from '@/components/ActionButton';
|
|
11
|
+
import { Button } from '@/components/ui';
|
|
12
|
+
|
|
13
|
+
function BubbleMenuKatex({ editor, ...props }: any) {
|
|
14
|
+
const attrs = useAttributes<IKatexAttrs>(editor, Katex.name, {
|
|
15
|
+
text: '',
|
|
16
|
+
defaultShowPicker: false,
|
|
17
|
+
});
|
|
18
|
+
const { text, defaultShowPicker } = attrs;
|
|
19
|
+
|
|
20
|
+
const [currentValue, setCurrentValue] = useState('');
|
|
21
|
+
const [visible, toggleVisible] = useState(false);
|
|
22
|
+
|
|
23
|
+
const shouldShow = useCallback(() => editor.isActive(Katex.name), [editor]);
|
|
24
|
+
|
|
25
|
+
const deleteMe = useCallback(() => deleteNode(Katex.name, editor), [editor]);
|
|
26
|
+
|
|
27
|
+
const submit = useCallback(() => {
|
|
28
|
+
editor.chain().focus().setKatex({ text: currentValue }).run();
|
|
29
|
+
toggleVisible(false);
|
|
30
|
+
}, [editor, currentValue]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (defaultShowPicker) {
|
|
34
|
+
toggleVisible(true);
|
|
35
|
+
editor.chain().updateAttributes(Katex.name, { defaultShowPicker: false }).focus().run();
|
|
36
|
+
}
|
|
37
|
+
}, [editor, defaultShowPicker, toggleVisible]);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (visible)
|
|
41
|
+
setCurrentValue(text || '');
|
|
42
|
+
}, [visible]);
|
|
43
|
+
|
|
44
|
+
const formatText = useMemo(() => {
|
|
45
|
+
try {
|
|
46
|
+
return katex.renderToString(`${currentValue}`);
|
|
47
|
+
} catch {
|
|
48
|
+
return currentValue;
|
|
49
|
+
}
|
|
50
|
+
}, [currentValue]);
|
|
51
|
+
|
|
52
|
+
const previewContent = useMemo(
|
|
53
|
+
() => {
|
|
54
|
+
if (`${currentValue}`.trim()) {
|
|
55
|
+
return (
|
|
56
|
+
<span contentEditable={false} dangerouslySetInnerHTML={{ __html: formatText || '' }}></span>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null;
|
|
61
|
+
},
|
|
62
|
+
[currentValue, formatText],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<BubbleMenu
|
|
67
|
+
editor={editor}
|
|
68
|
+
pluginKey="Katex-bubble-menu"
|
|
69
|
+
shouldShow={shouldShow}
|
|
70
|
+
tippyOptions={{
|
|
71
|
+
popperOptions: {
|
|
72
|
+
modifiers: [{ name: 'flip', enabled: false }],
|
|
73
|
+
},
|
|
74
|
+
placement: 'bottom-start',
|
|
75
|
+
offset: [-2, 16],
|
|
76
|
+
zIndex: 9999,
|
|
77
|
+
onHidden: () => {
|
|
78
|
+
toggleVisible(false);
|
|
79
|
+
},
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{props?.disabled
|
|
83
|
+
? (
|
|
84
|
+
<></>
|
|
85
|
+
)
|
|
86
|
+
: (
|
|
87
|
+
<div className="p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800">
|
|
88
|
+
{visible
|
|
89
|
+
? (
|
|
90
|
+
<>
|
|
91
|
+
<Textarea
|
|
92
|
+
value={currentValue}
|
|
93
|
+
onChange={e => setCurrentValue(e.target.value)}
|
|
94
|
+
autoFocus
|
|
95
|
+
placeholder="Formula text"
|
|
96
|
+
rows={3}
|
|
97
|
+
defaultValue={text}
|
|
98
|
+
style={{ marginBottom: 8 }}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
{previewContent && (
|
|
102
|
+
<div className="my-[10px] p-[10px] rounded-[6px] !border-[1px] whitespace-nowrap overflow-auto">
|
|
103
|
+
{previewContent}
|
|
104
|
+
</div>
|
|
105
|
+
)}
|
|
106
|
+
|
|
107
|
+
<div className="flex items-center justify-between gap-[6px]">
|
|
108
|
+
<Button onClick={submit} className="flex-1">
|
|
109
|
+
Submit
|
|
110
|
+
</Button>
|
|
111
|
+
|
|
112
|
+
<a href="https://katex.org/docs/supported" target="_blank" rel="noreferrer noopener">
|
|
113
|
+
<HelpCircle size={16} />
|
|
114
|
+
</a>
|
|
115
|
+
</div>
|
|
116
|
+
</>
|
|
117
|
+
)
|
|
118
|
+
: (
|
|
119
|
+
<div className="flex items-center justify-center gap-[6px]">
|
|
120
|
+
<ActionButton tooltip="Edit" action={() => toggleVisible(!visible)}>
|
|
121
|
+
<Pencil size={16} />
|
|
122
|
+
</ActionButton>
|
|
123
|
+
|
|
124
|
+
<ActionButton tooltip="Delete" action={deleteMe}>
|
|
125
|
+
<Trash2 size={16} />
|
|
126
|
+
</ActionButton>
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
</BubbleMenu>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export default BubbleMenuKatex;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Editor } from '@tiptap/react';
|
|
4
|
+
import { BubbleMenu } from '@tiptap/react';
|
|
5
|
+
|
|
6
|
+
import LinkEditBlock from '@/extensions/Link/components/LinkEditBlock';
|
|
7
|
+
import LinkViewBlock from '@/extensions/Link/components/LinkViewBlock';
|
|
8
|
+
|
|
9
|
+
export interface BubbleMenuLinkProps {
|
|
10
|
+
editor: Editor
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function BubbleMenuLink({ editor, disabled }: BubbleMenuLinkProps) {
|
|
15
|
+
const [showEdit, setShowEdit] = useState(false);
|
|
16
|
+
|
|
17
|
+
const link = useMemo(() => {
|
|
18
|
+
const { href: link } = editor.getAttributes('link');
|
|
19
|
+
return link as string;
|
|
20
|
+
}, [editor]);
|
|
21
|
+
|
|
22
|
+
const shouldShow = useCallback(({ editor }: { editor: Editor }) => {
|
|
23
|
+
const isActive = editor.isActive('link');
|
|
24
|
+
return isActive;
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
const onSetLink = (url: string, text?: string, openInNewTab?: boolean) => {
|
|
28
|
+
editor
|
|
29
|
+
.chain()
|
|
30
|
+
.extendMarkRange('link')
|
|
31
|
+
.insertContent({
|
|
32
|
+
type: 'text',
|
|
33
|
+
text,
|
|
34
|
+
marks: [
|
|
35
|
+
{
|
|
36
|
+
type: 'link',
|
|
37
|
+
attrs: {
|
|
38
|
+
href: url,
|
|
39
|
+
target: openInNewTab ? '_blank' : '',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
.setLink({ href: url })
|
|
45
|
+
.focus()
|
|
46
|
+
.run();
|
|
47
|
+
setShowEdit(false);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const unSetLink = useCallback(() => {
|
|
51
|
+
editor.chain().extendMarkRange('link').unsetLink().focus().run();
|
|
52
|
+
setShowEdit(false);
|
|
53
|
+
}, [editor]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<BubbleMenu
|
|
58
|
+
editor={editor}
|
|
59
|
+
shouldShow={shouldShow}
|
|
60
|
+
tippyOptions={{
|
|
61
|
+
popperOptions: {
|
|
62
|
+
modifiers: [{ name: 'flip', enabled: false }],
|
|
63
|
+
},
|
|
64
|
+
placement: 'bottom-start',
|
|
65
|
+
offset: [-2, 16],
|
|
66
|
+
zIndex: 9999,
|
|
67
|
+
onHidden: () => {
|
|
68
|
+
setShowEdit(false);
|
|
69
|
+
},
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{disabled
|
|
73
|
+
? (
|
|
74
|
+
<></>
|
|
75
|
+
)
|
|
76
|
+
: (
|
|
77
|
+
<>
|
|
78
|
+
{showEdit
|
|
79
|
+
? (
|
|
80
|
+
<LinkEditBlock onSetLink={onSetLink} editor={editor} />
|
|
81
|
+
)
|
|
82
|
+
: (
|
|
83
|
+
<LinkViewBlock
|
|
84
|
+
editor={editor}
|
|
85
|
+
onClear={unSetLink}
|
|
86
|
+
onEdit={() => {
|
|
87
|
+
setShowEdit(true);
|
|
88
|
+
}}
|
|
89
|
+
link={link}
|
|
90
|
+
/>
|
|
91
|
+
)}
|
|
92
|
+
</>
|
|
93
|
+
)}
|
|
94
|
+
</BubbleMenu>
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { BubbleMenuLink };
|
|
@@ -0,0 +1,235 @@
|
|
|
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 '@/components';
|
|
7
|
+
import { Image, ImageGif, Video } from '@/extensions';
|
|
8
|
+
import { useLocale } from '@/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 };
|