当使用TinyMCE的setContent函数时,我收到此错误:TypeError:无法读取未定义的属性'parse'
这是我的代码如下:
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);
}
我的猜测是你正在使用TinyMCE的常规版本(纯JS)。问题是它在Angular的世界之外,并且Angular不知道它在这里,所以它不能很好地工作。