[英]Use Existing Icon in Tiny MCE custom Button
could we use existing icon to custom button? 我们可以使用现有的图标自定义按钮吗? (not an image) (不是图像)
I have tried this, but it doesn't work: 我试过这个,但它不起作用:
tinymce.init({
...
toolbar: 'example'
setup: function(ed) {
ed.addButton('example', {
title: 'My title',
image: '../js/tinymce/plugins/example/img/example.gif',
classes: 'mce-ico mce-i-image',
onclick: function() {
ed.insertContent('Hello world!!');
}
});
}
});
Yes you can use an existing icon. 是的,您可以使用现有图标。
You can take the class name from an existing button - eg "mce-i-image" as you've done - then, rather than apply that to the class name of your new button, you strip off the "mce-i-" prefix and use the remainder - "image" in this case - as the icon key. 您可以从现有按钮中取出类名 - 例如“mce-i-image” - 然后,不是将其应用于新按钮的类名,而是剥离“mce-i-”前缀并使用余数 - 在这种情况下为“image” - 作为图标键。
I've amended your example below. 我在下面修改了你的例子。
eg 例如
setup: function(ed) {
ed.addButton('example', {
title: 'My title',
icon: 'image', // This line sets the icon key.
onclick: function() {
ed.insertContent('Hello world!!');
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.