UndoRedoMethods
Undo/Redo methods returned from injectGridUndoRedo.
Uses lazy discovery - the grid is found on first method call, not during initialization.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
undo | () => UndoRedoAction | unknown | Undo the last edit action. |
redo | () => UndoRedoAction | unknown | Redo the last undone action. |
canUndo | Signal<boolean> | Reactive signal indicating whether undo is available. Updates automatically when edits are made, undone, redone, or history is cleared. |
canRedo | Signal<boolean> | Reactive signal indicating whether redo is available. Updates automatically when edits are made, undone, redone, or history is cleared. |
clearHistory | () => void | Clear all undo/redo history. |
getUndoStack | () => UndoRedoAction[] | Get a copy of the current undo stack. |
getRedoStack | () => UndoRedoAction[] | Get a copy of the current redo stack. |
recordEdit | (rowIndex: number, field: string, oldValue: unknown, newValue: unknown) => void | Manually record an edit action. If a transaction is active, the action is buffered; otherwise it’s pushed to the undo stack. |
beginTransaction | () => void | Begin a transaction. All edits recorded until endTransaction() are grouped into a single compound action for undo/redo. |
endTransaction | () => void | End the active transaction and push the compound action to the undo stack. If only one edit was recorded, it’s pushed as a plain EditAction. If no edits were recorded, the transaction is discarded. |
isReady | Signal<boolean> | Signal indicating if grid is ready. |
Property Details
Section titled “Property Details”canUndo
Section titled “canUndo”// In template:// <button [disabled]="!undoRedo.canUndo()">Undo</button>
// In computed:readonly undoAvailable = computed(() => this.undoRedo.canUndo());canRedo
Section titled “canRedo”// In template:// <button [disabled]="!undoRedo.canRedo()">Redo</button>
// In computed:readonly redoAvailable = computed(() => this.undoRedo.canRedo());
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt