首页 > 解决方案 > CKEDITOR:如何使用 CKEDITOR4 在 typescript 中获取编辑器的实例

问题描述

如何处理 Typescript 中的 CKEDITOR 4 插件(应用程序是 Angular 9)?

我需要通过打字稿(自动增长)设置配置并尝试执行 INSERT HTML 函数。

我已经导入了模块(见下文)......但在属性中并不多。

从'ckeditor4-angular/ckeditor'导入{CKEditor4};

标签: angulartypescriptckeditoreditorinstance

解决方案


做这样的事情:

  1. 在html中添加#editor<ckeditor #editor formControlName="resumen" data="<p>Hello, world!</p>"></ckeditor>

  2. 在组件中添加这个@ViewChild('editor') editor;

  3. 现在您可以通过以下方式访问:

     console.log(this.editor);
    

推荐阅读