tiptap/docs/examples/collaborative-editing.md

31 lines
913 B
Markdown
Raw Normal View History

---
tableOfContents: true
---
2020-09-27 03:08:49 +08:00
# Collaborative editing
2021-02-04 23:56:17 +08:00
## Introduction
2021-10-20 04:30:45 +08:00
This example shows how you can use Tiptap to let multiple users collaborate in the same document in real-time.
2020-10-05 20:56:45 +08:00
2020-11-30 21:12:19 +08:00
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).
2020-10-05 20:56:45 +08:00
2021-02-04 23:56:17 +08:00
## Example
2020-11-06 21:49:40 +08:00
:::warning Shared Document
Be nice! The content of this editor is shared with other users from the Internet.
2020-09-27 03:04:33 +08:00
:::
2020-09-26 20:17:51 +08:00
2021-10-19 00:01:47 +08:00
https://embed.tiptap.dev/preview/Examples/CollaborativeEditing
2020-11-30 21:20:31 +08:00
2021-02-04 23:56:17 +08:00
## 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:
2020-11-30 21:20:31 +08:00
```js
import { Server } from '@hocuspocus/server'
const server = Server.configure({
2020-12-03 20:50:01 +08:00
port: 80,
2020-11-30 21:20:31 +08:00
})
server.listen()
```