UndoRedoMethods
Undo/Redo methods returned from useGridUndoRedo.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
undo | () => UndoRedoAction | unknown | Undo the last edit action. |
redo | () => UndoRedoAction | unknown | Redo the last undone action. |
canUndo | () => boolean | Check if there are any actions that can be undone. |
canRedo | () => boolean | Check if there are any actions that can be redone. |
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. |
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