fix:commend-menu postion

This commit is contained in:
DiamondThree 2022-08-10 11:42:09 +08:00
parent 32be658e96
commit fa458f06a4

View File

@ -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)