我正在修改一个在 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 ,这为图标腾出了空间。只是想不通如何让他们进去。