Merge pull request #366 from holtwick/main

Add canUndo/canRedo to UndoManager. Fixes #365
This commit is contained in:
Kevin Jahns 2022-02-03 21:21:33 +01:00 committed by GitHub
commit f577a8e3cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}
}