Skip to content

Commit 1d8f3d9

Browse files
Minor docs fixes (#733)
1 parent 162d2cc commit 1d8f3d9

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

docs/pages/docs/advanced/nextjs.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ Make sure to use BlockNote in a [Client Component](https://nextjs.org/docs/getti
1212

1313
```typescript jsx
1414
"use client"; // this registers <Editor> as a Client Component
15-
import { BlockNoteView, useCreateBlockNote } from "@blocknote/react";
1615
import "@blocknote/core/fonts/inter.css";
17-
import "@blocknote/react/style.css";
16+
import { useCreateBlockNote } from "@blocknote/react";
17+
import { BlockNoteView } from "@blocknote/mantine";
18+
import "@blocknote/mantine/style.css";
1819

1920
// Our <Editor> component we can reuse later
2021
export default function Editor() {

examples/02-ui-components/05-side-menu-drag-handle-items/App.tsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import {
55
RemoveBlockItem,
66
SideMenu,
77
SideMenuController,
8-
useComponentsContext,
98
useCreateBlockNote,
109
} from "@blocknote/react";
1110
import { BlockNoteView } from "@blocknote/mantine";
1211
import "@blocknote/mantine/style.css";
1312

13+
import { ResetBlockTypeItem } from "./ResetBlockTypeItem";
14+
1415
export default function App() {
1516
// Creates a new editor instance.
1617
const editor = useCreateBlockNote({
@@ -34,8 +35,6 @@ export default function App() {
3435
],
3536
});
3637

37-
const Components = useComponentsContext()!;
38-
3938
// Renders the editor instance.
4039
return (
4140
<BlockNoteView editor={editor} sideMenu={false}>
@@ -48,12 +47,7 @@ export default function App() {
4847
<RemoveBlockItem {...props}>Delete</RemoveBlockItem>
4948
<BlockColorsItem {...props}>Colors</BlockColorsItem>
5049
{/* Item which resets the hovered block's type. */}
51-
<Components.Generic.Menu.Item
52-
onClick={() => {
53-
editor.updateBlock(props.block, { type: "paragraph" });
54-
}}>
55-
Reset Type
56-
</Components.Generic.Menu.Item>
50+
<ResetBlockTypeItem {...props}>Reset Type</ResetBlockTypeItem>
5751
</DragHandleMenu>
5852
)}
5953
/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {
2+
DragHandleMenuProps,
3+
useBlockNoteEditor,
4+
useComponentsContext,
5+
} from "@blocknote/react";
6+
7+
export function ResetBlockTypeItem(props: DragHandleMenuProps) {
8+
const editor = useBlockNoteEditor();
9+
10+
const Components = useComponentsContext()!;
11+
12+
return (
13+
<Components.Generic.Menu.Item
14+
onClick={() => {
15+
editor.updateBlock(props.block, { type: "paragraph" });
16+
}}>
17+
Reset Type
18+
</Components.Generic.Menu.Item>
19+
);
20+
}

0 commit comments

Comments
 (0)