Detect block changes to manage blocks as separate data in backend

Hi, I’m looking for an editor library that we can use for our product and ProseMirror is our number one choice at the moment. But there are a few things I’m struggling to get through and would like to ask for help from anyone who’s more familiar with the library.

Background

  • We are using Firestore (which is a NoSQL Database) to store data
  • Every first-level block of content(direct children of “doc”) should be stored as a single data(precisely, document in Firestore). So if the editor has two paragraphs, each paragraph is saved as two different data.

Question

  • Is there a good way to detect ;
    • when a new block content is added
    • when an existing block content is updated
    • when an existing block content is deleted

I have been trying and see if giving the block id as an attribute and getting the parent of the node from the resolved position of step “from” “to” position, but I’m not sure if this is a good way as I get RangeError every now and then.

It would be great if any of you guys have ever handled a similar situation. I love the concept of the library so really hope we can use it.

1 Like