diff --git a/HISTORY.md b/HISTORY.md index 0023f02c7..99bfbf769 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,12 @@ https://github.com/josdejong/jsoneditor +## not yet published, version 9.4.2 + +- Fix #1311: exception being thrown under certain conditions when switching + from `code` mode to `preview` mode. + + ## 2021-04-25, version 9.4.1 - Improvements in the Korean translation. Thanks @luasenvy. diff --git a/src/js/textmode.js b/src/js/textmode.js index f5f6f600e..ceabe7fc4 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -412,7 +412,11 @@ textmode._onChange = function () { } // enable/disable undo/redo buttons - setTimeout(() => this._updateHistoryButtons()) + setTimeout(() => { + if (this._updateHistoryButtons) { + this._updateHistoryButtons() + } + }) // validate JSON schema (if configured) this._debouncedValidate() @@ -800,7 +804,11 @@ textmode._setText = function (jsonText, clearHistory) { }) } - setTimeout(() => this._updateHistoryButtons()) + setTimeout(() => { + if (this._updateHistoryButtons) { + this._updateHistoryButtons() + } + }) } // validate JSON schema