Skip to content

Commit

Permalink
Add documentation for useLegacyWrapping option in comments extension (#…
Browse files Browse the repository at this point in the history
…61)

* added docs for new useLegacyWrapping option for comments extension

* added changesets

* update wording on configuration page
  • Loading branch information
bdbch authored Nov 7, 2024
1 parent d57a0f6 commit de0b8c5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-ads-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tiptap-docs': patch
---

Added new information about the useLegacyWrapping option for the comments extension.
24 changes: 24 additions & 0 deletions src/content/comments/core-concepts/configure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ meta:
category: Comments
---

import { Callout } from '@/components/ui/Callout'

Comments are embedded within documents in the Collaboration Cloud. To enable comments, integrate the TiptapCollabProvider and configure your setup to support comment functionality.

## provider
Expand Down Expand Up @@ -68,3 +70,25 @@ Comments.Configure({
onClickThread: (id) => console.log('Thread clicked', id),
})
```

## useLegacyWrapping

<Callout title="Warning" variant="warning">
The new wrapping mechanism uses a different schema for threads on block nodes, which is not
compatible with the previous wrapping behavior. If this is set to `false` without mapping existing
thread nodes to the new schema, the threads content will be stripped from the document.
</Callout>

A boolean option that controls whether to use the legacy wrapping mechanism for multi-line comments. We suggest for new implementations to set this to `false`, and existing integrations can stay on the previous behavior. This is only required for backwards compatibility with existing comments, and it will
be removed in the future.

The new wrapping mechanism is more flexible, allowing to wrap content more precise and supports mixed wrapping of inline and block nodes.

**Default:** `true`

```js
Comments.configure({
// enable new flexible block wrapping
useLegacyWrapping: false,
})
```
6 changes: 6 additions & 0 deletions src/content/comments/getting-started/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,19 @@ const editor = new Editor({
...,
CommentsKit.configure({
provider: collabProvider,
useLegacyWrapping: false, // optional, will be the default in the future
}),
]
})
```

Your editor is now ready to support threads.

<Callout title="Important" variant="warning">
The new `useLegacyWrapping` option can be set to false to use a new block wrapping mechanism for
multi-line comments. This **will become the default** in the future.
</Callout>

<hr />

See a full example of how to use the Comments extension in the following example:
Expand Down

0 comments on commit de0b8c5

Please sign in to comment.