最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ckeditor 4 standard with text colour - Stack Overflow

programmeradmin1浏览0评论

I have installed ckeditor standard and want to have text colour and background colour. I installed the colordialog and panelbutton plugins an am using the following code, any ideas?

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For plete reference see:
    // !/api/CKEDITOR.config

    // The toolbar groups arrangement, optimized for two toolbar rows.
    config.toolbar = [
    [ 'SpecialChar', 'Bold', 'Italic', 'Strike', 'Underline',{ name: 'colors', items: [ 'TextColor', 'BGColor' ] }]
];

    config.removePlugins = 'elementspath';
config.resize_enabled = false;

    config.extraPlugins = 'colordialog';



};

I have installed ckeditor standard and want to have text colour and background colour. I installed the colordialog and panelbutton plugins an am using the following code, any ideas?

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For plete reference see:
    // http://docs.ckeditor./#!/api/CKEDITOR.config

    // The toolbar groups arrangement, optimized for two toolbar rows.
    config.toolbar = [
    [ 'SpecialChar', 'Bold', 'Italic', 'Strike', 'Underline',{ name: 'colors', items: [ 'TextColor', 'BGColor' ] }]
];

    config.removePlugins = 'elementspath';
config.resize_enabled = false;

    config.extraPlugins = 'colordialog';



};
Share Improve this question asked Sep 1, 2014 at 19:01 JakeJake 3,4867 gold badges41 silver badges60 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

For CKEditor4 - if you are using the full package and not trying to add the color plugin to the basic or standard packages, then the toolbar name is 'TextColor'. And background color is 'BGColor'

config.toolbar = [['TextColor', 'BGColor']]

You need the colorbutton plugin, not the colordialog. Actually, you can use both, because color dialog extends color button. Color button gives you the buttons to set foreground and background colors and color dialog adds a button inside basic color picker that let's you choose from more colors. See the Setting Text and Background Color sample for a live demo and code to copy.

I also remend to use the online builder, so you don't have to resolve dependencies manually. Read more about installing plugins.

发布评论

评论列表(0)

  1. 暂无评论