From b1602b2b1a4c35fb29894e53e1b41ed19fb30a97 Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Wed, 10 Aug 2022 18:39:01 +0800 Subject: [PATCH] fix: error catch (#182) --- .../editor-plugins/src/menu/command-menu/Menu.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 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 38a397a8a..67261c813 100644 --- a/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx +++ b/libs/components/editor-plugins/src/menu/command-menu/Menu.tsx @@ -123,17 +123,13 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => { const COMMAND_MENU_HEIGHT = window.innerHeight * 0.4; - const { top, left } = + const { top, left, bottom } = editor.container.getBoundingClientRect(); if (clientHeight - rectTop <= COMMAND_MENU_HEIGHT) { setCommandMenuPosition({ left: rect.left - left, - top: - rectTop - - top - - COMMAND_MENU_HEIGHT + - 20, - bottom: 'initial', + bottom: bottom - rect.bottom + 24, + top: 'initial', }); } else { setCommandMenuPosition({