From ba7cfd5b3701c15edebb2a6d33fdccccdc6dd1a2 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Wed, 4 May 2022 19:27:47 +0800 Subject: [PATCH] fix: fix initial width --- packages/client/src/tiptap/editor/menus/insert/index.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/client/src/tiptap/editor/menus/insert/index.tsx b/packages/client/src/tiptap/editor/menus/insert/index.tsx index 05fee33..5cdb1ee 100644 --- a/packages/client/src/tiptap/editor/menus/insert/index.tsx +++ b/packages/client/src/tiptap/editor/menus/insert/index.tsx @@ -20,7 +20,6 @@ import { GridSelect } from 'components/grid-select'; import { useToggle } from 'hooks/use-toggle'; import { useUser } from 'data/user'; import { createKeysLocalStorageLRUCache } from 'helpers/lru-cache'; -import { getEditorContainerDOMSize } from 'tiptap/prose-utils'; import { useActive } from 'tiptap/editor/hooks/use-active'; import { Title } from 'tiptap/core/extensions/title'; import { createCountdown } from '../countdown/service'; @@ -69,8 +68,7 @@ const COMMANDS = [ icon: , label: '图片', action: (editor) => { - const { width } = getEditorContainerDOMSize(editor); - editor.chain().focus().setEmptyImage({ width }).run(); + editor.chain().focus().setEmptyImage({ width: '100%' }).run(); }, }, { @@ -95,8 +93,7 @@ const COMMANDS = [ icon: , label: '思维导图', action: (editor) => { - const { width } = getEditorContainerDOMSize(editor); - editor.chain().focus().setMind({ width }).run(); + editor.chain().focus().setMind({ width: '100%' }).run(); }, }, {