Would it be possible to have something akin to an amendTransaction hook, that would run just after filterTransaction? It’s come up quite a few times that I want to update a plugin state as an alternative to running a transaction. A couple of examples might be blocking a cursor movement (but remembering that it was blocked in some state), or deleting some content (and keeping it in the document for changeset reasons).

Alternatively is there a way of achieving this at the moment that I’ve missed?



I guess we could have formulated filterTransaction as replaceTransaction instead, with the filter case just being a replacement with no transaction. If you want to start formulating an RFC on this (a replaceTransaction feature that can return an array of transactions, with filterTransaction reformulated to just be a backwards-compatibility shim on top of that) that might be interesting.


I’ve had a bit of a think about this and I’ve realised it’s tricky implement … I feel like the most sensible approach is to allow plugins to take it in turns to replace / filter a transaction. When one filters it then act as before, but when one replaces it then this should again be run against all the other plugins to see whether they would go further a this point. This perhaps is a touch like the ability for appendTransaction to bounce into an infinite loop but it seems to rely more heavily on ordering than previously.

I’m not sure I quite understand why it would return an array here too?

Whats an example of the minimal code required to undo a transformation?

I’ve done something like this outside of prosemirror before applying the new state

dispatchTransaction (tr) {
      if (this.interceptTransaction) tr = this.interceptTransaction(tr)
      if (!tr) return // leave unchanged
      this.editor.state = this.editor.state.apply(tr)

Socalled "Tracked changes" using ProseMirror

This sort of thing works ok at the editor level but you don’t have access to this at the plugin level and we’re looking to share the logic between a few editors.


yea the above pattern can definitely get messy too. I’d be ideal to contain the code in its own plugin.

when I was using vue.js the code was actually part of an editor package I used


I’ve created an RFC for replaceTransaction that aims to solve this use-case. See, I’d appreciate any feedback on it.