tiptap/docs/examples/collaborative-editing.md
2021-12-09 19:06:54 +01:00

39 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
tableOfContents: true
---
# Collaborative editing
## Introduction
This example shows how you can use Tiptap to let multiple users collaborate in the same document in real-time.
It connects all clients to a WebSocket server and merges changes to the document with the power of [Y.js](https://github.com/yjs/yjs). If you want to learn more about collaborative text editing, check out [our guide on collaborative editing](/guide/collaborative-editing).
## Example
:::warning Shared Document
Be nice! The content of this editor is shared with other users from the Internet.
:::
https://embed.tiptap.dev/preview/Examples/CollaborativeEditing
## Backend
In case youre wondering what kind of sorcery you need on the server to achieve this, here is the whole backend code for the demo:
:::warning Request early access
Our plug & play collaboration backend hocuspocus is still work in progress. If you want to give it a try, [get early access](https://www.hocuspocus.dev).
:::
```js
import { Server } from '@hocuspocus/server'
import { RocksDB } from '@hocuspocus/extension-rocksdb'
const server = Server.configure({
port: 80,
extensions: [
new RocksDB({ path: './database' }),
],
})
server.listen()
```