Skip to content

Commit 100a8b8

Browse files
committed
improve api based on feedback
1 parent b41b009 commit 100a8b8

13 files changed

Lines changed: 57 additions & 9 deletions

File tree

packages/react/src/components/Comments/FloatingComposerController.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export default function FloatingComposerController<
6262
middleware: [offset(10), shift(), flip()],
6363
...props.floatingUIOptions?.useFloatingOptions,
6464
},
65+
focusManagerProps: {
66+
disabled: false,
67+
},
6568
elementProps: {
6669
style: {
6770
zIndex: 60,

packages/react/src/components/Comments/FloatingThreadController.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export default function FloatingThreadController(props: {
5858
middleware: [offset(10), shift(), flip()],
5959
...props.floatingUIOptions?.useFloatingOptions,
6060
},
61+
focusManagerProps: {
62+
disabled: true,
63+
...props.floatingUIOptions?.focusManagerProps,
64+
},
6165
elementProps: {
6266
style: {
6367
zIndex: 30,

packages/react/src/components/FilePanel/FilePanelController.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { FilePanelExtension } from "@blocknote/core/extensions";
22
import { flip, offset } from "@floating-ui/react";
33
import { FC, useMemo } from "react";
44

5-
import { FilePanel } from "./FilePanel.js";
6-
import { FilePanelProps } from "./FilePanelProps.js";
5+
import { useBlockNoteEditor } from "../../hooks/useBlockNoteEditor.js";
6+
import { useExtension, useExtensionState } from "../../hooks/useExtension.js";
77
import { BlockPopover } from "../Popovers/BlockPopover.js";
88
import { FloatingUIOptions } from "../Popovers/FloatingUIOptions.js";
9-
import { useExtension, useExtensionState } from "../../hooks/useExtension.js";
10-
import { useBlockNoteEditor } from "../../hooks/useBlockNoteEditor.js";
9+
import { FilePanel } from "./FilePanel.js";
10+
import { FilePanelProps } from "./FilePanelProps.js";
1111

1212
export const FilePanelController = (props: {
1313
filePanel?: FC<FilePanelProps>;
@@ -37,6 +37,10 @@ export const FilePanelController = (props: {
3737
middleware: [offset(10), flip()],
3838
...props.floatingUIOptions?.useFloatingOptions,
3939
},
40+
focusManagerProps: {
41+
disabled: true,
42+
...props.floatingUIOptions?.focusManagerProps,
43+
},
4044
elementProps: {
4145
style: {
4246
zIndex: 90,

packages/react/src/components/FormattingToolbar/FormattingToolbarController.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ export const FormattingToolbarController = (props: {
9595
middleware: [offset(10), shift(), flip()],
9696
...props.floatingUIOptions?.useFloatingOptions,
9797
},
98+
focusManagerProps: {
99+
disabled: true,
100+
...props.floatingUIOptions?.focusManagerProps,
101+
},
98102
elementProps: {
99103
style: {
100104
zIndex: 40,

packages/react/src/components/LinkToolbar/LinkToolbarController.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ export const LinkToolbarController = (props: {
150150
handleClose: safePolygon(),
151151
...props.floatingUIOptions?.useHoverProps,
152152
},
153+
focusManagerProps: {
154+
disabled: true,
155+
...props.floatingUIOptions?.focusManagerProps,
156+
},
153157
elementProps: {
154158
style: {
155159
zIndex: 50,

packages/react/src/components/Popovers/FloatingUIOptions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export type FloatingUIOptions = {
1717
elementProps?: HTMLAttributes<HTMLDivElement>;
1818
/**
1919
* Props to pass to the `FloatingFocusManager` component.
20-
*
21-
* If omitted, no `FloatingFocusManager` will be used.
2220
*/
2321
focusManagerProps?: Omit<FloatingFocusManagerProps, "context" | "children">;
2422
};

packages/react/src/components/Popovers/GenericPopover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export const GenericPopover = (
176176
);
177177
}
178178

179-
if (props.focusManagerProps) {
179+
if (!props.focusManagerProps?.disabled) {
180180
return (
181181
<FloatingFocusManager {...props.focusManagerProps} context={context}>
182182
<div ref={mergedRefs} {...mergedProps}>

packages/react/src/components/Popovers/TableCellPopover.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useBlockNoteEditor } from "../../hooks/useBlockNoteEditor.js";
55
import { FloatingUIOptions } from "./FloatingUIOptions.js";
66
import { GenericPopover } from "./GenericPopover.js";
77

8+
// TODO: not used!?
89
export const TableCellPopover = (
910
props: FloatingUIOptions & {
1011
blockId: string | undefined;

packages/react/src/components/SideMenu/SideMenuController.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export const SideMenuController = (props: {
3636
enabled: false,
3737
...props.floatingUIOptions?.useDismissProps,
3838
},
39+
focusManagerProps: {
40+
disabled: true,
41+
...props.floatingUIOptions?.focusManagerProps,
42+
},
3943
elementProps: {
4044
style: {
4145
zIndex: 20,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ export function GridSuggestionMenuController<
133133
],
134134
...props.floatingUIOptions?.useFloatingOptions,
135135
},
136+
focusManagerProps: {
137+
disabled: true,
138+
...props.floatingUIOptions?.focusManagerProps,
139+
},
136140
elementProps: {
137141
// Prevents editor blurring when clicking the scroll bar.
138142
onMouseDownCapture: (event) => event.preventDefault(),

0 commit comments

Comments
 (0)