Non-imperative undo/redo?

Until I explored “Example: Undoable Effects,” where undo/redo is implemented by creating a transaction with inverse operations, such that producing an old history requires generating a new one, I had assumed that EditorView maintains a linked list of all historical EditorStates. Due to the immutability of EditorState, undo/redo operations involve moving a cursor along the list to the target EditorState, while the history length remains constant.

It it possible to implement such history navigator by an extension?

Yes, that should be possible. But it wouldn’t be able to support changes that aren’t added to the undo history (which make collaborative editing setups really awkward).

The current history implementation also is also based on immutable data structures, by the way.

1 Like

That is fantastic! I’m working on a complete read-only reader, and if all ViewPlugins are destroy free, I believe transitioning between states should be as smooth as possible.

Cheers.