Fix #892: the undo/redo buttons in mode `code` being broken when custom loading an old version of Ace Editor

This commit is contained in:
jos 2020-02-06 21:41:41 +01:00
parent 11b8a04ff3
commit 5e467ad968
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,12 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## 2020-02-06, version 8.5.3
- Fix #892: the undo/redo buttons in mode `code` being broken when custom
loading an old version of Ace Editor.
## 2020-02-05, version 8.5.2 ## 2020-02-05, version 8.5.2
- Fix undo/redo buttons in mode `code` not always updating. - Fix undo/redo buttons in mode `code` not always updating.

View File

@ -428,8 +428,10 @@ textmode._updateHistoryButtons = function () {
if (this.aceEditor && this.dom.undo && this.dom.redo) { if (this.aceEditor && this.dom.undo && this.dom.redo) {
const undoManager = this.aceEditor.getSession().getUndoManager() const undoManager = this.aceEditor.getSession().getUndoManager()
this.dom.undo.disabled = !undoManager.canUndo() if (undoManager && undoManager.hasUndo && undoManager.hasRedo) {
this.dom.redo.disabled = !undoManager.canRedo() this.dom.undo.disabled = !undoManager.hasUndo()
this.dom.redo.disabled = !undoManager.hasRedo()
}
} }
} }