Skip to content

Commit 661a0a1

Browse files
docs: Update getting started & comments pages (#2218)
* Updated docs * Revert "Updated docs" This reverts commit 2e78c2d. * Updated docs
1 parent c2c6dfb commit 661a0a1

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

docs/content/docs/features/collaboration/comments.mdx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,30 @@ BlockNote supports Comments, Comment Threads (replies) and emoji reactions out o
1010

1111
To enable comments in your editor, you need to:
1212

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.
1718

1819
```tsx
1920
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).
26+
resolveUsers: async (userIds: string[]) => { ... },
27+
// Optional, can be left undefined
28+
schema: BlockNoteSchema.create(...)
29+
}),
30+
...
31+
],
2832
collaboration: {
29-
// ... // see real-time collaboration docs
33+
// See real-time collaboration docs
34+
...
3035
},
36+
...
3137
});
3238
```
3339

@@ -121,7 +127,7 @@ _Note: The `ThreadStoreAuth` only used to show / hide options in the UI. To secu
121127

122128
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).
123129

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`.
125131

126132
This function is called with an array of user IDs, and should return an array of `User` objects in the same order.
127133

docs/content/docs/getting-started/index.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ To install BlockNote with [NPM](https://docs.npmjs.com/downloading-and-installin
1414

1515
```console tab="npm"
1616
npm install @blocknote/core @blocknote/react @blocknote/mantine
17+
npm install @mantine/core @mantine/hooks @mantine/utils
1718
```
1819

1920
```console tab="pnpm"
2021
pnpm add @blocknote/core @blocknote/react @blocknote/mantine
22+
npm install @mantine/core @mantine/hooks @mantine/utils
2123
```
2224

2325
```console tab="bun"
2426
bun add @blocknote/core @blocknote/react @blocknote/mantine
27+
npm install @mantine/core @mantine/hooks @mantine/utils
2528
```
2629

27-
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:
2831

2932
- **[Mantine](/docs/getting-started/mantine)** (`@blocknote/mantine`) - Recommended for new projects
3033
- **[Shadcn](/docs/getting-started/shadcn)** (`@blocknote/shadcn`)

docs/content/docs/getting-started/mantine.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ imageTitle: Mantine rich text editor using BlockNote
99
[Mantine](https://mantine.dev/) is an open-source collection of React components.
1010

1111
```console tab="npm"
12-
npm install @mantine/core @mantine/hooks @mantine/utils
1312
npm install @blocknote/core @blocknote/react @blocknote/mantine
13+
npm install @mantine/core @mantine/hooks @mantine/utils
1414
```
1515

1616
```console tab="pnpm"
17-
pnpm add @mantine/core @mantine/hooks @mantine/utils
1817
pnpm add @blocknote/core @blocknote/react @blocknote/mantine
18+
npm install @mantine/core @mantine/hooks @mantine/utils
1919
```
2020

2121
```console tab="bun"
22-
bun add @mantine/core @mantine/hooks @mantine/utils
2322
bun add @blocknote/core @blocknote/react @blocknote/mantine
23+
npm install @mantine/core @mantine/hooks @mantine/utils
2424
```
2525

2626
To use BlockNote with Mantine, you can import `BlockNoteView` from `@blocknote/mantine` and the stylesheet from `@blocknote/mantine/style.css`.

0 commit comments

Comments
 (0)