Skip to content

Commit

Permalink
bug: floating formatter toolbar position
Browse files Browse the repository at this point in the history
  • Loading branch information
umaranis committed Feb 10, 2024
1 parent b00a2ff commit 1dade85
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function setFloatingElemPosition(
targetRect: DOMRect | null,
floatingElem: HTMLElement,
anchorElem: HTMLElement,
isLink: boolean = false,

Check failure on line 15 in packages/svelte-lexical/src/core/plugins/util/setFloatingElemPosition.ts

View workflow job for this annotation

GitHub Actions / build

Type boolean trivially inferred from a boolean literal, remove type annotation
verticalGap: number = VERTICAL_GAP,
horizontalOffset: number = HORIZONTAL_OFFSET,
): void {
Expand All @@ -31,7 +32,11 @@ export function setFloatingElemPosition(
let left = targetRect.left - horizontalOffset;

if (top < editorScrollerRect.top) {
top += floatingElemRect.height + targetRect.height + verticalGap * 2;
// adjusted height for link element if the element is at top
top +=
floatingElemRect.height +
targetRect.height +
verticalGap * (isLink ? 9 : 2);
}

if (left + floatingElemRect.width > editorScrollerRect.right) {
Expand Down

0 comments on commit 1dade85

Please sign in to comment.