[英]Use Existing Icon in Tiny MCE custom Button
我們可以使用現有的圖標自定義按鈕嗎? (不是圖像)
我試過這個,但它不起作用:
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!!');
}
});
}
});
是的,您可以使用現有圖標。
您可以從現有按鈕中取出類名 - 例如“mce-i-image” - 然后,不是將其應用於新按鈕的類名,而是剝離“mce-i-”前綴並使用余數 - 在這種情況下為“image” - 作為圖標鍵。
我在下面修改了你的例子。
例如
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.