Processing a ProseMirror Transaction
The ProseMirror text editor library allows you to subscribe to changes in your document which are described by a list of
transactions. But how do you figure out what changed in your document given a list of transactions? The transactions give you the positions edited in the old and new document. If you compare the node at the position edited in the old document to the node at the position edited in the new document, you can see what was changed by the transaction.
Suppose you would like to know if a specific type of node was updated in the transaction so that you can update some decorations. First we need to calculate which portions of our document were edited. We can do that by traversing the list of transactions and collecting that information.
Now that we have the information about which parts of the old document and new document were affected by the list of transactions, we can evaluate whether a specific type of node was changed by the list of transactions.