var lists={ title:"List Group Shortcode", id :'oscitas-form-lists', pluginName: 'lists' }; (function() { _create_tinyMCE_options(lists); })(); function create_oscitas_lists(pluginObj){ if(jQuery(pluginObj.hashId).length){ jQuery(pluginObj.hashId).remove(); } // creates a form to be displayed everytime the button is clicked // you should achieve this using AJAX instead of direct html code like this var form = jQuery('
\ \ \ \ \ \ \ \ \ \ \ \ \

\

Enter a numeric value\

\
\

\ \

\
'); var table = form.find('table'); form.appendTo('body').hide(); // handles the click event of the submit button form.find('#oscitas-submit').click(function(){ // defines the options and their default values // again, this is not the most elegant way to do this // but well, this gets the job done nonetheless var options = { 'type' : 'arrow' },list=0,list_type; var cusclass=''; if(table.find('#oscitas-list-class').val()!=''){ cusclass= ' class="'+table.find('#oscitas-list-class').val()+'"'; } var shortcode = '[list'+cusclass; var list_item=jQuery('#oscitas-list-item').val(); if(isNaN(list_item)==false){ list=list_item; } else{ list=3; } shortcode += ']
'; if(table.find('#oscitas-type').val()!=''){ list_type=' type="'+table.find('#oscitas-type').val()+'"'; } else{ list_type=''; } for(var i=1;i<=list;i++){ shortcode +='[li'+list_type+']your list content[/li]
' } shortcode +='[/list]'; // inserts the shortcode into the active editor tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode); close_dialogue(pluginObj.hashId); }); }