Can’t quite tell from the docs what is the recommended way to apply steps to the state and what the difference is from transactions. With transactions I can do state.apply(tr)
but with transforms, I have an array of steps that give me a new document. Intuitively, it seems like I should turn these steps into a transaction and apply to the state, but not seeing how to make the jump from step to transaction or how / if these are related.
1 Like
Figured it out by looking at linter demo. I think if Transform docs mentioned using view.dispatch to apply them at the top would have saved a bit of effort tracking down.
Calling view.dispatch
with a Transform object that is not a Transaction will not work at all, so that should certainly not be suggested by the docs. Transforms are the superclass of Transactions, but they know only about a document, and nothing else. Transactions extend them to cover the rest of the editor state.
In my code the name of the variable is “transform” but it is indeed a transaction object not a transform. Thanks for pointing out that it could not possible work the way I thought it was working. This code I’m working with makes a lot more sense now lol.