You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/website/docs/docs/editor.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
# Customizing the Editor
2
2
3
-
While you can get started with BlockNote in minutes, it's likely that you'll want to customize its features and functionality to better suit your app.
3
+
While you can get started with BlockNote in minutes, it's likely that you'll
4
+
want to customize its features and functionality to better suit your app.
4
5
5
6
## Editor Options
6
7
7
-
There are a number of options that you can pass to `useBlockNote()`, which you can use to customize the editor. You can find the full list of these below:
8
+
There are a number of options that you can pass to `useBlockNote()`, which you
9
+
can use to customize the editor. You can find the full list of these below:
8
10
9
11
```typescript
10
12
exporttypeBlockNoteEditorOptions=Partial<{
@@ -15,8 +17,10 @@ export type BlockNoteEditorOptions = Partial<{
@@ -34,10 +38,14 @@ export type BlockNoteEditorOptions = Partial<{
34
38
35
39
`slashMenuItems:` The commands that are listed in the editor's [Slash Menu](/docs/slash-menu). If this option isn't defined, a default list of commands is loaded.
36
40
37
-
`uiFactories:` Factories used to create a custom UI for BlockNote, which you can find out more about in [Creating Your Own UI Elements](/docs/vanilla-js#creating-your-own-ui-elements).
41
+
`customElements:` React components for a custom [Formatting Toolbar](/docs/formatting-toolbar#custom-formatting-toolbar) and/or [Drag Handle Menu](/docs/side-menu#custom-drag-handle-menu) to use.
42
+
43
+
`uiFactories:` UI element factories for creating a custom UI, including custom positioning & rendering. You can find out more about UI factories in [Creating Your Own UI Elements](/docs/vanilla-js#creating-your-own-ui-elements).
38
44
39
45
`defaultStyles`: Whether to use the default font and reset the styles of `<p>`, `<li>`, `<h1>`, etc. elements that are used in BlockNote. Defaults to true if undefined.
40
46
47
+
`theme:` Whether to use the light or dark theme.
48
+
41
49
## Demo: Saving & Restoring Editor Contents
42
50
43
51
By default, BlockNote doesn't preserve the editor contents when your app is reopened or refreshed. However, using the editor options, you can change this by using the editor options.
You can then tell BlockNote to use your custom Formatting Toolbar using the `uiFactories` option in `useBlockNote`, but you first have to turn it into a `FormattingToolbarFactory`. Fortunately, you can easily do this using the `createReactFormattingToolbarFactory` function:
19
+
You can then tell BlockNote to use your custom Formatting Toolbar using
You can then tell BlockNote to use your custom Drag Handle Menu using the `uiFactories` option in `useBlockNote`, but you first have to turn it into a `SideMenuFactory` that uses it. Fortunately, you can easily do this using the `createReactSideMenuFactory` function:
79
+
You can then tell BlockNote to use your custom Drag Handle Menu using
0 commit comments