The Collaboration extension comes with its own history implementation and is not compatible with the
@tiptap/extension-undo-redo extension. Make sure to remove the UndoRedo extension if you’re using Collaboration.Installation
Basic Usage
Configuration Options
Y.Doc
An initialized Y.js document. This is the shared data structure that will be synchronized across all clients.Example:
string
Name of the Y.js fragment to use. You can use different fields to sync multiple editors with one Y.js document.Default:
'default'XmlFragment
A raw Y.js fragment. Use this instead of
document and field if you want direct control over the fragment.any
The collaboration provider instance (e.g., WebsocketProvider, WebrtcProvider). While not required by the extension itself, storing it here makes it accessible via the extension.Default:
null() => void
Callback fired when the content from Yjs is initially rendered to Tiptap. Useful for showing a loading state until the document is ready.
object
Options passed to the Y.js sync plugin. See y-prosemirror documentation for available options.
object
Options passed to the Y.js undo plugin.
Commands
command
Undo recent changes.Keyboard shortcut:
Cmd/Ctrl + Zcommand
Reapply reverted changes.Keyboard shortcuts:
Cmd/Ctrl + Shift + Z or Cmd/Ctrl + YStorage
boolean
Whether collaboration is currently disabled. This is automatically set when collaboration encounters a content error.