From 1407117eb0b8f7e6c8e7d28476f0d22688026f4b Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sun, 5 Jun 2022 19:34:11 +0800 Subject: [PATCH] tiptap: clean code in mind --- packages/client/src/tiptap/core/menus/mind/bubble.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/client/src/tiptap/core/menus/mind/bubble.tsx b/packages/client/src/tiptap/core/menus/mind/bubble.tsx index 264d92b..d8afd25 100644 --- a/packages/client/src/tiptap/core/menus/mind/bubble.tsx +++ b/packages/client/src/tiptap/core/menus/mind/bubble.tsx @@ -13,16 +13,16 @@ import { copyNode, deleteNode, getEditorContainerDOMSize } from 'tiptap/prose-ut import { triggerOpenMindSettingModal } from '../_event'; export const MindBubbleMenu = ({ editor }) => { + const { width: maxWidth } = getEditorContainerDOMSize(editor); const attrs = useAttributes(editor, Mind.name, { defaultShowPicker: false, createUser: '', + width: 0, + height: 0, }); - const { defaultShowPicker, createUser } = attrs; + const { defaultShowPicker, createUser, width, height } = attrs; const { user } = useUser(); - const { width: maxWidth } = getEditorContainerDOMSize(editor); - const { width, height } = useAttributes(editor, Mind.name, { width: 0, height: 0 }); - const setSize = useCallback( (size) => { editor.chain().updateAttributes(Mind.name, size).setNodeSelection(editor.state.selection.from).focus().run();