Fix JSONEditor bug with undefined value (#379)

This commit is contained in:
Steve Faulkner 2021-01-08 22:20:06 -06:00 committed by GitHub
parent a4a367a212
commit 19fa5e17a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,11 +59,13 @@ export class JsonEditorViewModel extends WaitsForTemplateViewModel {
this.params = params; this.params = params;
this.params.content.subscribe((newValue: string) => { this.params.content.subscribe((newValue: string) => {
if (newValue) {
if (!!this.editor) { if (!!this.editor) {
this.editor.getModel().setValue(newValue); this.editor.getModel().setValue(newValue);
} else { } else {
this.createEditor(newValue, this.configureEditor.bind(this)); this.createEditor(newValue, this.configureEditor.bind(this));
} }
}
}); });
const onObserve: MutationCallback = (mutations: MutationRecord[], observer: MutationObserver): void => { const onObserve: MutationCallback = (mutations: MutationRecord[], observer: MutationObserver): void => {