-
-
Notifications
You must be signed in to change notification settings - Fork 532
/
Copy pathApp.tsx
49 lines (46 loc) · 1.16 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import "@blocknote/core/fonts/inter.css";
import { BlockNoteView } from "@blocknote/mantine";
import "@blocknote/mantine/style.css";
import {
DragHandleButton,
SideMenu,
SideMenuController,
useCreateBlockNote,
} from "@blocknote/react";
import { RemoveBlockButton } from "./RemoveBlockButton.js";
export default function App() {
// Creates a new editor instance.
const editor = useCreateBlockNote({
initialContent: [
{
type: "paragraph",
content: "Welcome to this demo!",
},
{
type: "paragraph",
content: "<- Notice the new button in the side menu",
},
{
type: "paragraph",
content: "Click it to remove the hovered block",
},
{
type: "paragraph",
},
],
});
// Renders the editor instance.
return (
<BlockNoteView editor={editor} sideMenu={false}>
<SideMenuController
sideMenu={(props) => (
<SideMenu {...props}>
{/* Button which removes the hovered block. */}
<RemoveBlockButton {...props} />
<DragHandleButton {...props} />
</SideMenu>
)}
/>
</BlockNoteView>
);
}