Skip to content

Commit fb76358

Browse files
committed
fix compile
1 parent 9f12434 commit fb76358

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

packages/react/src/components/SuggestionMenu/GridSuggestionMenu/GridSuggestionMenuController.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import {
99
useExtensionState,
1010
} from "../../../hooks/useExtension.js";
1111
import { FloatingUIOptions } from "../../Popovers/FloatingUIOptions.js";
12-
import { GenericPopover } from "../../Popovers/GenericPopover.js";
12+
import {
13+
GenericPopover,
14+
GenericPopoverReference,
15+
} from "../../Popovers/GenericPopover.js";
1316
import { getDefaultReactEmojiPickerItems } from "./getDefaultReactEmojiPickerItems.js";
1417
import { GridSuggestionMenu } from "./GridSuggestionMenu.js";
1518
import { GridSuggestionMenuWrapper } from "./GridSuggestionMenuWrapper.js";
@@ -95,13 +98,16 @@ export function GridSuggestionMenuController<
9598

9699
const state = useExtensionState(SuggestionMenu);
97100
const reference = useExtensionState(SuggestionMenu, {
98-
selector: (state) => ({
99-
// Use first child as the editor DOM element may itself be scrollable.
100-
// For FloatingUI to auto-update the position during scrolling, the
101-
// `contextElement` must be a descendant of the scroll container.
102-
element: editor.domElement?.firstChild || undefined,
103-
getBoundingClientRect: () => state?.referencePos || new DOMRect(),
104-
}),
101+
selector: (state) =>
102+
({
103+
// Use first child as the editor DOM element may itself be scrollable.
104+
// For FloatingUI to auto-update the position during scrolling, the
105+
// `contextElement` must be a descendant of the scroll container.
106+
element: (editor.domElement?.firstChild || undefined) as
107+
| Element
108+
| undefined,
109+
getBoundingClientRect: () => state?.referencePos || new DOMRect(),
110+
}) satisfies GenericPopoverReference,
105111
});
106112

107113
const floatingUIOptions = useMemo<FloatingUIOptions>(

packages/react/src/components/SuggestionMenu/SuggestionMenuController.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { FC, useEffect, useMemo } from "react";
99
import { useBlockNoteEditor } from "../../hooks/useBlockNoteEditor.js";
1010
import { useExtension, useExtensionState } from "../../hooks/useExtension.js";
1111
import { FloatingUIOptions } from "../Popovers/FloatingUIOptions.js";
12-
import { GenericPopover } from "../Popovers/GenericPopover.js";
12+
import {
13+
GenericPopover,
14+
GenericPopoverReference,
15+
} from "../Popovers/GenericPopover.js";
1316
import { SuggestionMenu } from "./SuggestionMenu.js";
1417
import { SuggestionMenuWrapper } from "./SuggestionMenuWrapper.js";
1518
import { getDefaultReactSlashMenuItems } from "./getDefaultReactSlashMenuItems.js";
@@ -90,13 +93,16 @@ export function SuggestionMenuController<
9093

9194
const state = useExtensionState(SuggestionMenuExtension);
9295
const reference = useExtensionState(SuggestionMenuExtension, {
93-
selector: (state) => ({
94-
// Use first child as the editor DOM element may itself be scrollable.
95-
// For FloatingUI to auto-update the position during scrolling, the
96-
// `contextElement` must be a descendant of the scroll container.
97-
element: editor.domElement?.firstChild || undefined,
98-
getBoundingClientRect: () => state?.referencePos || new DOMRect(),
99-
}),
96+
selector: (state) =>
97+
({
98+
// Use first child as the editor DOM element may itself be scrollable.
99+
// For FloatingUI to auto-update the position during scrolling, the
100+
// `contextElement` must be a descendant of the scroll container.
101+
element: (editor.domElement?.firstChild || undefined) as
102+
| Element
103+
| undefined,
104+
getBoundingClientRect: () => state?.referencePos || new DOMRect(),
105+
}) satisfies GenericPopoverReference,
100106
});
101107

102108
const floatingUIOptions = useMemo<FloatingUIOptions>(

0 commit comments

Comments
 (0)