Adding icons to TinyMCE custom menu
我正在修改一个在WP中添加自定义TinyMCE菜单的插件。 我需要能够将图标添加到下拉菜单项和子菜单项。 我启用了图标,这些图标在HTML中为其添加了空间,但无法弄清楚JS可以将它们放入其中。
1 2 3 4 5 6 7 8 9 | 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(); |
在菜单项标题之前或之后添加图像:无效," icon:"也无效。 图标最初在第一部分中设置为false。 我将其设置为true,这为图标留出了空间。 只是无法弄清楚如何让他们进入那里。
我意识到我可以使用菜单项类将图标添加为背景图像。 不雅,但实用。