Live tracking / Track changes

Hi together,

we have an implementation with QuillJS and ShareDB for a collaborative editor (based on OT). Now we are searching for a solution that supports a track changes functionality (which is not really working with OT) and we luckily found Yjs (in combo with Prosemirror) which seems to be able to do this :slight_smile: In the first place we only want to assign a user id to the text a user has written, formatted or deleted (which should then be colored or colored and stroked). Accepting/rejecting changes either removes the user id and makes the text therefore neutral or removes the text. Versioning is not a necessary feature at the moment.

The prosemirror-versions example (https://demos.yjs.dev/prosemirror-versions/prosemirror-versions.html) seems already to be very close to what we search for. But when activating the “Live Tracking” checkbox, the user can’t edit any text anymore (which is a bit strange since “live” suggests that the tracking should work live?). We played a bit around with the ySyncPlugin to solve this, but did not find a simple solution so far. Before we dig deeper, I just wanted to ask if there is maybe a simpler solution which we have overseen? Or is it even a bug? Or is it just a complicated problem and we need to go deeper?

Thanks and regards
Carlo

Hi @carlo,

The “live-tracking” feature tracks any changes live other users are editing. In the versioning demo, we are interested in the differences to the last version. This is achieved by walking through Yjs’ CRDT model and transforming it into a ProseMirror document (while reading deleted changes as if they were still part of the document). It is currently not supported to edit while tracking deletions because we need to account for position changes.

The versioning approach really is just about tracking and rendering the differences between versions. For a google-docs-like “suggestion feature” you don’t need the versioning approach. I would implement “suggestions” using decorations and relative positions. Deletions and Insertions would be represented differently:

Deletions

Deletions would simply be ProseMirror-decorations on the document. You would basically mark a range as “suggested to delete” and use ProseMirrors decoration approach to highlight them in a specific color. You could easily allow a dialog that allows you to render the associated user and a button to accept the change. Quill has a similar concept that would allow you to do this.

Insertions

Insertions would be attributed changes to the document. For an added paragraph/text-node you would assign it an attribute that associated it to the user that created it. You could maintain suggested changes even in a separate Yjs document to handle permissions more strictly.

That said, implementing this feature is definitely possible in ShareDB as well by performing OT transformations. The OT approach is not foolproof either. This is just a really complicated feature. Unfortunately, there are no Open-Source solutions for this yet.

I would love to create a suggestions-feature for Quill or ProseMirror in exchange for funding. This is how I finance the Yjs project. Let me know if this is something that you & your company are interested in.

Hi @dmonad,

thanks a lot for your detailed reply! :slight_smile: Unfortunately we are no company, but a small group of 3 people developing an open source software in our free time (https://github.com/openevocracy/openevocracy). But that has also an advantage since we do not depend on any external goals, can freely choose our programming focus and can be open source with everything.

I think the information from you gives us a good starting point. About a year ago I was investing some time and tried solving this with Quill and ShareDB and came quite far, but I had problems with hierarchic (html) structures at some point. As far as I understood, OT was originally developed for linear structures (like plain text). What I read about the (proprietary) OT-implementation from the CKeditor developer team, it seems that “upgrading” OT to fully support html is a heavy problem (which we probably cannnot solve with our small group and very limited time). But when I understood this correctly, CRDT should be able to do this and my hope is that we “only” need to do similar things I did before with OT. Using the suggestions from you as a rough roadmap and my earlier experiences from Quill/ShareDB may bring us to a solution.

As soon as we have something usable, we will directly share it here in the forum to keep you and the community updated. This here seems to be a nice place :wink:

Carlo

Decentralized communities (OpenEvocracy) are definitely welcome here as well! :slight_smile:

The real value of Yjs & CRDTs is that you can build decentralized applications (no central server required). Another nice side-effect - and you are right about that - is that Yjs natively supports structured documents. If you are just interested in solving the suggestion feature, then the OT solution might be easier to understand. Still, I want to encourage you to try out the described approach above. As the author of ShareDB said, CRDTs are the future https://josephg.com/blog/crdts-are-the-future/

Looking forward to your update!

In Stackoverflow I have just written a post about my current state of knowledge about track changes. Just wanted to backlink it here for people who are also interested in this topic:

https://stackoverflow.com/a/65288202/2692283

@dmonad If you have a second, it would be great if you could read the post and just do a quick fact-check :wink:

Thanks for putting this together and sharing what you learned @carlo!

I would say that you are actually looking for a “suggestions” approach. Track-changes usually refers to something like an editing-history. Something you can use to compare different time-stamped versions with each other. In GDocs you have a linear history of changes that you could describe as track changes. Yjs & y-prosemirror are able to track-changes using the versioning approach (https://demos.yjs.dev/prosemirror-versions/prosemirror-versions.html) that can be used to implement something very similar to Google Docs’ Track Changes.

“Suggestions” is another feature of GDocs that allows you to suggest text-changes. This is what you described.

Of course, there is no strict definition of what these terms mean. But Google was the first company that implemented them like this.

Yes, I think your right. But my experience is that most people call it “track changes”. In addition suggestions can be confusing, since there exist prosemirror suggestions plugins, which are a totally different thing. It’s not so easy to find the correct wording in this young field. Anyway, I also think now that suggestions is the more precise term and I updated my Stackoverflow post in a away that both names are covered. At some point one probably has to start the right way :slight_smile:

1 Like