Collaborative Editing – maintain multiple EditorStates in the background

Hey folks,

I want to build an app that supports collaboratively editing a project consisting of multiple files, of which only one file is open at a time. Nevertheless, I want to receive updates from other users in the project when they edit files whose editor I don’t have open at the moment.

Thanks to the collaborative editing example, I was able to build a ViewPlugin that handles synchronization for the file in the foreground (for which I instantiated an EditorView and State). Now I’m asking myself how to receive updates for the background editors. With the collaboration logic in a view plugin, I thought of mounting a EditorView for each background document into a DocumentFragment.

However, initialising a view for each state seems wrong. Is there another good way to listen to server updates and dispatch transactions on naked EditorStates?

Thanks for your help!

There is nothing view-related in the @prosemirror/collab library, so it shouldn’t be terribly hard to factor your code so that you can use the syncing logic without having a view.