fix bug Json edit dialog: add validate

This commit is contained in:
nickAS21 2020-07-08 11:55:47 +03:00
parent 10b9e9c98e
commit 82668c9da2

View File

@ -194,7 +194,7 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va
} }
beautifyJSON() { beautifyJSON() {
if (this.jsonEditor) { if (this.jsonEditor && this.objectValid) {
const res = JSON.stringify(this.modelValue, null, 2); const res = JSON.stringify(this.modelValue, null, 2);
this.jsonEditor.setValue(res ? res : '', -1); this.jsonEditor.setValue(res ? res : '', -1);
this.updateView(); this.updateView();
@ -202,7 +202,7 @@ export class JsonObjectEditComponent implements OnInit, ControlValueAccessor, Va
} }
minifyJSON() { minifyJSON() {
if (this.jsonEditor) { if (this.jsonEditor && this.objectValid) {
const res = JSON.stringify(this.modelValue); const res = JSON.stringify(this.modelValue);
this.jsonEditor.setValue(res ? res : '', -1); this.jsonEditor.setValue(res ? res : '', -1);
this.updateView(); this.updateView();