如何为Ckeditor5添加Font Awesome支持?

时间:2019-08-27 15:44:09

标签: ckeditor5

我正在尝试为Ckeditor5-inline添加Font Awesome支持,当我进入“编辑”模式时,它只是从HTML中删除了“ i”标签。

1 个答案:

答案 0 :(得分:0)

如果还没有下载的话,先下载很棒的字体

 1. Extract the downloaded file (fontawesome.zip) Copy the "fontawesome"
 2. folder to "ckeditor/plugins/" folder Open the file
 3. "ckeditor/config.js"

像这样配置并清除您的browser's cache

config.extraPlugins = 'fontawesome';
config.contentsCss = 'path/to/your/font-awesome.css';
config.allowedContent = true; 
  

在您的HTML部分中,添加以下代码:

<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>

之后,您可以像这样在工具栏中使用toolbargroupname: "FontAwesome"

config.toolbar = [
    { name: 'insert', items: [ 'FontAwesome', 'Source' ] }
];

如您所言,您正在Django CMS中使用Django Integration

Django CMS允许使用CKEditor将基于文本的内容添加到站点,该内容通过称为djangocms_text_ckeditor的模块进行集成。该模块中有一个静态文件夹和settings.py文件,它们的设置方式可以完全自定义CKEditor

you can check here for Django Integration