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/editor-basics/setup.mdx
+35-12Lines changed: 35 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -19,39 +19,62 @@ function useCreateBlockNote(
19
19
):BlockNoteEditor;
20
20
21
21
typeBlockNoteEditorOptions= {
22
-
initialContent?:PartialBlock[];
23
-
domAttributes?:Record<string, string>;
24
-
defaultStyles?:boolean;
25
-
uploadFile?: (file:File) =>Promise<string>;
22
+
animations?:boolean;
26
23
collaboration?:CollaborationOptions;
24
+
defaultStyles?:boolean;
27
25
dictionary?:Dictionary;
26
+
disableExtensions?:string[];
27
+
domAttributes?:Record<string, string>;
28
+
dropCursor?: (opts: {
29
+
editor:BlockNoteEditor;
30
+
color?:string|false;
31
+
width?:number;
32
+
class?:string;
33
+
}) =>Plugin;
34
+
initialContent?:PartialBlock[];
35
+
resolveFileUrl: (url:string) =>Promise<string>
28
36
schema?:BlockNoteSchema;
37
+
setIdAttribute?:boolean;
38
+
sideMenuDetection?:"viewport"|"editor";
39
+
tabBehavior?:"prefer-navigate-ui"|"prefer-indent"
29
40
trailingBlock?:boolean;
30
-
animations?:boolean;
41
+
uploadFile?:(file:File) =>Promise<string>;
31
42
};
32
43
```
33
44
34
45
The hook takes two optional parameters:
35
46
36
47
**options:** An object containing options for the editor:
37
48
38
-
`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).
49
+
`animations`: Whether changes to blocks (like indentation, creating lists, changing headings) should be animated or not. Defaults to `true`.
39
50
40
-
`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.
51
+
`collaboration`: Options for enabling real-time collaboration. See [Real-time Collaboration](/docs/advanced/real-time-collaboration) for more info.
41
52
42
53
`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.
43
54
44
-
`uploadFile`: A function which handles file uploads and eventually returns the URL to the uploaded file. Used for [Image blocks](/docs/editor-basics/default-schema#image).
55
+
`dictionary`: Provide strings for localization. See the [Localization / i18n example](/examples/basic/localization) and [Custom Placeholders](/examples/basic/custom-placeholder).
45
56
46
-
`collaboration`: Options for enabling real-time collaboration. See [Real-time Collaboration](/docs/advanced/real-time-collaboration) for more info.
57
+
`disableExtensions` (_advanced_): Disables TipTap extensions used in BlockNote by default, based on their names.
47
58
48
-
`dictionary`: Provide strings for localization. See the [Localization / i18n example](/examples/basic/localization) and [Custom Placeholders](/examples/basic/custom-placeholder).
59
+
`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.
60
+
61
+
`dropCursor`: A replacement indicator to use when dragging and dropping blocks. Uses the [ProseMirror drop cursor](https://github.com/ProseMirror/prosemirror-dropcursor), or a modified version when [Column Blocks](/docs/editor-basics/document-structure#column-blocks) are enabled.
62
+
63
+
`initialContent:` The content that should be in the editor when it's created, represented as an array of [Partial Blocks](/docs/manipulating-blocks#partial-blocks).
49
64
50
-
`schema` (_advanced_): The editor schema if you want to extend your editor with custom blocks, styles, or inline content [Custom Schemas](/docs/custom-schemas).
65
+
`resolveFileUrl:` An async function that fetches the download URL of a file from an initial URL.
66
+
67
+
`schema`: The editor schema if you want to extend your editor with custom blocks, styles, or inline content [Custom Schemas](/docs/custom-schemas).
68
+
69
+
`setIdAttribute`: Whether to render an `id` HTML attribute on blocks as well as a `data-id` attribute. Defaults to `false`.
70
+
71
+
`sideMenuDetection`: Determines whether the mouse cursor position is locked to the editor bounding box for showing the [Block Side Menu](/docs/ui-components/side-menu) and block drag & drop. When set to `viewport`, the Side Menu will be shown next to the nearest block to the cursor, regardless of where it is in the viewport. Dropping blocks will also be locked to the editor bounding box. Otherwise, the Side Menu will only be shown when the cursor is within the editor bounds, and blocks can only be dropped when hovering the editor. In order to use multiple editors, must be set to `editor`. Defaults to `viewport`.
72
+
73
+
`tabBehavior`: Determines whether pressing the tab key should navigate the UI for keyboard accessibility or indent the current block. Defaults to `prefer-navigate-ui`.
51
74
52
75
`trailingBlock`: An option which user can pass with `false` value to disable the automatic creation of a trailing new block on the next line when the user types or edits any block. Defaults to `true` if undefined.
53
76
54
-
`animations`: Whether changes to blocks (like indentation, creating lists, changing headings) should be animated or not. Defaults to `true`.
77
+
`uploadFile`: A function which handles file uploads and eventually returns the URL to the uploaded file. Used for [Image blocks](/docs/editor-basics/default-schema#image).
55
78
56
79
**deps:** Dependency array that's internally passed to `useMemo`. A new editor will only be created when this array changes.
0 commit comments