Showing
1 changed file
with
10 additions
and
1 deletions
@@ -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 | } |