I'm trying to dynamically set the content to the TinyMCE editor, based on the selected option from the drop down menu.
<app-tinymce [elementId]="'myEditor'" [content]="myContentVar"></app-tinymce>
The variable myContentVar
gets updated correctly every time the drop down menu selection is changed.
onSelectionChanged(selectedValue: string){
this.myContentVar = selectedValue;
}
But still, the TinyMCE editor always shows blank. {{myContentVar}}
does show the correct value though.
Below is the configuration setup for TinyMCE.
tinymce.init({
selector: '#' + this.elementId,
plugins: ['link image code charmap preview anchor'],
toolbar: 'undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent',
setup: editor => {
this.editor = editor;
editor.on('change', () => {
const content = editor.getContent();
this.editorContent = content;
this.onEditorContentChange.emit(content);
this.onModelChange(content);
this.onTouch(content);
if (this._controlContainer) {
if (this.formControlName) {
this.control = this._controlContainer.control.get(this.formControlName);
if (this.control) {
this.control.setValue(new RichFieldTextModel(this.formControlName, this.elementId, this.editorContent));
}
}
}
});
}
});