Last active
August 29, 2015 14:19
-
-
Save ahmedeshaan/8732e215b4b0b640db0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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