Skip to content

Instantly share code, notes, and snippets.

@ahmedeshaan
Last active August 29, 2015 14:19
Show Gist options
  • Save ahmedeshaan/8732e215b4b0b640db0d to your computer and use it in GitHub Desktop.
Save ahmedeshaan/8732e215b4b0b640db0d to your computer and use it in GitHub Desktop.
(function() {
tinymce.PluginManager.add('tx_tinymce_button', function( editor, url ) {
editor.addButton( 'tx_tinymce_button', {
title: 'My test button',
icon: 'icon dashicons-wordpress-alt',
onclick: function() {
editor.windowManager.open( {
title: 'Insert Your Shortcode',
body: [
{
type: 'listbox',
name: 'listboxName',
label: 'List Box',
'values': [
{text: 'Option 1', value: '1'},
{text: 'Option 2', value: '2'},
{text: 'Option 3', value: '3'}
]
}
],
onsubmit: function( e ) {
editor.insertContent( '[random_shortcode listbox="' + e.data.listboxName + '"]');
}
});
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment