|
|
@ -125,7 +125,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe |
|
|
jsonSettingsEditor: ace.Ace.Editor; |
|
|
jsonSettingsEditor: ace.Ace.Editor; |
|
|
dataKeyJsonSettingsEditor: ace.Ace.Editor; |
|
|
dataKeyJsonSettingsEditor: ace.Ace.Editor; |
|
|
jsEditor: ace.Ace.Editor; |
|
|
jsEditor: ace.Ace.Editor; |
|
|
aceResizeObservers: ResizeObserver[] = []; |
|
|
aceResize$: ResizeObserver; |
|
|
|
|
|
|
|
|
onWindowMessageListener = this.onWindowMessage.bind(this); |
|
|
onWindowMessageListener = this.onWindowMessage.bind(this); |
|
|
|
|
|
|
|
|
@ -194,9 +194,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe |
|
|
|
|
|
|
|
|
ngOnDestroy(): void { |
|
|
ngOnDestroy(): void { |
|
|
this.window.removeEventListener('message', this.onWindowMessageListener); |
|
|
this.window.removeEventListener('message', this.onWindowMessageListener); |
|
|
this.aceResizeObservers.forEach((resize$) => { |
|
|
this.aceResize$.disconnect(); |
|
|
resize$.disconnect(); |
|
|
|
|
|
}); |
|
|
|
|
|
this.rxSubscriptions.forEach((subscription) => { |
|
|
this.rxSubscriptions.forEach((subscription) => { |
|
|
subscription.unsubscribe(); |
|
|
subscription.unsubscribe(); |
|
|
}); |
|
|
}); |
|
|
@ -272,6 +270,12 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private initAceEditors() { |
|
|
private initAceEditors() { |
|
|
|
|
|
this.aceResize$ = new ResizeObserver((enteris) => { |
|
|
|
|
|
enteris.forEach((entry) => { |
|
|
|
|
|
const editor = this.aceEditors.find(aceEditor => aceEditor.container === entry.target); |
|
|
|
|
|
this.onAceEditorResize(editor); |
|
|
|
|
|
}) |
|
|
|
|
|
}); |
|
|
this.htmlEditor = this.createAceEditor(this.htmlInputElmRef, 'html'); |
|
|
this.htmlEditor = this.createAceEditor(this.htmlInputElmRef, 'html'); |
|
|
this.htmlEditor.on('input', () => { |
|
|
this.htmlEditor.on('input', () => { |
|
|
const editorValue = this.htmlEditor.getValue(); |
|
|
const editorValue = this.htmlEditor.getValue(); |
|
|
@ -342,12 +346,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe |
|
|
const aceEditor = ace.edit(editorElement, editorOptions); |
|
|
const aceEditor = ace.edit(editorElement, editorOptions); |
|
|
aceEditor.session.setUseWrapMode(true); |
|
|
aceEditor.session.setUseWrapMode(true); |
|
|
this.aceEditors.push(aceEditor); |
|
|
this.aceEditors.push(aceEditor); |
|
|
|
|
|
this.aceResize$.observe(editorElement); |
|
|
const resize$ = new ResizeObserver(() => { |
|
|
|
|
|
this.onAceEditorResize(aceEditor); |
|
|
|
|
|
}); |
|
|
|
|
|
resize$.observe(editorElement); |
|
|
|
|
|
this.aceResizeObservers.push(resize$); |
|
|
|
|
|
return aceEditor; |
|
|
return aceEditor; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|