From fa458f06a4b341e213779494956c3f0e5df98190 Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Wed, 10 Aug 2022 11:42:09 +0800 Subject: [PATCH] fix:commend-menu postion --- .../editor-plugins/src/menu/command-menu/Menu.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx b/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx index c81b91879f..56c3790a69 100644 --- a/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx +++ b/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx @@ -129,8 +129,12 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => { if (clientHeight - rectTop <= COMMAND_MENU_HEIGHT) { setCommandMenuPosition({ left: rect.left - left, - bottom: rectTop - top + 10, - top: 'initial', + top: + rectTop - + top - + COMMAND_MENU_HEIGHT + + 20, + bottom: 'initial', }); } else { setCommandMenuPosition({ @@ -189,6 +193,7 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => { }, [] ); + useEffect(() => { const sub = hooks .get(HookType.ON_ROOT_NODE_KEYUP)