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
The Block Config describes the shape of your custom blocks. Use it to specify the type, properties (props) and content your custom blocks should support:
47
47
48
48
```typescript
49
-
typeCustomBlockConfig= {
49
+
typeBlockConfig= {
50
50
type:string;
51
51
content:"inline"|"none";
52
52
readonly propSchema:PropSchema;
53
+
isSelectable?:boolean;
54
+
hardBreakShortcut?:"shift+enter"|"enter"|"none";
53
55
};
54
56
```
55
57
@@ -87,6 +89,16 @@ type PropSchema<
87
89
88
90
_In the alert demo, we add a `type` prop for the type of alert that we want (warning / error / info / success). We also want basic styling options, so we add text alignment and text color from the [Default Block Properties](/docs/block-types#default-block-properties)._
89
91
92
+
**`isSelectable`**
93
+
94
+
Can be set to false in order to make the block non-selectable, both using the mouse and keyboard. This also helps with being able to select non-editable content within the block. Should only be set to false when `content` is `none` and defaults to true.
95
+
96
+
**`hardBreakShortcut`**
97
+
98
+
Defines which keyboard shortcut should be used to insert a hard break into the block's inline content. Defaults to `"shift+enter"`.
You can then instantiate your editor with this custom schema, as explained on the [Custom Schemas](/docs/custom-schemas) page.
161
+
162
+
### Improving the User Experience
163
+
164
+
Now you know how to create a custom block and add it to your editor. However, users don't have a way of creating instances of it to their documents.
165
+
166
+
To fix this, it's recommended to implement a [command to insert your custom in the Slash Menu](/docs/ui-components/suggestion-menus#changing-slash-menu-items), and [an item for it in the Block Type Select](/docs/ui-components/formatting-toolbar#changing-block-type-select-items). The demo below builds upon the earlier alert block example, adding both of these.
@@ -13,10 +14,13 @@ Learn how documents (the content of the rich text editor) are structured to make
13
14
Each BlockNote document is made up of a list of blocks.
14
15
A block is a piece of content like a paragraph, heading, list item or image. Blocks can be dragged around by users in the editor. A block contains a piece of content and optionally nested (child) blocks:
The Image Toolbar appears whenever you select an image that doesn't have a URL, or when you click the "Replace Image" button in the [Formatting Toolbar](/docs/formatting-toolbar) when an image is selected.
0 commit comments