Reputation: 23
when using the setContent function of TinyMCE I get this error: TypeError: Can not read property 'parse' of undefined
Here is my code below:
component.ts:
ngAfterViewInit() {
tinymce.init({
selector: 'textarea',
plugins: ['link', 'image'],
language: this.translation.translate('filiais.empresa.idioma-editor'),
height: 500,
setup: editor => {
this.editor = editor;
editor.on('keyup', () => {
const content = editor.getContent();
this.onEditorKeyup.emit(content);
})
}
});
}
private preencherEmpresa(empresa) {
this.empresa = new Empresa(
empresa.empre_codigo, empresa.empre_nome,
empresa.empre_cnpj, empresa.empre_endereco,
empresa.empre_termos, empresa.empre_bundle,
empresa.empre_cdn
);
this.editor.setContent(empresa.empre_termos);
}
Upvotes: 1
Views: 3610
Reputation: 26400
My guess is that you're using the regular version (pure JS) of TinyMCE. The problem is that it's outside Angular's world, and Angular has no idea it's here, so it can't work well.
You need to integrate it with Angular
Upvotes: 1