mirror of https://github.com/hashicorp/consul
Guard against setting on destroyed object
parent
838a8a9745
commit
4882490c6f
|
@ -36,22 +36,24 @@ export default Component.extend({
|
|||
}
|
||||
},
|
||||
setMode: function (mode) {
|
||||
let options = {
|
||||
...DEFAULTS,
|
||||
mode: mode.mime,
|
||||
readOnly: this.readonly,
|
||||
};
|
||||
if (mode.name === 'XML') {
|
||||
options.htmlMode = mode.htmlMode;
|
||||
options.matchClosing = mode.matchClosing;
|
||||
options.alignCDATA = mode.alignCDATA;
|
||||
}
|
||||
set(this, 'options', options);
|
||||
if (!this.isDestroying && !this.isDestroyed) {
|
||||
let options = {
|
||||
...DEFAULTS,
|
||||
mode: mode.mime,
|
||||
readOnly: this.readonly,
|
||||
};
|
||||
if (mode.name === 'XML') {
|
||||
options.htmlMode = mode.htmlMode;
|
||||
options.matchClosing = mode.matchClosing;
|
||||
options.alignCDATA = mode.alignCDATA;
|
||||
}
|
||||
set(this, 'options', options);
|
||||
|
||||
const editor = this.editor;
|
||||
editor.setOption('mode', mode.mime);
|
||||
this.helper.lint(editor, mode.mode);
|
||||
set(this, 'mode', mode);
|
||||
const editor = this.editor;
|
||||
editor.setOption('mode', mode.mime);
|
||||
this.helper.lint(editor, mode.mode);
|
||||
set(this, 'mode', mode);
|
||||
}
|
||||
},
|
||||
willDestroyElement: function () {
|
||||
this._super(...arguments);
|
||||
|
|
Loading…
Reference in New Issue