@@ -9,7 +9,10 @@ import { FC, useEffect, useMemo } from "react";
99import { useBlockNoteEditor } from "../../hooks/useBlockNoteEditor.js" ;
1010import { useExtension , useExtensionState } from "../../hooks/useExtension.js" ;
1111import { FloatingUIOptions } from "../Popovers/FloatingUIOptions.js" ;
12- import { GenericPopover } from "../Popovers/GenericPopover.js" ;
12+ import {
13+ GenericPopover ,
14+ GenericPopoverReference ,
15+ } from "../Popovers/GenericPopover.js" ;
1316import { SuggestionMenu } from "./SuggestionMenu.js" ;
1417import { SuggestionMenuWrapper } from "./SuggestionMenuWrapper.js" ;
1518import { 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