如何在CKEditor中创建没有图标的按钮

Mic*_*der 5 button ckeditor

当我CKEditor 3.0使用以下代码创建工具栏按钮时,我需要取消注释图标属性以使按钮可见.否则占用空间但不显示标签.当我将鼠标悬停在它上面时,我会看到标题弹出.

        editor.ui.addButton('customButton', {
            label: 'Custom Action',
            //icon: this.path + 'images/anchor.gif',
            command: commandName
        });
Run Code Online (Sandbox Code Playgroud)

你知道如何创建没有图标的工具栏按钮吗?只是一个纯文本.

Ner*_*cer 7

更简单的方法是CKEditor在自定义标签上创建一个自动调用的CSS类:cke_button_ <command>

例如,如果您对该按钮的命令被称为"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>
Run Code Online (Sandbox Code Playgroud)

因此(假设您正在使用'kama'皮肤 - 如果没有替换你的皮肤),您可以使用以下CSS来覆盖cke_label ==> display:none

.cke_skin_kama .cke_button_myCommand .cke_label {
    display: inline;
}
Run Code Online (Sandbox Code Playgroud)

瞧.