mirror of
https://github.com/yjs/yjs.git
synced 2025-12-29 00:25:01 +01:00
Add canUndo/canRedo to UndoManager. Fixes #365
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user