Skip to content

Commit cc9fbf7

Browse files
2 parents 1028d47 + 9262fe1 commit cc9fbf7

23 files changed

Lines changed: 258 additions & 145 deletions

docs/content/docs/features/blocks/code-blocks.mdx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ To create your own syntax highlighter, you can use the [shiki-codegen](https://s
8080
For example, to create a syntax highlighter using the optimized javascript engine, javascript, typescript, vue, with light and dark themes, you can run the following command:
8181

8282
```bash
83-
npx shiki-codegen --langs javascript,typescript,vue --themes light,dark --engine javascript --precompiled ./shiki.bundle.ts
83+
npx shiki-codegen --langs javascript,typescript,vue --themes light-plus,dark-plus --engine javascript --precompiled ./shiki.bundle.ts
8484
```
8585

8686
This will generate a `shiki.bundle.ts` file that you can use to create a syntax highlighter for your editor.
@@ -93,21 +93,23 @@ import { createHighlighter } from "./shiki.bundle.js";
9393
export default function App() {
9494
const editor = useCreateBlockNote({
9595
schema: BlockNoteSchema.create().extend({
96-
codeBlock: createCodeBlockSpec({
97-
indentLineWithTab: true,
98-
defaultLanguage: "typescript",
99-
supportedLanguages: {
100-
typescript: {
101-
name: "TypeScript",
102-
aliases: ["ts"],
96+
blockSpecs: {
97+
codeBlock: createCodeBlockSpec({
98+
indentLineWithTab: true,
99+
defaultLanguage: "typescript",
100+
supportedLanguages: {
101+
typescript: {
102+
name: "TypeScript",
103+
aliases: ["ts"],
104+
},
103105
},
104-
},
105-
createHighlighter: () =>
106-
createHighlighter({
107-
themes: ["light-plus", "dark-plus"],
108-
langs: [],
109-
}),
110-
}),
106+
createHighlighter: () =>
107+
createHighlighter({
108+
themes: ["light-plus", "dark-plus"],
109+
langs: [],
110+
}),
111+
}),
112+
},
111113
}),
112114
});
113115

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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
FloatingFocusManagerProps,
23
UseDismissProps,
34
UseFloatingOptions,
45
UseHoverProps,
@@ -14,4 +15,8 @@ export type FloatingUIOptions = {
1415
useDismissProps?: UseDismissProps;
1516
useHoverProps?: UseHoverProps;
1617
elementProps?: HTMLAttributes<HTMLDivElement>;
18+
/**
19+
* Props to pass to the `FloatingFocusManager` component.
20+
*/
21+
focusManagerProps?: Omit<FloatingFocusManagerProps, "context" | "children">;
1722
};

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {
2-
useFloating,
3-
useTransitionStyles,
2+
autoUpdate,
3+
FloatingFocusManager,
44
useDismiss,
5+
useFloating,
6+
useHover,
57
useInteractions,
68
useMergeRefs,
79
useTransitionStatus,
8-
autoUpdate,
9-
useHover,
10+
useTransitionStyles,
1011
} from "@floating-ui/react";
1112
import { HTMLAttributes, ReactNode, useEffect, useRef } from "react";
1213

@@ -175,6 +176,16 @@ export const GenericPopover = (
175176
);
176177
}
177178

179+
if (!props.focusManagerProps?.disabled) {
180+
return (
181+
<FloatingFocusManager {...props.focusManagerProps} context={context}>
182+
<div ref={mergedRefs} {...mergedProps}>
183+
{props.children}
184+
</div>
185+
</FloatingFocusManager>
186+
);
187+
}
188+
178189
return (
179190
<div ref={mergedRefs} {...mergedProps}>
180191
{props.children}

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

Lines changed: 0 additions & 57 deletions
This file was deleted.

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,

0 commit comments

Comments
 (0)