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: docs/pages/docs/custom-schemas/custom-blocks.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,11 @@
1
+
import { Callout } from"nextra/components";
2
+
import { Example } from"@/components/example";
1
3
2
4
## Custom Block Types
3
5
4
6
In addition to the default block types that BlockNote offers, you can also make your own custom blocks. Take a look at the demo below, in which we add a custom alert block to a BlockNote editor, as well as a custom [Slash Menu Item](/docs/slash-menu#custom-items) to insert it.
5
7
6
-
<Examplename="alert-block" />
8
+
<Examplename="custom-schema/alert-block" />
7
9
8
10
<Callouttype={"info"}>While custom blocks open a lot of doors for what you can do with BlockNote, we're still working on the API and there are a few limitations for the kinds of blocks you can create. We'd love to hear your feedback on GitHub or in our Discord community!</Callout>
description: 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.
4
4
imageTitle: Customizing the Editor
5
5
path: /docs/editor
6
6
---
7
7
8
8
TODO:
9
-
- review API
10
-
- what needs to be part of useBlockNote vs the component?
11
-
- expose / document hooks
12
-
- controlled / uncontrolled
9
+
[x] review API
10
+
[x] what needs to be part of useBlockNote vs the component?
11
+
[] document instantiation / useBlockNote
12
+
[] expose / document hooks
13
+
[] document events
14
+
[] explain controlled / uncontrolled
13
15
14
-
# Customizing the Editor
16
+
# Editor Setup
15
17
16
18
While you can get started with BlockNote in minutes, it's likely that you'll
17
19
want to customize its features and functionality to better suit your app.
@@ -23,32 +25,41 @@ can use to customize the editor. You can find the full list of these below:
`editable:` Locks the editor from being editable by the user if set to `false`. [Editor Functions](/docs/blocks#editor-functions) will still work.
39
-
40
40
`initialContent:` The content that should be in the editor when it's created, represented as an array of [partial block objects](/docs/manipulating-blocks#partial-blocks).
41
41
42
42
`domAttributes:` An object containing HTML attributes that should be added to various DOM elements in the editor. See [Adding DOM Attributes](/docs/theming#adding-dom-attributes) for more.
43
43
44
-
`onEditorReady:` A callback function that runs when the editor is ready to be used.
45
-
46
-
`onEditorContentChange:` A callback function that runs whenever the editor's contents change.
47
-
48
-
`onTextCursorPositionChange:` A callback function that runs whenever the text cursor position changes. Head to [Text Cursor](/docs/cursor-selections#text-cursor) to see how you can make use of this.
49
-
50
44
`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.
51
45
52
46
`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.
53
47
54
48
`uploadFile`: A function which handles file uploads and eventually returns the URL to the uploaded file. Used by the [Image Toolbar](/docs/image-toolbar).
49
+
50
+
`collaboration`: Options for enabling real-time collaboration. See [Collaboration](/docs/collaboration) for more info.
51
+
52
+
`blockSpecs` (_advanced_): _advanced_ Specifications for Custom Blocks. See [Block Specs](/docs/block-specs) more info.
53
+
54
+
`inlineContentSpecs` (_advanced_): Specifications for Custom Inline Content. See [Inline Content Specs](/docs/inline-content-specs) for more info.
55
+
56
+
`styleSpecs` (_advanced_): Specifications for Custom Styles. See [Style Specs](/docs/style-specs) for more info.
Copy file name to clipboardExpand all lines: docs/pages/docs/ui-components/formatting-toolbar.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ If you want to change the buttons/dropdowns in the Formatting Toolbar, or replac
19
19
20
20
You can see how this is done in the example below, which has a custom Formatting Toolbar. It contains the same items as the default Formatting Toolbar, with and added blue text/background color and code style button.
`CustomFormattingToolbar` is the component we use to replace the default Formatting Toolbar. You can see it's made up of a bunch of other components that are exported by BlockNote. Read on to [Components](/docs/formatting-toolbar#components) to find out more about these.
You can use the provided `uploadToTempFilesOrg` function to as a starting point, which uploads files to [tmpfiles.org](https://tmpfiles.org/). However, it's not recommended to use this in a production environment - you should use your own backend:
Copy file name to clipboardExpand all lines: docs/pages/docs/ui-components/side-menu.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ If you want to change the items in the Side Menu, or replace it altogether, you
23
23
24
24
You can see how this is done in the example below, which has a custom Side Menu with two items. The first one deletes the selected block, while the second one is a drag handle, which opens a menu on click.
25
25
26
-
<Examplename="side-menu-buttons" />
26
+
<Examplename="ui-components/side-menu-buttons" />
27
27
28
28
`CustomDragHandleMenu` is the component we use to replace the default Side Menu. You can see it's made up of a bunch of other components that are exported by BlockNote. Read on to [Components](/docs/side-menu#components) to find out more about these.
29
29
@@ -35,7 +35,7 @@ If you want to change the items in the Drag Handle Menu, or replace it altogethe
35
35
36
36
You can see how this is done in the example below, which has a custom Drag Handle Menu. It contains the default items, as well as a custom item which opens an alert.
`CustomDragHandleMenu` is the component we use to replace the default Drag Handle Menu. You can see it's made up of a bunch of other components that are exported by BlockNote. Read on to [Components](/docs/side-menu#components) to find out more about these.
0 commit comments