first commit
This commit is contained in:
30
wp-content/plugins/widget-shortcode/assets/tinymce.js
Normal file
30
wp-content/plugins/widget-shortcode/assets/tinymce.js
Normal file
@@ -0,0 +1,30 @@
|
||||
(function($) {
|
||||
if ( typeof widgetShortcodeTinyMCE === 'undefined' )
|
||||
return;
|
||||
|
||||
if ( widgetShortcodeTinyMCE.widgets.length < 1 )
|
||||
return;
|
||||
|
||||
tinymce.PluginManager.add( 'widgetShortcode', function( editor, url ) {
|
||||
var items = [];
|
||||
$.each( widgetShortcodeTinyMCE.widgets, function( i, v ) {
|
||||
var item = {
|
||||
'text' : v.label,
|
||||
'body': {
|
||||
'type': v.label
|
||||
},
|
||||
'onclick' : function(){
|
||||
editor.insertContent( '[widget id="' + v.value + '"]' );
|
||||
}
|
||||
};
|
||||
items.push( item );
|
||||
} );
|
||||
|
||||
editor.addButton( 'widgetShortcode', {
|
||||
title: widgetShortcodeTinyMCE.title,
|
||||
type : 'menubutton',
|
||||
image : widgetShortcodeTinyMCE.image,
|
||||
menu : items
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user