答案 0 :(得分:2)
今天我遇到了同样的问题。这是我的解决方案,实际上是来自CKEditor 4.2的TableCell插件的复制粘贴。希望它有所帮助
CKEDITOR.dialog.add( 'myDialog', function( editor ) {
return {
title: 'Add Data',
minWidth: 300,
minHeight: 200,
contents: [
{
id: 'dataTab',
label: 'Line',
title: 'Line',
elements: [
...
{
type: "hbox",
padding: 0,
widths: ["80%", "20%"],
children: [
{
id: 'linecolor',
type: 'text',
label: 'Line color',
setup: function( element ) {
...
},
commit: function( element ) {
...
}
},
{
type: "button",
id: "lineColorChooser",
"class": "colorChooser",
label: "Choose",
style: "margin-left: 8px",
onLoad: function () {
this.getElement().getParent().setStyle("vertical-align", "bottom")
},
onClick: function () {
editor.getColorFromDialog(function (color) {
color && this.getDialog().getContentElement("dataTab", "linecolor").setValue( color );
this.focus()
}, this)
}
}
]
},
...
]
}
],
};
});
答案 1 :(得分:0)
使用以下颜色选择器插件;已附加到您的CKEditor input[type="text"]
中的form
字段:
此实现的不同之处在于用户无需click
按钮来选择颜色。当用户focus
进入相应的字段时,将触发颜色选择。