Revert "serv_rssclient.c: style update"
[citadel.git] / webcit / tiny_mce / plugins / example / editor_plugin_src.js
1 /**\r
2  * editor_plugin_src.js\r
3  *\r
4  * Copyright 2009, Moxiecode Systems AB\r
5  * Released under LGPL License.\r
6  *\r
7  * License: http://tinymce.moxiecode.com/license\r
8  * Contributing: http://tinymce.moxiecode.com/contributing\r
9  */\r
10 \r
11 (function() {\r
12         // Load plugin specific language pack\r
13         tinymce.PluginManager.requireLangPack('example');\r
14 \r
15         tinymce.create('tinymce.plugins.ExamplePlugin', {\r
16                 /**\r
17                  * Initializes the plugin, this will be executed after the plugin has been created.\r
18                  * This call is done before the editor instance has finished it's initialization so use the onInit event\r
19                  * of the editor instance to intercept that event.\r
20                  *\r
21                  * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
22                  * @param {string} url Absolute URL to where the plugin is located.\r
23                  */\r
24                 init : function(ed, url) {\r
25                         // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');\r
26                         ed.addCommand('mceExample', function() {\r
27                                 ed.windowManager.open({\r
28                                         file : url + '/dialog.htm',\r
29                                         width : 320 + parseInt(ed.getLang('example.delta_width', 0)),\r
30                                         height : 120 + parseInt(ed.getLang('example.delta_height', 0)),\r
31                                         inline : 1\r
32                                 }, {\r
33                                         plugin_url : url, // Plugin absolute URL\r
34                                         some_custom_arg : 'custom arg' // Custom argument\r
35                                 });\r
36                         });\r
37 \r
38                         // Register example button\r
39                         ed.addButton('example', {\r
40                                 title : 'example.desc',\r
41                                 cmd : 'mceExample',\r
42                                 image : url + '/img/example.gif'\r
43                         });\r
44 \r
45                         // Add a node change handler, selects the button in the UI when a image is selected\r
46                         ed.onNodeChange.add(function(ed, cm, n) {\r
47                                 cm.setActive('example', n.nodeName == 'IMG');\r
48                         });\r
49                 },\r
50 \r
51                 /**\r
52                  * Creates control instances based in the incomming name. This method is normally not\r
53                  * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons\r
54                  * but you sometimes need to create more complex controls like listboxes, split buttons etc then this\r
55                  * method can be used to create those.\r
56                  *\r
57                  * @param {String} n Name of the control to create.\r
58                  * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.\r
59                  * @return {tinymce.ui.Control} New control instance or null if no control was created.\r
60                  */\r
61                 createControl : function(n, cm) {\r
62                         return null;\r
63                 },\r
64 \r
65                 /**\r
66                  * Returns information about the plugin as a name/value array.\r
67                  * The current keys are longname, author, authorurl, infourl and version.\r
68                  *\r
69                  * @return {Object} Name/value array containing information about the plugin.\r
70                  */\r
71                 getInfo : function() {\r
72                         return {\r
73                                 longname : 'Example plugin',\r
74                                 author : 'Some author',\r
75                                 authorurl : 'http://tinymce.moxiecode.com',\r
76                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/example',\r
77                                 version : "1.0"\r
78                         };\r
79                 }\r
80         });\r
81 \r
82         // Register plugin\r
83         tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);\r
84 })();