Collaboration
Real-time collaborative editing with Y.js, remote carets and a presence list.
Collaboration is shipped as a separate entry point, vue-echo-editor/collaboration, so apps that don't use it never install or download Y.js.
Install the peer dependencies
Any Y.js provider works: y-websocket, Hocuspocus, y-webrtc, y-indexeddb or Tiptap Cloud.
Create the document and provider
Register CollaborationKit
With collaboration the Y.js document is the source of truth: v-model still emits updates, but incoming modelValue changes are ignored. Load initial content on the server (or into the Y.Doc) instead.
CollaborationKit options
| Option | Type | Default | Description |
|---|---|---|---|
document | Y.Doc | — | Required. The shared document. |
provider | provider | null | Enables remote carets and presence (needs an awareness instance). |
user | { name, color, avatar? } | false | false | The local user shown to others. |
field | string | 'default' | Name of the Y.XmlFragment in the document. |
undoRedo | boolean | true | Show undo / redo buttons backed by the Y.js undo manager. |
collaboration | object | {} | Extra options for Tiptap's Collaboration. |
caret | object | {} | Extra options for CollaborationCaret (custom caret rendering …). |
Presence
<CollaborationUsers :provider :max="5" /> renders an avatar stack of connected users. Build your own UI with the composable:
Offline support
Combine a network provider with y-indexeddb to keep working offline and sync when the connection returns:
Try it without a server
The examples app links two in-memory Y.js documents so you can see two editors syncing live on one page.