Button 如何在CKEditor中创建没有图标的按钮
当我在Button 如何在CKEditor中创建没有图标的按钮,button,ckeditor,Button,Ckeditor,当我在CKEditor 3.0中使用以下代码创建工具栏按钮时,我需要取消对icon属性的注释以使按钮可见。否则会占用空间,但不会显示标签。当我把鼠标悬停在它上面时,就会弹出标题 editor.ui.addButton('customButton', { label: 'Custom Action', //icon: this.path + 'images/anchor.gif', command: comma
CKEditor 3.0
中使用以下代码创建工具栏按钮时,我需要取消对icon属性的注释以使按钮可见。否则会占用空间,但不会显示标签。当我把鼠标悬停在它上面时,就会弹出标题
editor.ui.addButton('customButton', {
label: 'Custom Action',
//icon: this.path + 'images/anchor.gif',
command: commandName
});
你知道如何创建没有图标的工具栏按钮吗?纯文本。我就是这样做的。按钮如下所示:
<span class="cke_button">
<a id="cke_..." class="cke_off cke_button_cmd" ...>
<span class="cke_icon"/>
<span class="cke_label">Label</span>
</a>
</span>
更简单的方法是,CKEditor在自定义标签上创建一个CSS类,该类自动称为: cke_按钮_ 例如,如果按钮的命令名为“myCommand”,并且您设置了“label:“My command”,则CK将呈现如下内容:
<a id="cke_27" class="cke_off cke_button_myCommand" ....>
...
<span id="cke_27_label" class="cke_label">My Command</span>
</a>
瞧。我不得不用这个!出于某种原因,这很重要。。。(可能是因为cke的更新版本?)
<style type="text/css">
.cke_skin_kama .cke_button_CMDNAMEHERE span.cke_icon{display:none !important;}
.cke_skin_kama .cke_button_CMDNAMEHERE span.cke_label{display:inline;}
</style>
/* "Source" button label */
.cke_skin_kama .cke_button_source .cke_label
{
display: inline;
}
<a id="cke_27" class="cke_off cke_button_myCommand" ....>
...
<span id="cke_27_label" class="cke_label">My Command</span>
</a>
.cke_skin_kama .cke_button_myCommand .cke_label {
display: inline;
}