课程 17 - 协同
在本课程中,我们将探讨如何实现多人协同编辑功能。我们会介绍几个核心概念和技术,包括历史记录、本地优先(Local-first)以及 CRDT。
历史记录
Local-first
The past, present, and future of local-first
CRDT
提到协同算法
Loro Excalidraw Exampleautomerge wasm
系列教程:
- An Interactive Intro to CRDTs
- Building a Collaborative Pixel Art Editor with CRDTs
- Making CRDTs 98% More Efficient
ts
interface CRDT<T, S> {
value: T;
state: S;
merge(state: S): void;
}
Y.js
https://tiptap.dev/docs/collaboration/getting-started/overview#about-yjs
As a CRDT, Y.js ensures that the sequence of changes does not impact the final state of the document, similar to how Git operates with commits. This guarantees that all copies of the data remain consistent across different environments.
数据结构设计
扩展阅读
- Learn Yjs
- Movable tree CRDTs and Loro's implementation
- CRDTs: The Hard Parts
- Peritext - A CRDT for Rich-Text Collaboration
- Collaborative Text Editing with Eg-Walker
- Local-first software - You own your data, in spite of the cloud
- I was wrong. CRDTs are the future
- 5000x faster CRDTs: An Adventure in Optimization
- TipTap offline support
- An Interactive Intro to CRDTs
- Building a Collaborative Pixel Art Editor with CRDTs
- Making CRDTs 98% More Efficient