Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: error catch (#182)

DiamondThreeb1602b2b1a4c
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 38a397a8a1..67261c813c 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({