Collaborative Text Editing


Yjs is a Javascript library for collaborative editing of rich text and drawings (demos). It has the following bindings to popular JS-based editor libraries.

Name Cursors Binding Demo
ProseMirror y-prosemirror demo
Quill y-quill demo
CodeMirror y-codemirror demo
Monaco y-monaco demo

ProseMirror has built-in facilities for collaborative editing, and so does Quill (as “Delta” data). I do not know if Yjs use these facilities. I do not see any such facilities in CodeMirror and Monaco, but maybe I did not look hard enough.

Yjs is based on Conflict-free Replicated Data Type or CRDT for distributed computing. There are now many decentralized, peer-to-peer (P2P) database systems based on CRDT, but Yjs has this very specific application in mind. There’s Ydb: a distributed database for Yjs documents, which was apparently created for use with Ysj, but I do not know how general it is.

Yjs is used in many commercial products, including Nimbus Note (or see “Yjs in the Wild – Yjs Docs” ).

Yjs is usually used to add data syncing capabilities to existing JS rich text editing libraries, but Y-Dat uses Dat, a distributed data sharing system. Since both Yjs and Dat are based on append-only log (to be more specific, Hypercore Protocol, in Dat’s case), there is a natural overlap of functionality.

Postscript: According to “Hypercore protocol: a distributed (P2P) append-only log | Hacker News,” Dat depends on the older protocol and is no longer maintained.

Yjs can be used in conjunction with IPFS, but maybe IPFS is used just as a pubsub hub. “Tutorial: How to build an Collaborative Editing Application with IPFS using CRDT – YouTube

Yjs claims their benchmark tests show it is significantly faster than Automerge. Automerge, “a JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically,” seems to have been created by folks at Ink & Switch, an “industrial research lab working on digital tools for creativity and productivity.” They also publish Hypermerge: build p2p collaborative applications without any server infrastructure in Node.js, which seems to be a combination of Automerge and Hypercore.

By the way, Ink & Switch has published some interesting articles. “Local-first software: You own your data, in spite of the cloud” is relevant to this topic.

Though it is not directly related to this topic, I also found “Capstone, a tablet for thinking” interesting. Lessons from Capstone are incorporated in the Muse iOS app.

The performance advantage of Yjs possibly comes from the way Yjs implements its version of CDRTs.

In “3 JavaScript Tools for Collaborative Editing – Geovation Tech Blog,” the users chooses ShareDB, “Realtime database backend based on Operational Transformation (OT)” among the three choices all of which support OT, though none supports offline editing. ShareDB does not come with P2P replication, though. “Visualization of OT with a central server” is helpful in understanding OT.

So far it has been about collaborative rich text editing. How about collaborative plain text editing?

I share with the author of “Open source collaborative text editors” the same sentiment expressed at the beginning of this article. The author looked at CKEditor 5 ( “Overview – CKEditor 5 Documentation” ) and ProseMirror-based Atlaskit Editor (collaboration sample). Neither provided a matching server, but the author settled on the latter and created one for it.

The developers of CKEditor recount the difficulty of re-implementing CKEditor so it can support realtime collaborative editing, in “Lessons learned from creating a rich-text editor with real-time collaboration.” They chose OT over CRDT but they do not spell out the reason. People are talking about this article on Hacker News. Mr. Sam Broner, who commented on my “Microsoft’s Fluid Framework for Collaborative Realtime Text Editing,” voices his opinion in the thread.

Ace, “the High Performance Code Editor for the Web” is a Web plain text editor. It has Ace-Collab-Ext: Enhances the Ace Editor with real time collaboration user experience, which relies on Convergence: The Real-Time Collaboration Engine.


Collaborative Text Editing」への3件のフィードバック

  1. ピンバック: Microsoft’s Fluid Framework for Collaborative Realtime Text Editing | あくまで暫定措置としてのブログ
  2. ピンバック: Operational Transformation or OT | あくまで暫定措置としてのブログ
  3. ピンバック: Quill Delta | あくまで暫定措置としてのブログ


以下に詳細を記入するか、アイコンをクリックしてログインしてください。 ロゴ アカウントを使ってコメントしています。 ログアウト /  変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト /  変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト /  変更 )

%s と連携中

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください