Check if current node is in transaction?

I’m looking to prevent deletion of a node. From other threads I can see that filterTransaction is the best way to achieve this. However, I can’t see how to check if the current node is within the transaction. How do I check this?

The easiest way is to, for each step map in transaction.mapping.maps, run .forEach to get the ranges that it replaced, and check transaction.docs[i] (where i is the map’s index) to see if the replaced range corresponds to any node you’re interested in (via doc.nodesBetween, say).

1 Like

Works perfectly. Thank you so much!