Since we discussed going for a file based solution, we need to take care that file changes from outside are handled properly. If no one is currently editing a file in the collaborative editor this is not an issue, since once the first session is opened, we just read the current file and continue from that. But once there is a user editing, we have a base version and a list of changes on top of that managed by prosemirror. There is no way we can properly apply the changes in the original file (done when overwriting the file) to the collaborative editing. So we would either need to lock the file for the whole time any user is using the collaborative editor or have some conflict resolution. That would for example be to let the user choose if the file version or the current editing version should be used.
Just for reference, the current collaborative editing works the following way:
I don't feel comfortable with just locking the file for the whole time, this is why I thought once a collision happens, we could just ask the user which of the two versions we should keep. After that we would re-initiate all collaborative sessions to use the new file as base document.
Any input on that is welcome, maybe someone also has some different idea.
cc @rullzer
this is why I thought once a collision happens, we could just ask the user which of the two versions we should keep
I think this is the best way, as all of this is currently working and people are used to it.
So to keep collisions of edits outside to a minimum, this step 5 needs to happen often, right?
- Writing back the file needs to happen at some point (see #4 for that)
Cause yes, while asking people which version to keep is something that is commonly used, it鈥檚 still a horrible experience for people. It鈥檚 best to have few changes elsewhere and a good visualization of the actual differences to be able to decide (not only a thumbnail and timestamp).
Those are fine enough to have. This happens in a lot of places. Because we can't know what to do.
So to keep collisions of edits outside to a minimum, this step 5 needs to happen often, right?
Well not really, edits from outside will always be a problem, since regular text editors (on desktop) probably don't always reload the latest changes after the file got synced to the file system.
Cause yes, while asking people which version to keep is something that is commonly used, it鈥檚 still a horrible experience for people. It鈥檚 best to have few changes elsewhere and a good visualization of the actual differences to be able to decide (not only a thumbnail and timestamp).
We can show the two documents besides each other, so it is a bit easier to check which one you want to keep.
- Chose which version to keep
- Offer 'save current version as' option
Those are fine enough to have. This happens in a lot of places. Because we can't know what to do.
Ok, let's go this way then. I also found https://gitlab.com/mpapp-public/prosemirror-recreate-steps which might allow us to apply changes from the "outside-changed" document to the collaboratively edited one, but that is something requiring more work and we can still add later on top of the manual version picking.

Most helpful comment