reactjs-tiptap-editor-pro 0.2.30 → 0.2.32
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/RichTextEditor-BwbqJLnA.cjs +141 -0
- package/lib/RichTextEditor-iGJ6-rbq.js +8833 -0
- package/lib/extension-bundle.cjs +33 -0
- package/lib/extension-bundle.d.cts +947 -0
- package/lib/extension-bundle.d.ts +947 -0
- package/lib/extension-bundle.js +5755 -0
- package/lib/index-DV-nXpU1.cjs +1 -0
- package/lib/index-M6H3FoBi.js +1147 -0
- package/lib/index.cjs +1 -0
- package/lib/index.d.cts +513 -0
- package/lib/index.d.ts +513 -0
- package/lib/index.js +16 -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/style.css +1 -0
- package/lib/tiptap-DkWHMWDt.js +6061 -0
- package/lib/tiptap-gBG-1T-V.cjs +116 -0
- package/lib/vendor-BJ0Yf78E.cjs +8114 -0
- package/lib/vendor-Cpa6z-M0.js +67575 -0
- package/package.json +60 -4
- 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,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { truncate } from 'lodash-es';
|
|
4
|
-
|
|
5
|
-
import { ActionButton, Separator } from '@/components';
|
|
6
|
-
import { useLocale } from '@/locales';
|
|
7
|
-
|
|
8
|
-
interface IPropsLinkViewBlock {
|
|
9
|
-
editor: any
|
|
10
|
-
link: string
|
|
11
|
-
onClear?: any
|
|
12
|
-
onEdit?: any
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function LinkViewBlock(props: IPropsLinkViewBlock) {
|
|
16
|
-
const { t } = useLocale();
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div className="flex items-center gap-2 p-2 bg-white !border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800">
|
|
20
|
-
<a
|
|
21
|
-
href={props?.link}
|
|
22
|
-
target="_blank"
|
|
23
|
-
rel="noopener noreferrer"
|
|
24
|
-
className="text-sm underline break-all"
|
|
25
|
-
>
|
|
26
|
-
{truncate(props?.link, {
|
|
27
|
-
length: 50,
|
|
28
|
-
omission: '…',
|
|
29
|
-
})}
|
|
30
|
-
</a>
|
|
31
|
-
{props?.link && <Separator orientation="vertical" className="!h-4" />}
|
|
32
|
-
<div className="flex flex-nowrap">
|
|
33
|
-
<ActionButton
|
|
34
|
-
icon="Pencil"
|
|
35
|
-
tooltip={t('editor.link.edit.tooltip')}
|
|
36
|
-
action={() => {
|
|
37
|
-
props?.onEdit();
|
|
38
|
-
}}
|
|
39
|
-
tooltipOptions={{ sideOffset: 15 }}
|
|
40
|
-
/>
|
|
41
|
-
<ActionButton
|
|
42
|
-
icon="Unlink"
|
|
43
|
-
tooltip={t('editor.link.unlink.tooltip')}
|
|
44
|
-
action={() => {
|
|
45
|
-
props?.onClear();
|
|
46
|
-
}}
|
|
47
|
-
tooltipOptions={{ sideOffset: 15 }}
|
|
48
|
-
/>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default LinkViewBlock;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Link';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@tiptap/extension-list-item';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ListItem';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import BulitInMention from '@tiptap/extension-mention';
|
|
2
|
-
// import { getMentionUser } from 'services/user'
|
|
3
|
-
// import { MentionList } from '@/wrappers/mention-list'
|
|
4
|
-
import { ReactRenderer } from '@tiptap/react';
|
|
5
|
-
import tippy from 'tippy.js';
|
|
6
|
-
import { getDatasetAttribute } from '@/utils/dom-dataset';
|
|
7
|
-
import { NodeViewMentionList } from '@/extensions/Mention/components/NodeViewMentionList/NodeViewMentionList';
|
|
8
|
-
|
|
9
|
-
const MOCK_USERS = [
|
|
10
|
-
{
|
|
11
|
-
id: '1',
|
|
12
|
-
name: 'John Doe',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: '2',
|
|
16
|
-
name: 'Jane Doe',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: '3',
|
|
20
|
-
name: 'Alice',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: '4',
|
|
24
|
-
name: 'Bob',
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const suggestion = {
|
|
29
|
-
items: async ({ query }: any) => {
|
|
30
|
-
const data = MOCK_USERS.map(item => item.name);
|
|
31
|
-
return data.filter(item => item.toLowerCase().startsWith(query.toLowerCase()));
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
render: () => {
|
|
35
|
-
let component: any;
|
|
36
|
-
let popup: any;
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
onStart: (props: any) => {
|
|
40
|
-
component = new ReactRenderer(NodeViewMentionList, {
|
|
41
|
-
props,
|
|
42
|
-
editor: props.editor,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
popup = tippy('body', {
|
|
46
|
-
getReferenceClientRect: props.clientRect,
|
|
47
|
-
appendTo: () => document.body,
|
|
48
|
-
content: component.element,
|
|
49
|
-
showOnCreate: true,
|
|
50
|
-
interactive: true,
|
|
51
|
-
trigger: 'manual',
|
|
52
|
-
placement: 'bottom-start',
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
onUpdate(props: any) {
|
|
57
|
-
component.updateProps(props);
|
|
58
|
-
|
|
59
|
-
popup[0].setProps({
|
|
60
|
-
getReferenceClientRect: props.clientRect,
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
onKeyDown(props: any) {
|
|
65
|
-
if (props.event.key === 'Escape') {
|
|
66
|
-
popup[0].hide();
|
|
67
|
-
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return component.ref?.onKeyDown(props);
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
onExit() {
|
|
75
|
-
popup[0].destroy();
|
|
76
|
-
component.destroy();
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
} as any;
|
|
81
|
-
|
|
82
|
-
export const Mention = BulitInMention.extend({
|
|
83
|
-
addAttributes() {
|
|
84
|
-
return {
|
|
85
|
-
id: {
|
|
86
|
-
default: '',
|
|
87
|
-
parseHTML: getDatasetAttribute('id'),
|
|
88
|
-
},
|
|
89
|
-
label: {
|
|
90
|
-
default: '',
|
|
91
|
-
parseHTML: getDatasetAttribute('label'),
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
}).configure({
|
|
96
|
-
HTMLAttributes: {
|
|
97
|
-
class: 'mention',
|
|
98
|
-
},
|
|
99
|
-
suggestion,
|
|
100
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
|
-
/* eslint-disable react/display-name */
|
|
4
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
import type { Editor } from '@tiptap/core';
|
|
7
|
-
import clsx from 'clsx';
|
|
8
|
-
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
9
|
-
|
|
10
|
-
import styles from './index.module.scss';
|
|
11
|
-
|
|
12
|
-
interface IProps {
|
|
13
|
-
editor: Editor
|
|
14
|
-
items: Array<string>
|
|
15
|
-
command: any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const NodeViewMentionList: React.FC<IProps> = forwardRef((props, ref) => {
|
|
19
|
-
const $container: any = useRef<HTMLDivElement>(null);
|
|
20
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
21
|
-
|
|
22
|
-
const selectItem = (index: any) => {
|
|
23
|
-
const userName = props.items[index];
|
|
24
|
-
if (!userName)
|
|
25
|
-
return;
|
|
26
|
-
props.command({ id: userName, label: userName });
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const upHandler = () => {
|
|
30
|
-
setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const downHandler = () => {
|
|
34
|
-
setSelectedIndex((selectedIndex + 1) % props.items.length);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const enterHandler = () => {
|
|
38
|
-
selectItem(selectedIndex);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
useEffect(() => setSelectedIndex(0), [props.items]);
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (Number.isNaN(selectedIndex + 1))
|
|
45
|
-
return;
|
|
46
|
-
const el = $container.current.querySelector(`span:nth-of-type(${selectedIndex + 1})`);
|
|
47
|
-
el && scrollIntoView(el, { behavior: 'smooth', scrollMode: 'if-needed' });
|
|
48
|
-
}, [selectedIndex]);
|
|
49
|
-
|
|
50
|
-
useImperativeHandle(ref, () => ({
|
|
51
|
-
onKeyDown: ({ event }: any) => {
|
|
52
|
-
if (event.key === 'ArrowUp') {
|
|
53
|
-
upHandler();
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (event.key === 'ArrowDown') {
|
|
58
|
-
downHandler();
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (event.key === 'Enter') {
|
|
63
|
-
enterHandler();
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return false;
|
|
68
|
-
},
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<div className={clsx('listUsers', styles.listUsers)}>
|
|
73
|
-
<div ref={$container}>
|
|
74
|
-
{props.items.length > 0
|
|
75
|
-
? (
|
|
76
|
-
props.items.map((item, index) => (
|
|
77
|
-
<span
|
|
78
|
-
className={clsx('itemUser', styles.itemUser, index === selectedIndex ? styles.selectedUser : '')}
|
|
79
|
-
key={index}
|
|
80
|
-
onClick={() => selectItem(index)}
|
|
81
|
-
>
|
|
82
|
-
{item}
|
|
83
|
-
</span>
|
|
84
|
-
))
|
|
85
|
-
)
|
|
86
|
-
: (
|
|
87
|
-
<div className={clsx('itemUserEmpty', styles.itemUser)}>
|
|
88
|
-
Empty
|
|
89
|
-
</div>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
);
|
|
94
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
.listUsers {
|
|
2
|
-
width: 160px;
|
|
3
|
-
max-height: 320px;
|
|
4
|
-
overflow-x: hidden;
|
|
5
|
-
overflow-y: auto;
|
|
6
|
-
border-radius: 4px;
|
|
7
|
-
box-shadow: rgb(9 30 66 / 31%) 0 0 1px, rgb(9 30 66 / 25%) 0 4px 8px -2px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.itemUser {
|
|
11
|
-
display: flex;
|
|
12
|
-
width: 100%;
|
|
13
|
-
padding: 12px 12px 11px;
|
|
14
|
-
color: rgb(9 30 66);
|
|
15
|
-
text-decoration: none;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
background-color: rgb(255 255 255);
|
|
18
|
-
border: 0;
|
|
19
|
-
border-radius: 0;
|
|
20
|
-
flex: 0 0 auto;
|
|
21
|
-
align-items: center;
|
|
22
|
-
|
|
23
|
-
&:hover {
|
|
24
|
-
background-color: #f4f5f7;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
img {
|
|
28
|
-
width: 1em;
|
|
29
|
-
height: 1em;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.selectedUser {
|
|
34
|
-
color: rgb(0 82 204);
|
|
35
|
-
text-decoration: none;
|
|
36
|
-
background-color: rgb(222 235 255);
|
|
37
|
-
fill: rgb(222 235 255);
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Mention';
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
-
import type { CommandProps } from '@tiptap/core';
|
|
3
|
-
import { mergeAttributes } from '@tiptap/core';
|
|
4
|
-
import TiptapImage from '@tiptap/extension-image';
|
|
5
|
-
import { ReactNodeViewRenderer } from '@tiptap/react';
|
|
6
|
-
|
|
7
|
-
import { MermaidActiveButton } from '@/extensions/Mermaid/components/MermaidActiveButton';
|
|
8
|
-
import { NodeViewMermaid } from '@/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid';
|
|
9
|
-
import type { GeneralOptions } from '@/types';
|
|
10
|
-
|
|
11
|
-
declare module '@tiptap/core' {
|
|
12
|
-
interface Commands<ReturnType> {
|
|
13
|
-
mermaid: {
|
|
14
|
-
setMermaid: (options: any, replace?: any) => ReturnType
|
|
15
|
-
setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface MermaidOptions extends GeneralOptions<MermaidOptions> {
|
|
21
|
-
/** Function for uploading files */
|
|
22
|
-
upload?: (file: File) => Promise<string>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const Mermaid = TiptapImage.extend<MermaidOptions>({
|
|
26
|
-
name: 'mermaid',
|
|
27
|
-
|
|
28
|
-
addOptions() {
|
|
29
|
-
return {
|
|
30
|
-
...this.parent?.(),
|
|
31
|
-
inline: false,
|
|
32
|
-
content: '',
|
|
33
|
-
marks: '',
|
|
34
|
-
group: 'block',
|
|
35
|
-
draggable: false,
|
|
36
|
-
selectable: true,
|
|
37
|
-
atom: true,
|
|
38
|
-
HTMLAttributes: {
|
|
39
|
-
class: 'mermaid',
|
|
40
|
-
},
|
|
41
|
-
button: ({ editor, t, extension }: any) => ({
|
|
42
|
-
component: MermaidActiveButton,
|
|
43
|
-
componentProps: {
|
|
44
|
-
action: () => {
|
|
45
|
-
return true;
|
|
46
|
-
},
|
|
47
|
-
isActive: () => false,
|
|
48
|
-
disabled: false,
|
|
49
|
-
editor,
|
|
50
|
-
icon: 'Mermaid',
|
|
51
|
-
tooltip: t('editor.mermaid.tooltip'),
|
|
52
|
-
upload: extension?.options?.upload,
|
|
53
|
-
},
|
|
54
|
-
}),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
addAttributes() {
|
|
59
|
-
return {
|
|
60
|
-
...this.parent?.(),
|
|
61
|
-
width: {
|
|
62
|
-
default: null,
|
|
63
|
-
parseHTML: (element) => {
|
|
64
|
-
const img = element.querySelector('img') as any;
|
|
65
|
-
|
|
66
|
-
const width = img?.getAttribute('width');
|
|
67
|
-
|
|
68
|
-
return width ? Number.parseInt(width, 10) : 320;
|
|
69
|
-
},
|
|
70
|
-
renderHTML: (attributes) => {
|
|
71
|
-
return {
|
|
72
|
-
width: attributes.width,
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
height: {
|
|
77
|
-
default: null,
|
|
78
|
-
parseHTML: (element) => {
|
|
79
|
-
const img = element.querySelector('img') as any;
|
|
80
|
-
|
|
81
|
-
const height = img?.getAttribute('height');
|
|
82
|
-
|
|
83
|
-
return height ? Number.parseInt(height, 10) : 212;
|
|
84
|
-
},
|
|
85
|
-
renderHTML: (attributes) => {
|
|
86
|
-
return {
|
|
87
|
-
height: attributes.height,
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
align: {
|
|
92
|
-
default: 'center',
|
|
93
|
-
parseHTML: element => element.getAttribute('align'),
|
|
94
|
-
renderHTML: (attributes) => {
|
|
95
|
-
return {
|
|
96
|
-
align: attributes.align,
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
addNodeView() {
|
|
104
|
-
return ReactNodeViewRenderer(NodeViewMermaid);
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
addCommands() {
|
|
109
|
-
return {
|
|
110
|
-
setMermaid:
|
|
111
|
-
(
|
|
112
|
-
options: { src: string, alt?: string },
|
|
113
|
-
replace?: boolean,
|
|
114
|
-
) =>
|
|
115
|
-
({ commands, editor }: CommandProps) => {
|
|
116
|
-
if (replace) {
|
|
117
|
-
return commands.insertContent({
|
|
118
|
-
type: this.name,
|
|
119
|
-
attrs: options,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return commands.insertContentAt(editor.state.selection.anchor, {
|
|
123
|
-
type: this.name,
|
|
124
|
-
attrs: options,
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
setAlignImageMermaid:
|
|
129
|
-
(align: any) =>
|
|
130
|
-
({ commands }: any) => {
|
|
131
|
-
return commands.updateAttributes(this.name, { align });
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
renderHTML({ HTMLAttributes }) {
|
|
137
|
-
const { align } = HTMLAttributes;
|
|
138
|
-
|
|
139
|
-
const style = align ? `text-align: ${align};` : '';
|
|
140
|
-
return [
|
|
141
|
-
'div', // Parent element
|
|
142
|
-
{
|
|
143
|
-
style,
|
|
144
|
-
class: 'imageMermaid',
|
|
145
|
-
},
|
|
146
|
-
[
|
|
147
|
-
'img',
|
|
148
|
-
mergeAttributes(
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
this.options.HTMLAttributes,
|
|
151
|
-
HTMLAttributes,
|
|
152
|
-
),
|
|
153
|
-
],
|
|
154
|
-
];
|
|
155
|
-
},
|
|
156
|
-
parseHTML() {
|
|
157
|
-
return [
|
|
158
|
-
{
|
|
159
|
-
tag: 'div[class=imageMermaid]',
|
|
160
|
-
getAttrs: (element) => {
|
|
161
|
-
const img = element.querySelector('img');
|
|
162
|
-
|
|
163
|
-
const width = img?.getAttribute('width');
|
|
164
|
-
const height = img?.getAttribute('height');
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
src: img?.getAttribute('src'),
|
|
168
|
-
alt: img?.getAttribute('alt'),
|
|
169
|
-
width: width ? Number.parseInt(width, 10) : null,
|
|
170
|
-
height: height ? Number.parseInt(height, 10) : null,
|
|
171
|
-
align: img?.getAttribute('align') || element.style.textAlign || null,
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
];
|
|
176
|
-
},
|
|
177
|
-
});
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import type { Editor } from '@tiptap/core';
|
|
5
|
-
import mermaid from 'mermaid';
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import svg64 from 'svg64';
|
|
8
|
-
|
|
9
|
-
import { ActionButton } from '@/components/ActionButton';
|
|
10
|
-
import { Button } from '@/components/ui';
|
|
11
|
-
import { Dialog, DialogContent, DialogFooter, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
|
12
|
-
import { Textarea } from '@/components/ui/textarea';
|
|
13
|
-
import { dataURLtoFile } from '@/utils/file';
|
|
14
|
-
import { shortId } from '@/utils/shortId';
|
|
15
|
-
|
|
16
|
-
interface IProps {
|
|
17
|
-
editor: Editor, attrs?: any, extension?: any
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const defaultCode = 'graph TB\na-->b';
|
|
21
|
-
|
|
22
|
-
export const EditMermaidBlock: React.FC<IProps> = ({ editor, attrs, extension }) => {
|
|
23
|
-
const { alt, align } = attrs;
|
|
24
|
-
const [mermaidCode, setMermaidCode] = useState(decodeURIComponent(alt ?? defaultCode));
|
|
25
|
-
const [svgCode, setSvgCode] = useState('');
|
|
26
|
-
const [visible, toggleVisible] = useState(false);
|
|
27
|
-
const mermaidRef = useRef<HTMLElement | null>(null);
|
|
28
|
-
|
|
29
|
-
const upload = extension?.options.upload;
|
|
30
|
-
|
|
31
|
-
const renderMermaid = async (value: any) => {
|
|
32
|
-
try {
|
|
33
|
-
const { svg } = await mermaid.render('mermaid-svg', value);
|
|
34
|
-
setSvgCode(svg);
|
|
35
|
-
} catch {
|
|
36
|
-
setSvgCode('');
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const mermaidInit = () => {
|
|
41
|
-
mermaid.initialize({
|
|
42
|
-
darkMode: false,
|
|
43
|
-
startOnLoad: false,
|
|
44
|
-
// fontFamily:'',
|
|
45
|
-
fontSize: 12,
|
|
46
|
-
theme: 'base',
|
|
47
|
-
});
|
|
48
|
-
renderMermaid(mermaidCode);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (visible) {
|
|
53
|
-
mermaidInit();
|
|
54
|
-
}
|
|
55
|
-
}, [visible]);
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (visible) {
|
|
59
|
-
renderMermaid(mermaidCode);
|
|
60
|
-
}
|
|
61
|
-
}, [mermaidCode]);
|
|
62
|
-
|
|
63
|
-
const setMermaid = async () => {
|
|
64
|
-
if (mermaidCode === '') {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (mermaidCode) {
|
|
68
|
-
const svg = mermaidRef.current!.querySelector('svg') as unknown as HTMLElement;
|
|
69
|
-
const { width, height } = svg.getBoundingClientRect();
|
|
70
|
-
const name = `mermaid-${shortId()}.svg`;
|
|
71
|
-
// const { size } = new Blob([svg.outerHTML], {
|
|
72
|
-
// type: 'image/svg+xml',
|
|
73
|
-
// })
|
|
74
|
-
|
|
75
|
-
let src = svg64(svg.outerHTML);
|
|
76
|
-
|
|
77
|
-
if (upload) {
|
|
78
|
-
const file = dataURLtoFile(src, name);
|
|
79
|
-
src = await upload(file);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
editor
|
|
83
|
-
?.chain()
|
|
84
|
-
.focus()
|
|
85
|
-
.setMermaid(
|
|
86
|
-
{
|
|
87
|
-
type: 'mermaid',
|
|
88
|
-
src,
|
|
89
|
-
alt: encodeURIComponent(mermaidCode),
|
|
90
|
-
width,
|
|
91
|
-
height,
|
|
92
|
-
},
|
|
93
|
-
!!mermaidCode,
|
|
94
|
-
)
|
|
95
|
-
.run();
|
|
96
|
-
editor?.commands.setAlignImageMermaid(align);
|
|
97
|
-
}
|
|
98
|
-
toggleVisible(false);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<Dialog
|
|
103
|
-
onOpenChange={toggleVisible}
|
|
104
|
-
open={visible}
|
|
105
|
-
>
|
|
106
|
-
<DialogTrigger asChild>
|
|
107
|
-
<ActionButton
|
|
108
|
-
action={() => toggleVisible(true)}
|
|
109
|
-
icon="Pencil"
|
|
110
|
-
tooltip="Edit Mermaid"
|
|
111
|
-
/>
|
|
112
|
-
</DialogTrigger>
|
|
113
|
-
|
|
114
|
-
<DialogContent className="z-[99999] !max-w-[1300px]">
|
|
115
|
-
<DialogTitle>
|
|
116
|
-
Edit Mermaid
|
|
117
|
-
</DialogTitle>
|
|
118
|
-
|
|
119
|
-
<div style={{ height: '100%', border: '1px solid hsl(var(--border))' }}>
|
|
120
|
-
<div className="flex gap-[10px] rounded-[10px] p-[10px]">
|
|
121
|
-
<Textarea
|
|
122
|
-
autoFocus
|
|
123
|
-
className="flex-1"
|
|
124
|
-
defaultValue={defaultCode}
|
|
125
|
-
onChange={e => setMermaidCode(e.target.value)}
|
|
126
|
-
placeholder="Text"
|
|
127
|
-
required
|
|
128
|
-
rows={10}
|
|
129
|
-
value={mermaidCode}
|
|
130
|
-
style={{
|
|
131
|
-
color: 'hsl(var(--foreground))',
|
|
132
|
-
}}
|
|
133
|
-
/>
|
|
134
|
-
|
|
135
|
-
<div
|
|
136
|
-
className="flex flex-1 items-center justify-center rounded-[10px] p-[10px]"
|
|
137
|
-
dangerouslySetInnerHTML={{ __html: svgCode }}
|
|
138
|
-
ref={mermaidRef as any}
|
|
139
|
-
style={{ height: '100%', border: '1px solid hsl(var(--border))', minHeight: 500, background: '#fff' }}
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<DialogFooter>
|
|
145
|
-
<Button
|
|
146
|
-
onClick={setMermaid}
|
|
147
|
-
type="button"
|
|
148
|
-
>
|
|
149
|
-
Save changes
|
|
150
|
-
</Button>
|
|
151
|
-
</DialogFooter>
|
|
152
|
-
</DialogContent>
|
|
153
|
-
</Dialog>
|
|
154
|
-
);
|
|
155
|
-
};
|