]> code.citadel.org Git - citadel.git/blob - webcit/tiny_mce/plugins/style/editor_plugin_src.js
* serv_ldap.c: upon successful connect to an LDAP server, post an aide message warnin...
[citadel.git] / webcit / tiny_mce / plugins / style / editor_plugin_src.js
1 /**\r
2  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $\r
3  *\r
4  * @author Moxiecode\r
5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.\r
6  */\r
7 \r
8 /* Import plugin specific language pack */\r
9 tinyMCE.importPluginLanguagePack('style');\r
10 \r
11 var TinyMCE_StylePlugin = {\r
12         getInfo : function() {\r
13                 return {\r
14                         longname : 'Style',\r
15                         author : 'Moxiecode Systems AB',\r
16                         authorurl : 'http://tinymce.moxiecode.com',\r
17                         infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',\r
18                         version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
19                 };\r
20         },\r
21 \r
22         getControlHTML : function(cn) {\r
23                 switch (cn) {\r
24                         case "styleprops":\r
25                                 return tinyMCE.getButtonHTML(cn, 'lang_style_styleinfo_desc', '{$pluginurl}/images/styleprops.gif', 'mceStyleProps', true);\r
26                 }\r
27 \r
28                 return "";\r
29         },\r
30 \r
31         execCommand : function(editor_id, element, command, user_interface, value) {\r
32                 var e, inst;\r
33 \r
34                 // Handle commands\r
35                 switch (command) {\r
36                         case "mceStyleProps":\r
37                                 TinyMCE_StylePlugin._styleProps();\r
38                                 return true;\r
39 \r
40                         case "mceSetElementStyle":\r
41                                 inst = tinyMCE.getInstanceById(editor_id);\r
42                                 e = inst.selection.getFocusElement();\r
43 \r
44                                 if (e) {\r
45                                         e.style.cssText = value;\r
46                                         inst.repaint();\r
47                                 }\r
48 \r
49                                 return true;\r
50                 }\r
51 \r
52                 // Pass to next handler in chain\r
53                 return false;\r
54         },\r
55 \r
56         handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {\r
57                 if (node.nodeName == 'BODY')\r
58                         tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonDisabled');\r
59                 else\r
60                         tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonNormal');\r
61         },\r
62 \r
63         // Private plugin specific methods\r
64 \r
65         _styleProps : function() {\r
66                 var e = tinyMCE.selectedInstance.selection.getFocusElement();\r
67 \r
68                 if (!e || e.nodeName == 'BODY')\r
69                         return;\r
70 \r
71                 tinyMCE.openWindow({\r
72                         file : '../../plugins/style/props.htm',\r
73                         width : 480 + tinyMCE.getLang('lang_style_props_delta_width', 0),\r
74                         height : 320 + tinyMCE.getLang('lang_style_props_delta_height', 0)\r
75                 }, {\r
76                         editor_id : tinyMCE.selectedInstance.editorId,\r
77                         inline : "yes",\r
78                         style_text : e.style.cssText\r
79                 });\r
80         }\r
81 };\r
82 \r
83 tinyMCE.addPlugin("style", TinyMCE_StylePlugin);\r