-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phase 3: Sync Engine and Real-Time Collaboration #52593
Comments
Hello Team, As a first task of this issue, I have added my findings on #23129 PR. Thanks |
Hi @prajapatisagar Thanks for the review there. Actually, the exploration has moved now to this PR #52681 That was a good reminder though, I'm going to close that old PR now. |
I merged the initial bootstrap behind an experimental flag and added a number of todo list items to the current issue. You all feel free to own one of these tasks and iterate on it. |
Out of the list of subtasks for real time collaboration, I've created an issue for inline block commenting so there's a more dedicated space to discuss and explore: #59445 |
I found this presentation very informative, there may be some useful information for the collaborative sync engine: "New algorithms for collaborative text editing" by Martin Kleppmann (Strange Loop 2023) Specific points to highlight: Automerge is a CRDT (conflict-free replicated data type) engine with a variety of API libraries available (including JS!). Of particular interest it the Peritext merge algorithm which is designed to handle issues specific to merging richtext/markup. I could see this being very useful for creating more elegant revisions for block content. Screen.Recording.2024-05-01.at.16.42.29.movAs an example using that technology, there's a prototype collaborative text editor called Upwelling, which is kind of like a combination of Google Docs and git. There's likely some design and technical inspiration there, particularly for asynchronous collaborative editing. |
For anyone following this work, I wanted to connect the dots to this discussion issue from @dmonad. Kevin is sponsored by Automattic to move this work forward and happens to be the author of Yjs! Two weeks ago he shared a lengthy update complete with video demos of some of what he's been working on. |
For anyone following this work, I wanted to note that there is now an in progress pull request to review as well as a recording of a call where this work was demoed and discussed. |
My work in the previous months focused on implementing a reliable sync mechanism of Yjs documents with the WordPress backend. Our constraint is that collaborative editing should be possible while allowing non-collaborative clients (i.e. WordPress plugins, or non-Gutenberg editors) to add changes that will be merged into the collaborative state. This is not what I wanted to implement initially. But several WordPress devs have made clear that a collaborative-editing extension needs to be fully compatible with existing WordPress plugins. That means that we need to keep two sources of truth in sync - the Yjs state and the state persisted in WordPress. You can follow the discussion that lead to this approach here. I recently made a PR that implements a reliable sync protocol and which makes the current experimental collaborative-editing experience much more reliable. This baseline implementation for collaborative editing only syncs using the existing REST Api in WordPress. Hence, the updates propagate quite slowly. That was to be expected, but the implementation works for everyone. Yjs enables us to mesh different communication protocols together to enable faster syncs between peers. Actually, we can even enable peer-to-peer collaboration. I showed that we can greatly improve the collaborative experience when adding y-webrtc or y-websocket. Realtime sync (via y-webrtc) can be enabled in the experiments page. It will work for all users who can directly communicate with each other (which is not always the case, as some clients can't establish a direct communication to each other). Users that want a Google-Docs-like realtime experience could set up one of the existing Yjs providers, or we could write a custom WebSocket server in PHP. We recently had demo session where several collaborators tested the approach. You can find a video recording in @annezazu's article: https://make.wordpress.org/core/2025/01/07/reliable-sync-protocol-pr-live-demo-discussion-for-collaborative-editing/ Now my contract is coming to an end. Big thanks to Automattic for sponsoring me to work on this! Milestone 2. Make the sync provider a priority (@gutenberg/sync)Compatibility with the It would be interesting to measure the performance overhead of enabling the sync package. I'm sure there is something we can do to optimize the Yjs-Gutenberg binding. Milestone 3. Use the Yjs Undo/Redo ManagerNow that the sync package is non-optional, we could rely on the Yjs UndoManager to support selective undo/redo (being able to pick which changes to undo, and which changes to keep). Having a selective UndoManager is important for collaborative applications, because we usually don't want to undo changes from other users when hitting Yjs efficiently tracks history. It ships with a selective Undo/Redo Manager - you can choose which changes to track, and which changes not to track. It is quite reliable and used by many collaborative editors. Even if Gutenberg decides to stay non-collaborative, it might make sense to use the Yjs undo-manager instead of building a custom one. You can find more information about this in Milestone 4. Render remote awareness state in GutenbergCollaborative applications often have "awareness" features that tell the user what other users are currently doing. In Google Docs, you can see remote selection states. A little icon above the selection state indicates who is currently working at that position. Awareness features help users to non-verbally coordinate in collaborative sessions. Simply showing who is currently working on which block would already go a long way. If Gutenberg had an API to render such awareness information, it would be quite easy to synchronize that using the Awareness information should not be part of the synced state. In the Yjs ecosystem, we maintain awareness state in a separate Awareness CRDT. Milestone 5. Evaluate the
|
This is the overview issue for the collaborative editing project as defined on this post.
The goals are multiple here:
Tasks:
The text was updated successfully, but these errors were encountered: