【问题标题】:Use Existing Icon in Tiny MCE custom Button在 Tinymce 自定义按钮中使用现有图标
【发布时间】:2014-01-03 23:11:10
【问题描述】:

我们可以使用现有的图标来自定义按钮吗? (不是图片)

这个我试过了,还是不行:

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!!');
         }
      });
   }
});

【问题讨论】:

    标签: javascript css tinymce


    【解决方案1】:

    是的,您可以使用现有图标。

    您可以从现有按钮中获取类名 - 例如“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!!');
        }
      });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 2017-11-01
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多