CKEditor: Different color palettes for Text Color and Background Color possible?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 13:57:12

问题


I am using CKEditor (v3.6.4) and try to find out how to change the palettes for Text Color and Background Color separately.

I found config.colorButton_colors in the docs which allows me to define the color palette. However, this palette is assigned to both, text and background.

How can I have two different palettes?


回答1:


You can't do that because the color palette is defined for the text color and background.

CKEDITOR.config.colorButton_colors =
'000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' +
'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' +
'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' +
'FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,' +
'FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';

Or you can change the Text Color plugin :)




回答2:


The best and easy way is, Include required plugin at the download time or link below

Ckeditor Builder




回答3:


Yes its actually possible. Just dont pick colors from the config but rather do the following in colorbutton/plugin.js:

        var textColors = '1ABC9C,2ECC71,3498DB,9B59B6,4E5F70,F1C40F,' +
                        '16A085,27AE60,2980B9,8E44AD,2C3E50,F39C12,' +
                        'E67E22,E74C3C,ECF0F1,95A5A6,DDD,FFF,' +
                        'D35400,C0392B,BDC3C7,7F8C8D,999,000';

        var backgroundColors = 'cee8fe,b1d7ff,c7d3f3,dfd6eb,e4cafe,ffbbff,ffbfd2,ff9999,ffdeb3,ffefb0,f4f98a,ffffbb,d3f1a1,bbffbb,bbffff,a6e3dc,c1ebc7,eddec9,f2ebd3,d3eaf2,e1eff3,ffbe61,ffdc61,e1f29d';


        var colors = (type == 'back') ? backgroundColors.split(',') : textColors.split(',');


来源:https://stackoverflow.com/questions/16361173/ckeditor-different-color-palettes-for-text-color-and-background-color-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!