Add canUndo/canRedo to UndoManager. Fixes #365

This commit is contained in:
Dirk Holtwick 2021-12-18 18:26:32 +01:00
parent 645f05b0bb
commit f857345451

View File

@ -282,4 +282,22 @@ export class UndoManager extends Observable {
}
return res
}
/**
* Are undo steps available?
*
* @return {boolean} `true` if undo is possible
*/
canUndo() {
return this.undoStack.length > 0
}
/**
* Are redo steps available?
*
* @return {boolean} `true` if redo is possible
*/
canRedo() {
return this.redoStack.length > 0
}
}