source: trunk/www.guidonia.net/wp/wp-content/plugins/lexi/tinymce/editor_plugin.js@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 3.0 KB
Line 
1//
2
3(function() {
4 // Load plugin specific language pack
5// tinymce.PluginManager.requireLangPack('Lexi');
6
7 tinymce.create('tinymce.plugins.LexiPlugin', {
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('mceLexi');
18 ed.addCommand('mceLexi', function() {
19 ed.windowManager.open({
20 file : url + '/mce_lexi.php',
21 width : 380 + ed.getLang('Lexi.delta_width', 0),
22 height : 310 + ed.getLang('Lexi.delta_height', 0),
23 inline : 1
24 }, {
25 plugin_url : url, // Plugin absolute URL
26 some_custom_arg : 'custom arg' // Custom argument
27 });
28 });
29
30
31 // Register Lexi button
32 ed.addButton('Lexi', {
33 title : 'Lexi.desc',
34 cmd : 'mceLexi',
35 image : url + '/lexi.gif'
36 });
37
38 // Add a node change handler, selects the button in the UI when a image is selected
39 ed.onNodeChange.add(function(ed, cm, n) {
40 cm.setActive('Lexi', n.nodeName == 'IMG');
41 });
42 },
43
44 /**
45 * Creates control instances based in the incomming name. This method is normally not
46 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
47 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
48 * method can be used to create those.
49 *
50 * @param {String} n Name of the control to create.
51 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
52 * @return {tinymce.ui.Control} New control instance or null if no control was created.
53 */
54 createControl : function(n, cm) {
55 return null;
56 },
57
58 /**
59 * Returns information about the plugin as a name/value array.
60 * The current keys are longname, author, authorurl, infourl and version.
61 *
62 * @return {Object} Name/value array containing information about the plugin.
63 */
64 getInfo : function() {
65 return {
66 longname : 'Lexi plugin',
67 author : 'Juan Sebastián Echeverry',
68 authorurl : 'http://www.sebaxtian.com',
69 infourl : 'http://www.sebaxtian.com/acerca-de/Lexi',
70 version : "1.0"
71 };
72 }
73 });
74
75 // Register plugin
76 tinymce.PluginManager.add('Lexi', tinymce.plugins.LexiPlugin);
77})();
Note: See TracBrowser for help on using the repository browser.