Ckeditor 用字体图标替换编辑器工具栏图像

Ckeditor 用字体图标替换编辑器工具栏图像,ckeditor,font-awesome,Ckeditor,Font Awesome,有没有什么方法可以将默认的工具栏图像(如粗体、斜体等)替换为字体很棒的图标?最好的方法是你可以在CKEditor上使用引导主题,或者你可以使用编辑器,它内置了图像上传器我知道这是一个老问题,但是在一个插件一个插件的基础上,我已经能够通过插件的init函数中的以下代码向ckeditor按钮添加令人敬畏的字体图标。在我的例子中,我的插件被称为trim: //Set the button name and fontawesome icon var button_name = 'trim'; var i

有没有什么方法可以将默认的工具栏图像(如粗体、斜体等)替换为字体很棒的图标?

最好的方法是你可以在CKEditor上使用引导主题,或者你可以使用编辑器,它内置了图像上传器

我知道这是一个老问题,但是在一个插件一个插件的基础上,我已经能够通过插件的
init
函数中的以下代码向ckeditor按钮添加令人敬畏的字体图标。在我的例子中,我的插件被称为
trim

//Set the button name and fontawesome icon
var button_name = 'trim';
var icon = 'fa-scissors';

//When a ckeditor with this plugin in it is created, find the button
//in the current instance and add the fontawesome icon
CKEDITOR.on("instanceReady", function(event) {
  var this_instance = document.getElementById(event.editor.id + '_toolbox');
  var this_button = this_instance.querySelector('.cke_button__' + button_name + '_icon');
  if(typeof this_button != 'undefined') {
    this_button.innerHTML = '<i class="fa ' + icon + '" style="font: normal normal normal 14px/1 FontAwesome !important;"></i>';
  }
});
//设置按钮名称和图标
变量按钮名称='trim';
变量图标=‘fa剪刀’;
//创建包含此插件的ckeditor时,找到按钮
//在当前实例中,添加fontawesome图标
CKEDITOR.on(“InstanceRady”,函数(事件){
var this_instance=document.getElementById(event.editor.id+“_工具箱”);
var this_button=this_instance.querySelector('.cke_button_uuu'+button_name+''u icon');
如果(此按钮的类型!=“未定义”){
此_button.innerHTML='';
}
});

它取决于知道按钮内跨度的类别,因此它可能不是最方便的,但它可以工作。

它不是要上载图像,而是要用很棒的图标替换工具栏图标。