Skip to content

Commit

Permalink
fix: #6818
Browse files Browse the repository at this point in the history
  • Loading branch information
lin-mt authored Dec 6, 2024
1 parent bccfeee commit e7cf73c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/lexical-react/src/LexicalDraggableBlockPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,15 @@ function setMenuPosition(
const floatingElemRect = floatingElem.getBoundingClientRect();
const anchorElementRect = anchorElem.getBoundingClientRect();

// top left
let targetCalculateHeight: number = parseInt(targetStyle.lineHeight, 10);
if (isNaN(targetCalculateHeight)) {
// middle
targetCalculateHeight = targetRect.bottom - targetRect.top;
}
const top =
targetRect.top +
(parseInt(targetStyle.lineHeight, 10) - floatingElemRect.height) / 2 -
(targetCalculateHeight - floatingElemRect.height) / 2 -
anchorElementRect.top;

const left = SPACE;
Expand Down

0 comments on commit e7cf73c

Please sign in to comment.