Fix #781: race condition when destroying the editor right after setting data
This commit is contained in:
parent
a78adf6676
commit
671cad86fb
|
@ -3,6 +3,11 @@
|
|||
https://github.com/josdejong/jsoneditor
|
||||
|
||||
|
||||
## not yet published, version 7.0.2
|
||||
|
||||
- Fix #781: race condition when destroying the editor right after setting data.
|
||||
|
||||
|
||||
## 2019-09-01, version 7.0.1
|
||||
|
||||
- Fix npm package missing `dist` folder.
|
||||
|
|
|
@ -711,18 +711,18 @@ textmode._setText = function (jsonText, clearHistory) {
|
|||
if (this.aceEditor) {
|
||||
// prevent emitting onChange events while setting new text
|
||||
this.onChangeDisabled = true
|
||||
|
||||
this.aceEditor.setValue(text, -1)
|
||||
this.onChangeDisabled = false
|
||||
|
||||
if (clearHistory) {
|
||||
// prevent initial undo action clearing the initial contents
|
||||
const me = this
|
||||
setTimeout(() => {
|
||||
me.aceEditor.session.getUndoManager().reset()
|
||||
if (me.aceEditor) {
|
||||
me.aceEditor.session.getUndoManager().reset()
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
|
||||
this.onChangeDisabled = false
|
||||
}
|
||||
// validate JSON schema
|
||||
this._debouncedValidate()
|
||||
|
|
Loading…
Reference in New Issue