|
|
|
@ -24,7 +24,8 @@ export class IFrameEditorComponent implements ControlValueAccessor, AfterViewIni |
|
|
|
private windowMessageListener: Function; |
|
|
|
private callChange = (v: any) => { /* NOOP */ }; |
|
|
|
private callTouched = () => { /* NOOP */ }; |
|
|
|
private value: string; |
|
|
|
private value: any; |
|
|
|
private valueJson: string; |
|
|
|
private isDisabled = false; |
|
|
|
private isInitialized = false; |
|
|
|
private plugin: HTMLIFrameElement; |
|
|
|
@ -69,7 +70,10 @@ export class IFrameEditorComponent implements ControlValueAccessor, AfterViewIni |
|
|
|
} else if (type === 'valueChanged') { |
|
|
|
const { value } = event.data; |
|
|
|
|
|
|
|
if (this.value !== value) { |
|
|
|
const valueJson = JSON.stringify(value); |
|
|
|
|
|
|
|
if (this.valueJson !== valueJson) { |
|
|
|
this.valueJson = valueJson; |
|
|
|
this.value = value; |
|
|
|
|
|
|
|
this.callChange(value); |
|
|
|
@ -85,8 +89,9 @@ export class IFrameEditorComponent implements ControlValueAccessor, AfterViewIni |
|
|
|
return this.sanitizer.bypassSecurityTrustResourceUrl(this.url); |
|
|
|
} |
|
|
|
|
|
|
|
public writeValue(value: string) { |
|
|
|
public writeValue(value: any) { |
|
|
|
this.value = value; |
|
|
|
this.valueJson = JSON.stringify(value); |
|
|
|
|
|
|
|
if (this.isInitialized && this.plugin.contentWindow) { |
|
|
|
this.plugin.contentWindow.postMessage({ type: 'valueChanged', value: this.value }, '*'); |
|
|
|
|