【问题标题】:Adding icons to TinyMCE custom menu将图标添加到 TinyMCE 自定义菜单
【发布时间】:2013-09-17 02:56:58
【问题描述】:

我正在修改一个在 WP 中添加自定义 TinyMCE 菜单的插件。我需要能够向下拉菜单项和子菜单项添加图标。我启用了图标,在 HTML 中为它们添加了空间,但无法弄清楚 JS 将它们放入。

createControl:function(d,e){if(d=="ss_button"){d=e.createMenuButton("ss_button",{title:"SS Shortcodes",image:"../wp-content/plugins/ss-shorts/js/images/shortcodes.png",icons:true});var a=this;

d.onRenderMenu.add(function(c,b){
b.addSeparator();c=b.addMenu({image:"../wp-content/plugins/ss-shorts/js/images/uparrow.png",title:" Arrows"});
a.addImmediate(c,"Right Arrow","[rightarrow]");
a.addImmediate(c,"Left Arrow","[leftarrow]");
a.addImmediate(c,"Up Arrow","[uparrow]");
a.addImmediate(c,"Down Arrow","[downarrow]");
b.addSeparator();

添加图片:在菜单项标题之前或之后不起作用,“图标:”也不起作用。 Icons 最初在第一部分被设置为 false up。我将其设置为 true ,这为图标腾出了空间。只是不知道如何让他们进去。

【问题讨论】:

    标签: javascript wordpress tinymce


    【解决方案1】:

    我意识到我可以使用菜单项类将图标添加为背景图像。不优雅,但实用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-24
      • 1970-01-01
      • 2020-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-15
      相关资源
      最近更新 更多