- 用户点击我的插件按钮。
- 弹出对话框,其中有一些文本框等。
- 在该对话框中,用户可以单击一个按钮,然后会弹出一个颜色选择器,让用户选择他想要的颜色。
最佳答案
今天我也遇到了同样的问题。这是我的解决方案,它实际上是 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)
}
}
]
},
...
]
}
],
};
});
关于javascript - 创建 CKEditor 插件时,如何将 "colorpicker"添加到我的对话框中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8813872/