| 1 |
// Docu : http://www.tinymce.com/wiki.php/API3:tinymce.api.3.x |
| 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 |
|
| 18 |
// Register the command so that it can be invoked from the button |
| 19 |
ed.addCommand('mce_post_snippets', function() { |
| 20 |
post_snippets_canvas = ed; |
| 21 |
post_snippets_caller = 'visual'; |
| 22 |
jQuery( "#post-snippets-dialog" ).dialog( "open" ); |
| 23 |
}); |
| 24 |
|
| 25 |
// Register example button |
| 26 |
ed.addButton('post_snippets', { |
| 27 |
title : 'Post Snippets', |
| 28 |
cmd : 'mce_post_snippets', |
| 29 |
image : url + '/post-snippets.gif' |
| 30 |
}); |
| 31 |
}, |
| 32 |
|
| 33 |
/** |
| 34 |
* Returns information about the plugin as a name/value array. |
| 35 |
* The current keys are longname, author, authorurl, infourl and version. |
| 36 |
* |
| 37 |
* @return {Object} Name/value array containing information about the plugin. |
| 38 |
*/ |
| 39 |
getInfo : function() { |
| 40 |
return { |
| 41 |
longname : 'Post Snippets', |
| 42 |
author : 'GreenTreeLabs', |
| 43 |
authorurl : 'https://www.postsnippets.com/', |
| 44 |
infourl : 'https://www.postsnippets.com/', |
| 45 |
version : '1.9' |
| 46 |
}; |
| 47 |
} |
| 48 |
}); |
| 49 |
|
| 50 |
// Register plugin |
| 51 |
tinymce.PluginManager.add('post_snippets', tinymce.plugins.post_snippets); |
| 52 |
})(); |
| 53 |
|
| 54 |
|
| 55 |
|