From 4718eac882e9b6bfa9b56ef24bdfa5d1ac38723d Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 14 May 2020 17:21:14 +0300 Subject: [PATCH] Improve json content component --- .../app/shared/components/json-content.component.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/json-content.component.ts b/ui-ngx/src/app/shared/components/json-content.component.ts index e957a40d5c..242b4b6359 100644 --- a/ui-ngx/src/app/shared/components/json-content.component.ts +++ b/ui-ngx/src/app/shared/components/json-content.component.ts @@ -92,6 +92,15 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid this.validateContentValue = coerceBooleanProperty(value); } + private validateOnChangeValue: boolean; + get validateOnChange(): boolean { + return this.validateOnChangeValue; + } + @Input() + set validateOnChange(value: boolean) { + this.validateOnChangeValue = coerceBooleanProperty(value); + } + fullscreen = false; contentBody: string; @@ -256,7 +265,7 @@ export class JsonContentComponent implements OnInit, ControlValueAccessor, Valid const editorValue = this.jsonEditor.getValue(); if (this.contentBody !== editorValue) { this.contentBody = editorValue; - this.contentValid = true; + this.contentValid = !this.validateOnChange || this.doValidate(); this.propagateChange(this.contentBody); } }