CKEditor:是否可以限制 TextColor 和 BGColor 的颜色选择?
CKEditor: Is it possible to limit the color choices for TextColor and BGColor?
我实际上正在使用 django-ckeditor,但是在问了这个与它直接相关的问题之后,有人建议我在 CKEditor 文档(我还没有找到)或 CKEditor 论坛中查找它。
我想做的是将 TextColor 和 BGColor 的颜色选择限制为白色、黑色、黄色、绿色、蓝色、红色、青色和品红色,并删除按钮以 select 更多颜色.一旦我知道如何去做,我确定颜色 selection 是无关紧要的,但我只是为了特殊性而添加它。
这在 CKEditor 中可行吗?
是的,这很容易做到:
在你的settings.py
中,你有
CKEDITOR_CONFIGS = {
'default':{
toolbar': 'default',
'colorButton_colors': '008000,454545,FFF', #to set specific colors
'colorButton_enableMore': False, # to remove more color button
},
注意这两行是你需要添加的。
'colorButton_colors': '008000,454545,FFF', #to set specific colors
'colorButton_enableMore': False, # to remove more color button
广泛使用django-ckeditor is based on ckeditor4. If you want to modify default behavior, you search for ckeditor 4 doc.
例如,您对文字和背景颜色感兴趣,您google搜索 ckeditor4 text background color
,doc about text color将显示在您的搜索结果中。你看到了:
# this is a javascript code, you need to convert to python code.
config.colorButton_colors = 'CF5D4E,454545,FFF,DDD,CCEAEE,66AB16';
#change to :
'colorButton_colors': 'CF5D4E,454545,FFF,DDD,CCEAEE,66AB16',
#and put into CKEDITOR_CONFIGS in settings.py
我实际上正在使用 django-ckeditor,但是在问了这个与它直接相关的问题之后,有人建议我在 CKEditor 文档(我还没有找到)或 CKEditor 论坛中查找它。
我想做的是将 TextColor 和 BGColor 的颜色选择限制为白色、黑色、黄色、绿色、蓝色、红色、青色和品红色,并删除按钮以 select 更多颜色.一旦我知道如何去做,我确定颜色 selection 是无关紧要的,但我只是为了特殊性而添加它。
这在 CKEditor 中可行吗?
是的,这很容易做到:
在你的settings.py
中,你有
CKEDITOR_CONFIGS = {
'default':{
toolbar': 'default',
'colorButton_colors': '008000,454545,FFF', #to set specific colors
'colorButton_enableMore': False, # to remove more color button
},
注意这两行是你需要添加的。
'colorButton_colors': '008000,454545,FFF', #to set specific colors
'colorButton_enableMore': False, # to remove more color button
广泛使用django-ckeditor is based on ckeditor4. If you want to modify default behavior, you search for ckeditor 4 doc.
例如,您对文字和背景颜色感兴趣,您google搜索 ckeditor4 text background color
,doc about text color将显示在您的搜索结果中。你看到了:
# this is a javascript code, you need to convert to python code.
config.colorButton_colors = 'CF5D4E,454545,FFF,DDD,CCEAEE,66AB16';
#change to :
'colorButton_colors': 'CF5D4E,454545,FFF,DDD,CCEAEE,66AB16',
#and put into CKEDITOR_CONFIGS in settings.py