| 1 |
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins |
| 2 |
|
| 3 |
(function() { |
| 4 |
// Load plugin specific language pack |
| 5 |
tinymce.PluginManager.requireLangPack('post_snippets'); |
| 6 |
|
| 7 |
tinymce.create('tinymce.plugins.post_snippets', { |
| 8 |
/** |
| 9 |
* Initializes the plugin, this will be executed after the plugin has been created. |
| 10 |
* This call is done before the editor instance has finished it's initialization so use the onInit event |
| 11 |
* of the editor instance to intercept that event. |
| 12 |
* |
| 13 |
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. |
| 14 |
* @param {string} url Absolute URL to where the plugin is located. |
| 15 |
*/ |
| 16 |
init : function(ed, url) { |
| 17 |
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); |
| 18 |
|
| 19 |
ed.addCommand('mcepost_snippets', function() { |
| 20 |
muppCanv = ed; |
| 21 |
caller = 'visual'; |
| 22 |
jQuery( "#post-snippets-dialog" ).dialog( "open" ); |
| 23 |
/* ed.windowManager.open({ |
| 24 |
file : url + '/window.php', |
| 25 |
width : 360 + ed.getLang('post_snippets.delta_width', 0), |
| 26 |
height : 210 + ed.getLang('post_snippets.delta_height', 0), |
| 27 |
inline : 1 |
| 28 |
}, { |
| 29 |
plugin_url : url // Plugin absolute URL |
| 30 |
}); |
| 31 |
*/ }); |
| 32 |
|
| 33 |
// Register example button |
| 34 |
ed.addButton('post_snippets', { |
| 35 |
title : 'post_snippets.desc', |
| 36 |
cmd : 'mcepost_snippets', |
| 37 |
image : url + '/post-snippets.gif' |
| 38 |
}); |
| 39 |
}, |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns information about the plugin as a name/value array. |
| 43 |
* The current keys are longname, author, authorurl, infourl and version. |
| 44 |
* |
| 45 |
* @return {Object} Name/value array containing information about the plugin. |
| 46 |
*/ |
| 47 |
getInfo : function() { |
| 48 |
return { |
| 49 |
longname : 'post_snippets', |
| 50 |
author : 'Johan Steen', |
| 51 |
authorurl : 'http://johansteen.se/', |
| 52 |
infourl : 'http://wpstorm.net/wordpress-plugins/post-snippets/', |
| 53 |
version : "1.1" |
| 54 |
}; |
| 55 |
} |
| 56 |
}); |
| 57 |
|
| 58 |
// Register plugin |
| 59 |
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets); |
| 60 |
})(); |
| 61 |
|
| 62 |
|
| 63 |
|