Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- tinymce.create('tinymce.plugins.my_shortcode_plugin', {
- init : function(ed, url) {
- ed.addCommand('my_shortcode_insert_shortcode', function() {
- selected = tinyMCE.activeEditor.selection.getContent();
- if ( selected ) {
- content = '[my_shortcode]'+ selected +'[/my_shortcode]';
- } else {
- content = '[my_shortcode][/my_shortcode]';
- }
- tinymce.execCommand('mceInsertContent', false, content);
- });
- ed.addButton('my_shortcode_button', {title : 'Insert my_shortcode', cmd : 'my_shortcode_insert_shortcode', image: url + '/assets/images/my_shortcode-icon.png', // onclick: function() {add popup window with color picker here?}});
- },
- });
- tinymce.PluginManager.add('my_shortcode_button', tinymce.plugins.my_shortcode_plugin);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement