Commit 4718eac882e9b6bfa9b56ef24bdfa5d1ac38723d

Authored by Igor Kulikov
1 parent 096b2944

Improve json content component

@@ -92,6 +92,15 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid @@ -92,6 +92,15 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid
92 this.validateContentValue = coerceBooleanProperty(value); 92 this.validateContentValue = coerceBooleanProperty(value);
93 } 93 }
94 94
  95 + private validateOnChangeValue: boolean;
  96 + get validateOnChange(): boolean {
  97 + return this.validateOnChangeValue;
  98 + }
  99 + @Input()
  100 + set validateOnChange(value: boolean) {
  101 + this.validateOnChangeValue = coerceBooleanProperty(value);
  102 + }
  103 +
95 fullscreen = false; 104 fullscreen = false;
96 105
97 contentBody: string; 106 contentBody: string;
@@ -256,7 +265,7 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid @@ -256,7 +265,7 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid
256 const editorValue = this.jsonEditor.getValue(); 265 const editorValue = this.jsonEditor.getValue();
257 if (this.contentBody !== editorValue) { 266 if (this.contentBody !== editorValue) {
258 this.contentBody = editorValue; 267 this.contentBody = editorValue;
259 - this.contentValid = true; 268 + this.contentValid = !this.validateOnChange || this.doValidate();
260 this.propagateChange(this.contentBody); 269 this.propagateChange(this.contentBody);
261 } 270 }
262 } 271 }