Collaborative Editing is a Really Difficult Challenge in WordPress
Here at PublishPress, we’re focused on the publishing experience in WordPress. And there’s interesting news on the horizon for WordPress publishers.
Matt Mullenweg and the WordPress team want to bring Google Docs-style editing to the new Gutenberg editor. This means that multiple people can be updating the same document at the same time.
This image gives a good idea of what we’re walking about with multiple people collaborating on the same document:
At the moment, this kind of collaboration isn’t possible with WordPress. If you try to edit a post at the same time as another user, you’ll see the message, “This post is already being edited.” You can either leave the post, or force the other person to stop editing.
I’m going to give you an overview of this collaborative editing project and when we may see it in WordPress. Will we ever be able have teams of people working together on the same WordPress post?
First, as collaborative editing will be part of Gutenberg, let’s check in on the current state of the new editor …
The Current State of Gutenberg
Last week at WordCamp US in St Louis, Matt Mullenweg gave his annual “State of the Word” address.
Matt described the current progress on Gutenberg. You can see the complete presentation here, with the Gutenberg portion starting just after the 1 hour mark. This image below from Matt shows where we are now with Gutenberg:
“Create a block pattern directory” means you’ll be able to search and install new blocks, directly from the post editing screen. If you search for a block that you don’t have, you’ll see the message: “No blocks found in your library. These blocks can be downloaded and installed.” There will be an “Add” button which will install the new block without you needing to reload your page.
“Implement full-site editing” is a much bigger project. This involves changing the whole of the WordPress theming system so it relies on blocks.
- Your site logo? That will be an image block.
- Your menu? That will be a navigation block.
- Your homepage layout? That could be a grid block.
These theme features will take months or perhaps years to develop. Google Docs-style editing will only arrive after these features are finished.
Stage 3 in the Gutenberg Project
Gutenberg is being developed in four stages. Stage 2 is “Customization” and will be complete when “Implement full-site editing” is done.
Stage 3 is “Collaboration” and here’s Matt’s description from the State of the Word:
[This] is where we take everything that you see in Gutenberg and make it so that you can real-time co-edit with anyone else who is editing the same things you are.
Matt has talked frequently about wanting Google Docs-style collaborative editing in WordPress and this is just another confirmation.
Bringing collaborative editing to WordPress
It turns out that collaborative editing for platforms like WordPress is a very cool feature but an incredibly difficult technical challenge.
Collaborative editing is much easier for Google because they have almost complete control over the servers. They only have to worry about different browsers.
The team at CKEditor took 4 years to solve it for their platform and wrote a great overview of the many challenges. They realized they couldn’t provide collaborative editing without also creating a SaaS platform to make it work.
The WordPress team are in a similar situation to the CKEditor team. They need to find a solution that runs on almost any server.
One option was to use WebSockets, which are like a more modern version of Ajax. Both WebSockets and Ajax can update content on your screen without refreshing the whole page. Here’s how Mozilla describes WebSockets:
The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user’s browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.
The problem is that low-budget hosting companies may not be able to run WebSockets. Here’s a quote from one Github discussion:
Collaborative editing in WordPress has been on our minds for a while. What we’ve been lacking is a way to support this on self-hosted sites, without the need for a ‘centralised’ service, whilst retaining compatibility with hosts who may not have the ability to dedicate long-running processes that lends itself to most collaborative editing techniques.
This “centralised service” is the solution that the CKEditor team needed and in the end, WordPress may need it to. Rather than build such a service, the WordPress team considered scaling down their ambitions:
The original plan was to go full-on Google Docs style collaboration … We then took a step back, and thought … how about just using traditional locking, similar to the current WordPress editor, but per block. We decided this should be enough granularity for now, and will get us to a proof of concept a lot faster. If this proof-of-concept is feasible, we can of course implement “full” collaborative editing at a later date.
Under this fallback plan, multiple people could edit a post at the same time, but only person could be editing each block. If you tried to edit a block at the same time as another user, you might see a message like this:
However, a new approach has recently emerged. This solution uses few server resources, although it will still need some kind of centralized service. This video gives you an idea of how this collaborative editing will work:
This approach is still in the very, very early stages. The WordPress team haven’t chosen the underlying technology and there a lot of hurdles still to face.
If there is good news, it involves comments. Take a look back at the GIF at the top of this post and you’ll see “Ryan” and “Sarah” commenting in the sidebar. The PublishPress plugin does have an editorial comments feature now. But it’s possible that more dynamic Google Docs-style comments are added during Gutenberg Stage 3. There is an experimental Annotations API that could be used to integrate comments with collaborative editing.
Collaborative editing summary
Matt and the WordPress team really want to add Google Docs-style editing to WordPress. This would be an awesome feature, but realistically it’s also a very tough challenge.
In terms of timeframe, I don’t expect Phase 2 of Gutenberg (“Customization”) to be complete before the end of 2020.
So that means that Phase 3 of Gutenberg (“Collaboration”) won’t be the main focus until 2021. Given that schedule, and the steep technical challenges, it’s almost certain that collaborative editing will not arrive in WordPress until 2021 at the earliest.
As can be seen by the Yjs Demo a good enough result is usable today. The server is just passing messages. We already implemented comments ala Gdocs for another client and they can be easily shared via Yjs as well. And then the work will start that you can collaboratively work on a paragraph. P2P is always difficult, but WP can act like a STUN Server to allow serverless distributed editing. In case that’s not possible a relay can always be used and Yjs is optimized … for small message sizes already. After that all is working you can start to use the track changes feature of Yjs to get a distributed view of what everyone has been doing on the document.
So perhaps we won’t be waiting too long. Fabian also pointed me to this discussion on collaborative editing solutions: