From b4764e11b77a917a6fe6c722a4cd90b7aa05b0cc Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sat, 7 May 2022 10:35:48 +0800 Subject: [PATCH] tiptap: fix delete table --- packages/client/src/tiptap/editor/menus/table/bubble.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/src/tiptap/editor/menus/table/bubble.tsx b/packages/client/src/tiptap/editor/menus/table/bubble.tsx index 9232c9be..cd76c3dd 100644 --- a/packages/client/src/tiptap/editor/menus/table/bubble.tsx +++ b/packages/client/src/tiptap/editor/menus/table/bubble.tsx @@ -19,11 +19,13 @@ import { Tooltip } from 'components/tooltip'; import { Divider } from 'tiptap/components/divider'; import { BubbleMenu } from 'tiptap/editor/views/bubble-menu'; import { Table } from 'tiptap/core/extensions/table'; -import { copyNode } from 'tiptap/prose-utils'; +import { copyNode, deleteNode } from 'tiptap/prose-utils'; export const TableBubbleMenu = ({ editor }) => { const copyMe = useCallback(() => copyNode(Table.name, editor), [editor]); - const deleteMe = useCallback(() => editor.chain().focus().deleteTable(), [editor]); + const deleteMe = useCallback(() => { + deleteNode(Table.name, editor); + }, [editor]); const addColumnBefore = useCallback(() => editor.chain().focus().addColumnBefore().run(), [editor]); const addColumnAfter = useCallback(() => editor.chain().focus().addColumnAfter().run(), [editor]); const deleteColumn = useCallback(() => editor.chain().focus().deleteColumn().run(), [editor]);