Skip to content

Commit

Permalink
Fix #1311: exception being thrown under certain conditions when switc…
Browse files Browse the repository at this point in the history
…hing from `code` mode to `preview` mode
  • Loading branch information
josdejong committed May 10, 2021
1 parent 672b685 commit b012be6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Expand Up @@ -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.
Expand Down
12 changes: 10 additions & 2 deletions src/js/textmode.js
Expand Up @@ -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()
Expand Down Expand Up @@ -800,7 +804,11 @@ textmode._setText = function (jsonText, clearHistory) {
})
}

setTimeout(() => this._updateHistoryButtons())
setTimeout(() => {
if (this._updateHistoryButtons) {
this._updateHistoryButtons()
}
})
}

// validate JSON schema
Expand Down

0 comments on commit b012be6

Please sign in to comment.