fix: error catch (#182)

This commit is contained in:
DiamondThree
2022-08-10 18:39:01 +08:00
committed by GitHub
parent ddcbed4761
commit b1602b2b1a

View File

@@ -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({