fix(frontend): mention popover respects shouldBelow for above/below placement

ShouldBelow was computed but ignored — popover always rendered below the
cursor. Now uses shouldBelow correctly to render above when insufficient
space below. Also removes unused cRect clone measurement.
This commit is contained in:
ZhenYi 2026-04-18 11:11:39 +08:00
parent 3a164f6dcc
commit 434a3595eb

View File

@ -363,8 +363,6 @@ export function MentionPopover({
cursorSpan.textContent = '|';
clone.appendChild(cursorSpan);
document.body.appendChild(clone);
const cRect = clone.getBoundingClientRect();
document.body.removeChild(clone);
const popoverWidth = 320;
@ -377,7 +375,7 @@ export function MentionPopover({
? contentTop + lineHeight + 8
: Math.max(vp, contentTop - popoverHeight - 8);
setPosition({ top: contentTop + borderTop + lineHeight + 8, left: contentLeft + borderLeft });
setPosition({ top, left: contentLeft });
document.body.removeChild(tempDiv);