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,183 +0,0 @@
|
|
|
1
|
-
import type { Extensions } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
import { Image, Video, type HeadingOptions } from '@/extensions';
|
|
4
|
-
import { actionDialogImage } from '@/extensions/Image/store';
|
|
5
|
-
import { actionDialogVideo } from '@/extensions/Video/store';
|
|
6
|
-
import { localeActions } from '@/locales';
|
|
7
|
-
|
|
8
|
-
import type { SlashCommandOptions } from './SlashCommand';
|
|
9
|
-
import type { Group } from './types';
|
|
10
|
-
|
|
11
|
-
export function renderGroups(extensions: Extensions, renderGroupItem?: SlashCommandOptions['renderGroupItem']) {
|
|
12
|
-
const groups: Group[] = [
|
|
13
|
-
{
|
|
14
|
-
name: 'format',
|
|
15
|
-
title: localeActions.t('editor.slash.format'),
|
|
16
|
-
commands: [],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'insert',
|
|
20
|
-
title: localeActions.t('editor.slash.insert'),
|
|
21
|
-
commands: [],
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
extensions.forEach((extension) => {
|
|
26
|
-
/* Format */
|
|
27
|
-
if (extension.name.toLowerCase() === 'heading') {
|
|
28
|
-
extension.options.levels.forEach((level: HeadingOptions['levels'][number]) => {
|
|
29
|
-
groups[0].commands.push({
|
|
30
|
-
name: `heading${level}`,
|
|
31
|
-
label: localeActions.t(`editor.heading.h${level}.tooltip`),
|
|
32
|
-
aliases: [`h${level}`, 'bt', `bt${level}`],
|
|
33
|
-
iconName: `Heading${level}`,
|
|
34
|
-
action: ({ editor, range }) => {
|
|
35
|
-
editor.chain().focus().deleteRange(range).setHeading({ level }).run();
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (extension.name.toLowerCase() === 'bulletlist') {
|
|
42
|
-
groups[0].commands.push({
|
|
43
|
-
name: 'bulletList',
|
|
44
|
-
label: localeActions.t('editor.bulletlist.tooltip'),
|
|
45
|
-
aliases: ['ul', 'yxlb'],
|
|
46
|
-
iconName: 'List',
|
|
47
|
-
action: ({ editor, range }) => {
|
|
48
|
-
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (extension.name.toLowerCase() === 'orderedlist') {
|
|
54
|
-
groups[0].commands.push({
|
|
55
|
-
name: 'numberedList',
|
|
56
|
-
label: localeActions.t('editor.orderedlist.tooltip'),
|
|
57
|
-
aliases: ['ol', 'yxlb'],
|
|
58
|
-
iconName: 'ListOrdered',
|
|
59
|
-
action: ({ editor, range }) => {
|
|
60
|
-
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (extension.name.toLowerCase() === 'tasklist') {
|
|
66
|
-
groups[0].commands.push({
|
|
67
|
-
name: 'taskList',
|
|
68
|
-
label: localeActions.t('editor.tasklist.tooltip'),
|
|
69
|
-
iconName: 'ListTodo',
|
|
70
|
-
description: 'Task list with todo items',
|
|
71
|
-
aliases: ['todo'],
|
|
72
|
-
action: ({ editor, range }) => {
|
|
73
|
-
editor.chain().focus().deleteRange(range).toggleTaskList().run();
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (extension.name.toLowerCase() === 'blockquote') {
|
|
79
|
-
groups[0].commands.push({
|
|
80
|
-
name: 'blockquote',
|
|
81
|
-
label: localeActions.t('editor.blockquote.tooltip'),
|
|
82
|
-
description: '插入引入格式',
|
|
83
|
-
aliases: ['yr'],
|
|
84
|
-
iconName: 'TextQuote',
|
|
85
|
-
action: ({ editor, range }) => {
|
|
86
|
-
editor.chain().focus().deleteRange(range).setBlockquote().run();
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (extension.name.toLowerCase() === 'codeblock') {
|
|
92
|
-
groups[0].commands.push({
|
|
93
|
-
name: 'codeBlock',
|
|
94
|
-
label: localeActions.t('editor.codeblock.tooltip'),
|
|
95
|
-
iconName: 'Code2',
|
|
96
|
-
description: 'Code block with syntax highlighting',
|
|
97
|
-
shouldBeHidden: editor => editor.isActive('columns'),
|
|
98
|
-
action: ({ editor, range }) => {
|
|
99
|
-
editor.chain().focus().deleteRange(range).setCodeBlock().run();
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* Insert */
|
|
105
|
-
if (extension.name.toLowerCase() === Image.name) {
|
|
106
|
-
groups[1].commands.push({
|
|
107
|
-
name: 'image',
|
|
108
|
-
label: localeActions.t('editor.image.tooltip'),
|
|
109
|
-
iconName: 'ImageUp',
|
|
110
|
-
description: 'Insert a image',
|
|
111
|
-
aliases: ['image', 'tp', 'tupian'],
|
|
112
|
-
shouldBeHidden: editor => editor.isActive('columns'),
|
|
113
|
-
action: ({ editor, range }: any) => {
|
|
114
|
-
editor.chain().focus().deleteRange(range).run();
|
|
115
|
-
|
|
116
|
-
actionDialogImage.setOpen(editor.id, true);
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (extension.name.toLowerCase() === Video.name) {
|
|
122
|
-
groups[1].commands.push({
|
|
123
|
-
name: 'video',
|
|
124
|
-
label: localeActions.t('editor.video.tooltip'),
|
|
125
|
-
iconName: 'Video',
|
|
126
|
-
description: 'Insert a video',
|
|
127
|
-
aliases: ['video', 'sp', 'shipin'],
|
|
128
|
-
shouldBeHidden: editor => editor.isActive('columns'),
|
|
129
|
-
action: ({ editor, range }: any) => {
|
|
130
|
-
editor.chain().focus().deleteRange(range).run();
|
|
131
|
-
actionDialogVideo.setOpen(editor.id, true);
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (extension.name.toLowerCase() === 'table') {
|
|
137
|
-
groups[1].commands.push({
|
|
138
|
-
name: 'table',
|
|
139
|
-
label: localeActions.t('editor.table.tooltip'),
|
|
140
|
-
iconName: 'Table',
|
|
141
|
-
description: 'Insert a table',
|
|
142
|
-
aliases: ['table', 'bg', 'biaoge', 'biao'],
|
|
143
|
-
shouldBeHidden: editor => editor.isActive('columns'),
|
|
144
|
-
action: ({ editor, range }) => {
|
|
145
|
-
editor
|
|
146
|
-
.chain()
|
|
147
|
-
.focus()
|
|
148
|
-
.deleteRange(range)
|
|
149
|
-
.insertTable({ rows: 3, cols: 3, withHeaderRow: false })
|
|
150
|
-
.run();
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (extension.name.toLowerCase() === 'horizontalrule') {
|
|
156
|
-
groups[1].commands.push({
|
|
157
|
-
name: 'horizontalRule',
|
|
158
|
-
label: localeActions.t('editor.horizontalrule.tooltip'),
|
|
159
|
-
iconName: 'Minus',
|
|
160
|
-
description: 'Insert a horizontal divider',
|
|
161
|
-
aliases: ['hr', 'fgx', 'fg'],
|
|
162
|
-
action: ({ editor, range }) => {
|
|
163
|
-
editor.chain().focus().deleteRange(range).setHorizontalRule().run();
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (extension.name.toLowerCase() === 'columns') {
|
|
169
|
-
groups[1].commands.push({
|
|
170
|
-
name: 'columns',
|
|
171
|
-
label: localeActions.t('editor.columns.tooltip'),
|
|
172
|
-
iconName: 'Columns2',
|
|
173
|
-
description: 'Add two column content',
|
|
174
|
-
action: ({ editor }) => {
|
|
175
|
-
editor.chain().focus().insertColumns({ cols: 2 }).run();
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
renderGroupItem?.(extension, groups);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
return groups;
|
|
183
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SlashCommand';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Editor, Range } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
export interface Group {
|
|
4
|
-
name: string
|
|
5
|
-
title: string
|
|
6
|
-
commands: Command[]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface Command {
|
|
10
|
-
name: string
|
|
11
|
-
label: string
|
|
12
|
-
description?: string
|
|
13
|
-
aliases?: string[]
|
|
14
|
-
iconName?: any
|
|
15
|
-
iconUrl?: string
|
|
16
|
-
action: ({ editor, range }: { editor: Editor, range: Range }) => void
|
|
17
|
-
shouldBeHidden?: (editor: Editor) => boolean
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface MenuListProps {
|
|
21
|
-
editor: Editor
|
|
22
|
-
items: Group[]
|
|
23
|
-
command: (command: Command) => void
|
|
24
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { StrikeOptions as TiptapStrikeOptions } from '@tiptap/extension-strike';
|
|
2
|
-
import { Strike as TiptapStrike } from '@tiptap/extension-strike';
|
|
3
|
-
|
|
4
|
-
import { ActionButton } from '@/components';
|
|
5
|
-
import type { GeneralOptions } from '@/types';
|
|
6
|
-
|
|
7
|
-
export interface StrikeOptions extends TiptapStrikeOptions, GeneralOptions<StrikeOptions> {}
|
|
8
|
-
|
|
9
|
-
export const Strike = TiptapStrike.extend<StrikeOptions>({
|
|
10
|
-
addOptions() {
|
|
11
|
-
return {
|
|
12
|
-
...this.parent?.(),
|
|
13
|
-
button: ({ editor, t }: any) => ({
|
|
14
|
-
component: ActionButton,
|
|
15
|
-
componentProps: {
|
|
16
|
-
action: () => editor.commands.toggleStrike(),
|
|
17
|
-
isActive: () => editor.isActive('strike') || false,
|
|
18
|
-
disabled: !editor.can().toggleStrike(),
|
|
19
|
-
icon: 'Strikethrough',
|
|
20
|
-
shortcutKeys: ['shift', 'mod', 'S'],
|
|
21
|
-
tooltip: t('editor.strike.tooltip'),
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Strike';
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { Extensions } from '@tiptap/core';
|
|
2
|
-
import { Extension } from '@tiptap/core';
|
|
3
|
-
import type { SubscriptExtensionOptions as TiptapSubscriptOptions } from '@tiptap/extension-subscript';
|
|
4
|
-
import { Subscript as TiptapSubscript } from '@tiptap/extension-subscript';
|
|
5
|
-
import type { SuperscriptExtensionOptions as TiptapSuperscriptOptions } from '@tiptap/extension-superscript';
|
|
6
|
-
import { Superscript as TiptapSuperscript } from '@tiptap/extension-superscript';
|
|
7
|
-
|
|
8
|
-
import { ActionButton } from '@/components';
|
|
9
|
-
import type { ButtonViewReturn, GeneralOptions } from '@/types';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Represents the interface for subscript and superscript options, extending GeneralOptions.
|
|
13
|
-
*/
|
|
14
|
-
export interface SubAndSuperScriptOptions extends GeneralOptions<SubAndSuperScriptOptions> {
|
|
15
|
-
/**
|
|
16
|
-
* subscript options or false, indicating whether subscript is enabled
|
|
17
|
-
*
|
|
18
|
-
* @default true
|
|
19
|
-
*/
|
|
20
|
-
subscript: Partial<TiptapSubscriptOptions> | false
|
|
21
|
-
/**
|
|
22
|
-
* superscript options or false, indicating whether superscript is enabled
|
|
23
|
-
*
|
|
24
|
-
* @default true
|
|
25
|
-
*/
|
|
26
|
-
superscript: Partial<TiptapSuperscriptOptions> | false
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const SubAndSuperScript = Extension.create<SubAndSuperScriptOptions>({
|
|
30
|
-
name: 'subAndSuperScript',
|
|
31
|
-
|
|
32
|
-
addOptions() {
|
|
33
|
-
return {
|
|
34
|
-
...this.parent?.(),
|
|
35
|
-
button: ({ editor, extension, t }) => {
|
|
36
|
-
const subscript = extension.options.subscript;
|
|
37
|
-
const superscript = extension.options.superscript;
|
|
38
|
-
|
|
39
|
-
const subBtn: ButtonViewReturn = {
|
|
40
|
-
component: ActionButton,
|
|
41
|
-
componentProps: {
|
|
42
|
-
action: () => editor.commands.toggleSubscript(),
|
|
43
|
-
isActive: () => editor.isActive('subscript') || false,
|
|
44
|
-
disabled: !editor.can().toggleSubscript(),
|
|
45
|
-
icon: 'Subscript',
|
|
46
|
-
tooltip: t('editor.subscript.tooltip'),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const superBtn: ButtonViewReturn = {
|
|
51
|
-
component: ActionButton,
|
|
52
|
-
componentProps: {
|
|
53
|
-
action: () => editor.commands.toggleSuperscript(),
|
|
54
|
-
isActive: () => editor.isActive('superscript') || false,
|
|
55
|
-
disabled: !editor.can().toggleSuperscript(),
|
|
56
|
-
icon: 'Superscript',
|
|
57
|
-
tooltip: t('editor.superscript.tooltip'),
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const items: ButtonViewReturn[] = [];
|
|
62
|
-
|
|
63
|
-
if (subscript !== false) {
|
|
64
|
-
items.push(subBtn);
|
|
65
|
-
}
|
|
66
|
-
if (superscript !== false) {
|
|
67
|
-
items.push(superBtn);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return items;
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
addExtensions() {
|
|
76
|
-
const extensions: Extensions = [];
|
|
77
|
-
|
|
78
|
-
if (this.options.subscript !== false) {
|
|
79
|
-
extensions.push(TiptapSubscript.configure(this.options.subscript));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (this.options.superscript !== false) {
|
|
83
|
-
extensions.push(TiptapSuperscript.configure(this.options.superscript));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return extensions;
|
|
87
|
-
},
|
|
88
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Subscript';
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes, Node } from '@tiptap/core';
|
|
2
|
-
import { Plugin } from '@tiptap/pm/state';
|
|
3
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
|
|
5
|
-
import { getCellsInColumn, isRowSelected, selectRow } from './utils';
|
|
6
|
-
|
|
7
|
-
export interface TableCellOptions {
|
|
8
|
-
HTMLAttributes: Record<string, any>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const TableCell = Node.create<TableCellOptions>({
|
|
12
|
-
name: 'tableCell',
|
|
13
|
-
|
|
14
|
-
content: 'block+', // TODO: Do not allow table in table
|
|
15
|
-
|
|
16
|
-
tableRole: 'cell',
|
|
17
|
-
|
|
18
|
-
isolating: true,
|
|
19
|
-
|
|
20
|
-
addOptions() {
|
|
21
|
-
return {
|
|
22
|
-
HTMLAttributes: {},
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
parseHTML() {
|
|
27
|
-
return [{ tag: 'td' }];
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
renderHTML({ HTMLAttributes }) {
|
|
31
|
-
return [
|
|
32
|
-
'td',
|
|
33
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
34
|
-
0,
|
|
35
|
-
];
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
addAttributes() {
|
|
39
|
-
return {
|
|
40
|
-
colspan: {
|
|
41
|
-
default: 1,
|
|
42
|
-
parseHTML: (element) => {
|
|
43
|
-
const colspan = element.getAttribute('colspan');
|
|
44
|
-
const value = colspan ? Number.parseInt(colspan, 10) : 1;
|
|
45
|
-
|
|
46
|
-
return value;
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
rowspan: {
|
|
50
|
-
default: 1,
|
|
51
|
-
parseHTML: (element) => {
|
|
52
|
-
const rowspan = element.getAttribute('rowspan');
|
|
53
|
-
const value = rowspan ? Number.parseInt(rowspan, 10) : 1;
|
|
54
|
-
|
|
55
|
-
return value;
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
colwidth: {
|
|
59
|
-
default: null,
|
|
60
|
-
parseHTML: (element) => {
|
|
61
|
-
const colwidth = element.getAttribute('colwidth');
|
|
62
|
-
const value = colwidth ? [Number.parseInt(colwidth, 10)] : null;
|
|
63
|
-
|
|
64
|
-
return value;
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
style: {
|
|
68
|
-
default: null,
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
addProseMirrorPlugins() {
|
|
74
|
-
const { isEditable } = this.editor;
|
|
75
|
-
|
|
76
|
-
return [
|
|
77
|
-
new Plugin({
|
|
78
|
-
props: {
|
|
79
|
-
decorations: (state) => {
|
|
80
|
-
if (!isEditable) {
|
|
81
|
-
return DecorationSet.empty;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const { doc, selection } = state;
|
|
85
|
-
const decorations: Decoration[] = [];
|
|
86
|
-
const cells = getCellsInColumn(0)(selection);
|
|
87
|
-
|
|
88
|
-
if (cells) {
|
|
89
|
-
cells.forEach(({ pos }: { pos: number }, index: number) => {
|
|
90
|
-
decorations.push(
|
|
91
|
-
Decoration.widget(pos + 1, () => {
|
|
92
|
-
const rowSelected = isRowSelected(index)(selection);
|
|
93
|
-
let className = 'grip-row';
|
|
94
|
-
|
|
95
|
-
if (rowSelected) {
|
|
96
|
-
className += ' selected';
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (index === 0) {
|
|
100
|
-
className += ' first';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (index === cells.length - 1) {
|
|
104
|
-
className += ' last';
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const grip = document.createElement('a');
|
|
108
|
-
|
|
109
|
-
grip.className = className;
|
|
110
|
-
grip.addEventListener('mousedown', (event) => {
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
event.stopImmediatePropagation();
|
|
113
|
-
|
|
114
|
-
this.editor.view.dispatch(
|
|
115
|
-
selectRow(index)(this.editor.state.tr),
|
|
116
|
-
);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
return grip;
|
|
120
|
-
}),
|
|
121
|
-
);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return DecorationSet.create(doc, decorations);
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
}),
|
|
129
|
-
];
|
|
130
|
-
},
|
|
131
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import TiptapTableHeader from '@tiptap/extension-table-header';
|
|
2
|
-
import { Plugin } from '@tiptap/pm/state';
|
|
3
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
|
|
5
|
-
import { getCellsInRow, isColumnSelected, selectColumn } from './utils';
|
|
6
|
-
|
|
7
|
-
export const TableHeader = TiptapTableHeader.extend({
|
|
8
|
-
addAttributes() {
|
|
9
|
-
return {
|
|
10
|
-
colspan: {
|
|
11
|
-
default: 1,
|
|
12
|
-
},
|
|
13
|
-
rowspan: {
|
|
14
|
-
default: 1,
|
|
15
|
-
},
|
|
16
|
-
colwidth: {
|
|
17
|
-
default: null,
|
|
18
|
-
parseHTML: (element) => {
|
|
19
|
-
const colwidth = element.getAttribute('colwidth');
|
|
20
|
-
const value = colwidth
|
|
21
|
-
? colwidth.split(',').map((item) => Number.parseInt(item, 10))
|
|
22
|
-
: null;
|
|
23
|
-
|
|
24
|
-
return value;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
style: {
|
|
28
|
-
default: null,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
addProseMirrorPlugins() {
|
|
34
|
-
const { isEditable } = this.editor;
|
|
35
|
-
|
|
36
|
-
return [
|
|
37
|
-
new Plugin({
|
|
38
|
-
props: {
|
|
39
|
-
decorations: (state) => {
|
|
40
|
-
if (!isEditable) {
|
|
41
|
-
return DecorationSet.empty;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const { doc, selection } = state;
|
|
45
|
-
const decorations: Decoration[] = [];
|
|
46
|
-
const cells = getCellsInRow(0)(selection);
|
|
47
|
-
|
|
48
|
-
if (cells) {
|
|
49
|
-
cells.forEach(({ pos }: { pos: number }, index: number) => {
|
|
50
|
-
decorations.push(
|
|
51
|
-
Decoration.widget(pos + 1, () => {
|
|
52
|
-
const colSelected = isColumnSelected(index)(selection);
|
|
53
|
-
let className = 'grip-column';
|
|
54
|
-
|
|
55
|
-
if (colSelected) {
|
|
56
|
-
className += ' selected';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (index === 0) {
|
|
60
|
-
className += ' first';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (index === cells.length - 1) {
|
|
64
|
-
className += ' last';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const grip = document.createElement('a');
|
|
68
|
-
|
|
69
|
-
grip.className = className;
|
|
70
|
-
grip.addEventListener('mousedown', (event) => {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
event.stopImmediatePropagation();
|
|
73
|
-
|
|
74
|
-
this.editor.view.dispatch(
|
|
75
|
-
selectColumn(index)(this.editor.state.tr),
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return grip;
|
|
80
|
-
}),
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return DecorationSet.create(doc, decorations);
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}),
|
|
89
|
-
];
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export default TableHeader;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import TiptapTable from '@tiptap/extension-table';
|
|
2
|
-
import type { TableCellOptions } from '@tiptap/extension-table-cell';
|
|
3
|
-
import type { TableHeaderOptions } from '@tiptap/extension-table-header';
|
|
4
|
-
import type { TableRowOptions } from '@tiptap/extension-table-row';
|
|
5
|
-
|
|
6
|
-
import TableActionButton from '@/extensions/Table/components/TableActionButton';
|
|
7
|
-
import type { GeneralOptions } from '@/types';
|
|
8
|
-
|
|
9
|
-
import { TableCell } from './Cell';
|
|
10
|
-
import { TableCellBackground } from './cell-background';
|
|
11
|
-
import type { TableCellBackgroundOptions } from './cell-background';
|
|
12
|
-
import { TableHeader } from './Header';
|
|
13
|
-
import { TableRow } from './Row';
|
|
14
|
-
|
|
15
|
-
export interface TableOptions extends GeneralOptions<TableOptions> {
|
|
16
|
-
HTMLAttributes: Record<string, any>
|
|
17
|
-
resizable: boolean
|
|
18
|
-
handleWidth: number
|
|
19
|
-
cellMinWidth: number
|
|
20
|
-
lastColumnResizable: boolean
|
|
21
|
-
allowTableNodeSelection: boolean
|
|
22
|
-
/** options for table rows */
|
|
23
|
-
tableRow: Partial<TableRowOptions>
|
|
24
|
-
/** options for table headers */
|
|
25
|
-
tableHeader: Partial<TableHeaderOptions>
|
|
26
|
-
/** options for table cells */
|
|
27
|
-
tableCell: Partial<TableCellOptions>
|
|
28
|
-
/** options for table cell background */
|
|
29
|
-
tableCellBackground: Partial<TableCellBackgroundOptions>
|
|
30
|
-
}
|
|
31
|
-
export const Table = TiptapTable.extend<TableOptions>({
|
|
32
|
-
addOptions() {
|
|
33
|
-
return {
|
|
34
|
-
...this.parent?.(),
|
|
35
|
-
resizable: true,
|
|
36
|
-
lastColumnResizable: false,
|
|
37
|
-
allowTableNodeSelection: false,
|
|
38
|
-
button: ({ editor, t }: any) => ({
|
|
39
|
-
component: TableActionButton,
|
|
40
|
-
componentProps: {
|
|
41
|
-
disabled: editor.isActive('table') || false,
|
|
42
|
-
icon: 'Table',
|
|
43
|
-
tooltip: t('editor.table.tooltip'),
|
|
44
|
-
editor,
|
|
45
|
-
},
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
addExtensions() {
|
|
51
|
-
return [
|
|
52
|
-
TableRow.configure(this.options.tableRow),
|
|
53
|
-
TableHeader.configure(this.options.tableHeader),
|
|
54
|
-
TableCell.configure(this.options.tableCell),
|
|
55
|
-
TableCellBackground.configure(this.options.tableCellBackground),
|
|
56
|
-
];
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export default Table;
|