如何在CKEditor中创建没有图标的按钮
当我使用以下代码在 CKEditor 3.0 中创建工具栏按钮时,我需要取消注释图标属性以使按钮可见。否则空间被占用但不显示标签。当我将鼠标悬停在它上面时,标题就会弹出。
editor.ui.addButton('customButton', {
label: 'Custom Action',
//icon: this.path + 'images/anchor.gif',
command: commandName
});
你知道如何创建没有图标的工具栏按钮吗?只是纯粹的文字。
When I create toolbar button in CKEditor 3.0
with following code I need to uncomment icon property to get button visible. Otherwise space is occupied but no label is shown. When I hover over it I get caption popping up.
editor.ui.addButton('customButton', {
label: 'Custom Action',
//icon: this.path + 'images/anchor.gif',
command: commandName
});
Do you know how to create toolbar button without icon? Just a pure text.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种更简单的方法是 CKEditor 在您的自定义标签上自动创建一个 CSS 类,调用:
cke_button_<命令>;
例如,如果您的按钮命令名为“myCommand”,并且您设置“标签:“我的命令”,那么 CK 将呈现类似以下内容:
因此(假设您使用的是“kama”皮肤 - 如果满足以下条件,请替换您的皮肤)不),您可以使用以下 CSS 来覆盖 cke_label ==>显示:无
瞧。
An easier way is that CKEditor creates a CSS class on your custom label automatically called:
cke_button_<command>
For example, if your command for the button was called 'myCommand', and you set 'label: 'My Command', then CK would render something like:
Therefore (assuming you are using the 'kama' skin - substitute for your skin if not), you can use the following CSS to override the cke_label ==> display:none
Voila.
我就是这样做的。按钮如下所示:
.cke_label 默认样式为“display:none”。这正是我们想要的:
所以选择器有点棘手,用编辑器将其放入页面上的样式标签中:
ckeditor 作者应用了 css 来获取源按钮上的标签(presets.css):
This is how I did it. A button looks like this:
.cke_label is styled "display:none" by default. This would do exactly what we want:
So the selectors are a bit tricky, put this in the Style Tag on the page with the editor:
The ckeditor authors applied css to get the label on the source button (presets.css):