Managing data for a realtime rich text editor

I’m wondering if anyone in the community has ever implemented a realtime rich text editor with Parse?

We’re using React in our frontend and thinking about Drafts.js or Quill as the rich text editor.

My first thought was to store each document as a single JSON object but that leaves the problem of multiple users overwriting each other’s work. Quill has a feature called Deltas which describe the operations to transform an empty document into the end state. So I also thought about storing each delta as a row, grouped by a pointer to a parent object, which can be sorted by date.

Among my issues is that I find LiveQuery can be a bit temperamental. And I’m not sure what happens if two users on the same document get a mismatch of operational transforms.

All of this is really complicated. There’s an entire library to manage backends for this called ShareDB and it’s pretty complex. I’m wondering if there’s a good way to integrate ShareDB with Parse?

I’m hoping someone out there has had experience with this and could lend a guiding hand!

I’ve never tried to use Parse Server for something like you need but I’d say that it is not the best use-case for Parse. I’d go with a custom backend for this need since it is very specific.

My issue is that this is a small part of a larger application that’s already built with Parse. Among the things that Parse manages is access controls for teams and I would hate to have to implement all of Parse’s ACL and CLP just so I can add one feature.

That’s why I was considering integrating ShareDB. My initial thoughts were to store references to IDs in ShareDB and manage access to the other DB instances via cloud code. That way the ShareDB instance isn’t exposed publicly and all the access controls are handled by Parse. But then ShareDB enables collaborative editing through websockets and I’m not sure how I would manage all of that together with Parse.

Now I’m thinking that it might be OK to store Quill Deltas as individual rows in the database. That way I can hand off a lot of work to the client side. Though I am a bit worried at how many rows this will have… but perhaps with the right Indexes it won’t be too bad.

For anyone else that’s interested in this, we’re also considering ProseMirror. They have an interesting article on how their library manages collaborative editing here: https://marijnhaverbeke.nl/blog/collaborative-editing.html

I think their approach might be better suited to Parse. In ProseMirror it’s up to the client-side to determine how to integrate their changes into the document. The end result of the document is stored along with a version number and the client-side library decides what changes to make based on whether or not it is editing the latest version number.