ProseMirror + CRDT's?

CRDTs, such as Yjs or automerge, are data structures that can be manipulated by many clients concurrently and merged automatically without merge conflicts.

By mapping the ProseMirror state to a CRDT we allow multiple clients to edit the document concurrently - allowing collaborative Google Docs-like editing.

ProseMirror already has a collaboration module: collab. But the collab approach is centralized (it requires a central server that decides in which order document transformations are applied). CRDTs, on the other hand, work in distributed systems and generally work peer-to-peer (e.g. over WebRTC).

Furthermore, collab does not support offline editing, while CRDTs do. Marijn’s blog post gives some valid points against automatic merging of offline edits. He explains that changes that were produced offline should be merged manually to prevent that automatic merges results in documents with “a strange mishmash of text when two people edited the same sentence in different ways”. I believe that automatic merging of offline edits is in practice preferable to manually resolving conflicts. But the user should get visual clues about changes that were produced while offline. Conflicts, that were automatically resolved, could be presented to the user for manual review.

Our goal is to implement an alternative collaboration module that works peer-to-peer and supports offline editing. Let me know if I missed something @saranrapjs.

5 Likes