将范围更改为字体ckeditor颜色按钮

时间:2015-03-28 16:25:55

标签: ckeditor

Ckeditor在编辑器

中更改颜色后向元素添加<span></span>标记

我需要将代码更改为<font></font>

我查看了ckeditor.js中的代码,但没有找到任何关于颜色的信息

1 个答案:

答案 0 :(得分:0)

要将span切换到字体,请在ckeditor config.js文件中添加这两行。

  config.colorButton_backStyle.element = 'font';
  config.colorButton_foreStyle.element = 'font';

现在,您可以通过它manual完成更多工作。

这是我的ckeditor config.js,有两行:

CKEDITOR.editorConfig = function (config) {
  config.toolbarGroups = [
    {name: 'document', groups: ['mode', 'document', 'doctools']},
    {name: 'clipboard', groups: ['clipboard', 'undo']},
    {name: 'editing', groups: ['find', 'selection', 'spellchecker']},
    {name: 'forms'},
    {name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
    {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'bidi']},
    {name: 'align'},
    '/',
    {name: 'links'},
    {name: 'insert'},
    {name: 'styles'},
    {name: 'colors'},
    {name: 'tools'},
    {name: 'others'}
  ];

  config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Subscript,Superscript';
  config.removeDialogTabs = 'link:advanced';
  config.extraPlugins = 'font,justify,keyword,colorbutton,dropoff,colordialog';
  config.skin = 'heisenberg';
  config.language = 'pt-br';
  config.disallowedContent = "img,script,style";
  config.colorButton_enableMore = true;

  // it change span tag to font tag, mental note, plugin must already been loaded.
  config.colorButton_backStyle.element = 'font';
  config.colorButton_foreStyle.element = 'font';
};
相关问题