Creates an instance of HistoryStack and attaches it to a diagram model that supports selection. The HistoryStack will use the model's serialization and selection capabilities to manage history states.
The diagram model to attach to the history stack.
Indicates whether there are any states in the undo stack that can be undone. Returns true if there is at least one state in the undo stack, false otherwise.
true if undo is possible, false otherwise.
Indicates whether there are any states in the redo stack that can be redone. Returns true if there is at least one state in the redo stack, false otherwise.
true if redo is possible, false otherwise.
Clears the history stacks for both undo and redo, effectively resetting the history of changes.
Adds the current state of the diagram to the undo stack. This should be called whenever a change is made to the diagram that should be undoable.
Undoes the last change made to the diagram by restoring the previous state from the undo stack. The current state is pushed onto the redo stack to allow for redo operations.
A promise that resolves to true if the undo operation was successful, false otherwise.
Redoes the last undone change by restoring the state from the redo stack. The current state is pushed onto the undo stack to allow for undo operations.
A promise that resolves to true if the redo operation was successful, false otherwise.
A class that manages the history of changes to a diagram, allowing for undo and redo functionality. It tracks the state of the diagram at various points in time and provides methods to restore previous states.