woocommerce/assets/js/admin/editor_plugin.js

60 lines
2.2 KiB
JavaScript
Raw Normal View History

(
function(){
tinymce.create(
"tinymce.plugins.WooCommerceShortcodes",
{
init: function(d,e) {},
createControl:function(d,e)
{
var ed = tinymce.activeEditor;
if(d=="woocommerce_shortcodes_button"){
d=e.createMenuButton( "woocommerce_shortcodes_button",{
title: ed.getLang('woocommerce.insert'),
icons: false
});
var a=this;d.onRenderMenu.add(function(c,b){
a.addImmediate(b, ed.getLang('woocommerce.order_tracking'),"[woocommerce_order_tracking]" );
a.addImmediate(b, ed.getLang('woocommerce.price_button'), '[add_to_cart id="" sku=""]');
a.addImmediate(b, ed.getLang('woocommerce.product_by_sku'), '[product id="" sku=""]');
a.addImmediate(b, ed.getLang('woocommerce.products_by_sku'), '[products ids="" skus=""]');
a.addImmediate(b, ed.getLang('woocommerce.product_categories'), '[product_categories number=""]');
a.addImmediate(b, ed.getLang('woocommerce.products_by_cat_slug'), '[product_category category="" per_page="12" columns="4" orderby="date" order="desc"]');
b.addSeparator();
a.addImmediate(b, ed.getLang('woocommerce.recent_products'), '[recent_products per_page="12" columns="4" orderby="date" order="desc"]');
a.addImmediate(b, ed.getLang('woocommerce.featured_products'), '[featured_products per_page="12" columns="4" orderby="date" order="desc"]');
b.addSeparator();
a.addImmediate(b, ed.getLang('woocommerce.shop_messages'), '[woocommerce_messages]');
2012-03-12 10:51:53 +00:00
b.addSeparator();
c=b.addMenu({title:ed.getLang('woocommerce.pages')});
2013-10-23 08:47:36 +00:00
a.addImmediate(c, ed.getLang('woocommerce.cart'),"[woocommerce_cart]" );
a.addImmediate(c, ed.getLang('woocommerce.checkout'),"[woocommerce_checkout]" );
a.addImmediate(c, ed.getLang('woocommerce.my_account'),"[woocommerce_my_account]" );
});
return d
} // End IF Statement
return null
},
addImmediate:function(d,e,a){d.add({title:e,onclick:function(){tinyMCE.activeEditor.execCommand( "mceInsertContent",false,a)}})}
}
);
tinymce.PluginManager.add( "WooCommerceShortcodes", tinymce.plugins.WooCommerceShortcodes);
}
)();