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/content/docs/features/collaboration/comments.mdx
+20-14Lines changed: 20 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,24 +10,30 @@ BlockNote supports Comments, Comment Threads (replies) and emoji reactions out o
10
10
11
11
To enable comments in your editor, you need to:
12
12
13
-
- provide a `resolveUsers` so BlockNote can retrieve and display user information (names and avatars).
14
-
- provide a `ThreadStore` so BlockNote can store and retrieve comment threads.
15
-
- enable real-time collaboration (see [Real-time collaboration](/docs/features/collaboration))
16
-
- optionally provide a schema for comments and comment editors to use. If left undefined, they will use the [default comment editor schema](https://github.com/TypeCellOS/BlockNote/blob/main/packages/react/src/components/Comments/defaultCommentEditorSchema.ts). See [here](/docs/features/custom-schemas) to find out more about custom schemas.
13
+
- Create an instance of the `CommentsExtension` and pass it to the `extensions` editor option.
14
+
- Pass `resolveUsers` to your `CommentsExtension` instance, so it can retrieve and display user information (names and avatars).
15
+
- Provide a `ThreadStore` to your `CommentsExtension` instance, so it can store and retrieve comment threads.
16
+
- Enable real-time collaboration (see [Real-time collaboration](/docs/features/collaboration))
17
+
- Optionally provide a schema for comments and comment editors to use. If left undefined, they will use the [default comment editor schema](https://github.com/TypeCellOS/BlockNote/blob/main/packages/react/src/components/Comments/defaultCommentEditorSchema.ts). See [here](/docs/features/custom-schemas) to find out more about custom schemas.
17
18
18
19
```tsx
19
20
const editor =useCreateBlockNote({
20
-
resolveUsers: async (userIds:string[]) => {
21
-
// return user information for the given userIds (see below)
22
-
},
23
-
comments: {
24
-
threadStore: yourThreadStore, // see below
25
-
schema: BlockNoteSchema.create(...) // optional, can be left undefined
26
-
},
27
-
// ...
21
+
extensions: [
22
+
CommentsExtension({
23
+
// See below.
24
+
threadStore: ...,
25
+
// Return user information for the given userIds (see below).
@@ -121,7 +127,7 @@ _Note: The `ThreadStoreAuth` only used to show / hide options in the UI. To secu
121
127
122
128
When a user interacts with a comment, the data is stored in the ThreadStore, along with the active user ID (as specified when initiating the ThreadStore).
123
129
124
-
To display comments, BlockNote needs to retrieve user information (such as the username and avatar) based on the user ID. To do this, you need to provide a `resolveUsers` function in the editor options.
130
+
To display comments, BlockNote needs to retrieve user information (such as the username and avatar) based on the user ID. To do this, you need to provide a `resolveUsers` function to your `CommentsExtension`.
125
131
126
132
This function is called with an array of user IDs, and should return an array of `User` objects in the same order.
BlockNote provides multiple UI library options. Choose the one that best fits your project:
30
+
This guide uses the [Mantine](https://mantine.dev/) version of BlockNote's UI, which works great out-of-the-box. However, BlockNote provides multiple UI library options. Choose the one that best fits your project:
28
31
29
32
-**[Mantine](/docs/getting-started/mantine)** (`@blocknote/mantine`) - Recommended for new projects
0 commit comments