-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Improve collaborative editing in sync package
#72040
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
Improve collaborative editing in sync package
#72040
Conversation
…n a template for UUID-based awareness features to work
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
This draft pull request extends and improves the collaborative editing experiment to provide:
core-datapackage retains control over which entity records are synced and how changes are merged.SyncProviderclass. This allows plugins to provide their own sync transports and to implement user-facing sync behaviors such as awareness / presence indicators.It is open now for discussion and guidance while we continue to improve it (see "How?" section).
Why?
This work builds on the pull request opened by @dmonad earlier this year. Our immediate goal is to provide a production-ready implementation of collaborative editing for WPVIP customers using a WebSocket transport.
Gutenberg's
syncpackage must be flexible enough to support a future "default" sync transport that ships with Gutenberg, while also allowing plugins to provide their own transport. Additionally, while collaborative editing is still under development, it must also provide ways for plugins to implement missing features such as awareness / presence indicators and CRDT persistence.Lastly, Gutenberg's
core-datapackage must provide stable and performant merge algorithms so that entity records are synced in a way that aligns with user expectations.How?
This pull request is large in service of providing a complete implementation for review. However, the commits are atomic by feature and can be reviewed one-by-one. If desired, we can split this PR up into smaller ones, with the understanding that the branches may not be in a fully functional state.
core-datastore with a "database" Yjs provider (IndexedDB), this change makes syncing a side-effect without changing how the entity records are represented and treated within the store. (Kevin's PR took the same approach.)syncpackage to be imported by plugins and other external code.SyncProviderto accept "handlers" fromcore-dataactions and resolvers that allow it to safely interact with the store.core.getSyncProviderfilter to allow plugins to extend theSyncProviderclass and provide custom sync transports.export { something } from './file').Additional props to @alecgeatches, @ingeniumed, and @pkevan for their contributions to this branch.
Testing Instructions
This PR can be tested in two ways:
admin-ajax.phpfor signaling and the initial connection is delayed.gutenberg.npm installnpm run devto start the development environment, including WebSocket server. See additional details and instructions, if needed.Testing Instructions for Keyboard
No UI changes in this pull request.
Screenshots or screencast
WebSocket provider with awareness / presence indicators (WPVIP plugin)
plugin2.mov