【问题标题】:How to use online build CKEditor in angular?如何在 Angular 中使用在线构建 CKEditor?
【发布时间】:2020-06-27 05:26:36
【问题描述】:

我想将 ckeditor 嵌入到材质选项卡中。 我想让编辑器支持字体颜色功能, 所以我从以下链接在线构建ckeditor:

https://ckeditor.com/ckeditor-5/online-builder/

然后通过以下命令为 Angular 安装 CKEditor 5 WYSIWYG 编辑器组件:

npm install --save @ckeditor/ckeditor5-angular  

按照下面web page中的说明,我把ckeditor.js和对应的翻译文件复制到src目录下,导入到组件文件中;然后修改tsconfig.json。

但是,编辑器不显示。

如何配置编辑器使其支持字体颜色功能?

这里是stackBlitz

【问题讨论】:

    标签: angular ckeditor5


    【解决方案1】:

    根据ckeditor5 document你需要按照这个步骤:-

    1. 你需要安装npm install --save @ckeditor/ckeditor5-angular && npm install --save @ckeditor/ckeditor5-build-classic作为CKeditor依赖。

    2. 在主应用程序模块中导入 CKeditor 模块 import { CKEditorModule } from '@ckeditor/ckeditor5-angular';。 && 在imports 中添加CKEditorModule

      @NgModule({ 进口:[ CKEditor模块 ] })

    3. 在 app.component 中添加依赖,例如 import ClassicEditor from '@ckeditor/ckeditor5-build-classic';

    4. 像这样在应用组件中添加public Editor = ClassicEditor;

      导出类 AppComponent { 公共编辑器 = 经典编辑器; }

    5. 添加.html文件,如<ckeditor [editor]="Editor" data="<p>Hello, world!</p>"></ckeditor>

    希望这对你有帮助:-)

    工作示例CKEditor example

    【讨论】:

    • 我按照您的指示让 ckeditor 在 stackblitz 环境中显示。但是,如何配置编辑器使其支持字体颜色功能?
    • 好的,你需要按照CKEditor官方文档进行操作。ckeditor.com/docs/ckeditor5/latest/features/font.html
    • 这些不是与在线构建器集成的说明
    • @DhairyTripathi,这些不是说明/解决方案,请提供解决方案。如果您提供解决方案,我会更高兴。谢谢。兄弟为你输入:-)
    猜你喜欢
    • 1970-01-01
    • 2017-03-16
    • 1970-01-01
    • 2020-10-06
    • 1970-01-01
    • 2022-09-23
    • 2015-04-10
    • 1970-01-01
    • 2019-07-31
    相关资源
    最近更新 更多