It is usually preferable (because cheaper and more predictable) to use the data from the steps that were applied to the document to figure out which parts changed.
However, when that’s not enough, you can narrow the changes down to a single range with findDiffStart
and findDiffEnd
methods.
If you want a proper, minimal diff, you’ll have to run an actual diffing algorithm. There’s an implementation in prosemirror-changeset, but that one has some hard-coded quirks (such as ignoring attribute values) that might not be appropriate to your use case. It shouldn’t be all too hard to fork it and adjust it to do what you need.