tagging as ATutor 1.5.4-release
[atutor.git] / jscripts / tiny_mce / plugins / style / editor_plugin_src.js
1 /**\r
2  * $RCSfile: editor_plugin_src.js,v $\r
3  * $Revision: 1.1 $\r
4  * $Date: 2006/05/03 10:46:42 $\r
5  *\r
6  * @author Moxiecode\r
7  * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.\r
8  */\r
9 \r
10 /* Import plugin specific language pack */\r
11 tinyMCE.importPluginLanguagePack('style', 'en');\r
12 \r
13 var TinyMCE_StylePlugin = {\r
14         getInfo : function() {\r
15                 return {\r
16                         longname : 'Style',\r
17                         author : 'Moxiecode Systems',\r
18                         authorurl : 'http://tinymce.moxiecode.com',\r
19                         infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_style.html',\r
20                         version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
21                 };\r
22         },\r
23 \r
24         getControlHTML : function(cn) {\r
25                 switch (cn) {\r
26                         case "styleprops":\r
27                                 return tinyMCE.getButtonHTML(cn, 'lang_style_styleinfo_desc', '{$pluginurl}/images/style_info.gif', 'mceStyleProps', true);\r
28                 }\r
29 \r
30                 return "";\r
31         },\r
32 \r
33         execCommand : function(editor_id, element, command, user_interface, value) {\r
34                 var e, inst;\r
35 \r
36                 // Handle commands\r
37                 switch (command) {\r
38                         case "mceStyleProps":\r
39                                 TinyMCE_StylePlugin._styleProps();\r
40                                 return true;\r
41 \r
42                         case "mceSetElementStyle":\r
43                                 inst = tinyMCE.getInstanceById(editor_id);\r
44                                 e = inst.selection.getFocusElement();\r
45 \r
46                                 if (e) {\r
47                                         e.style.cssText = value;\r
48                                         inst.repaint();\r
49                                 }\r
50 \r
51                                 return true;\r
52                 }\r
53 \r
54                 // Pass to next handler in chain\r
55                 return false;\r
56         },\r
57 \r
58         handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {\r
59         },\r
60 \r
61         // Private plugin specific methods\r
62 \r
63         _styleProps : function() {\r
64                 var e = tinyMCE.selectedInstance.selection.getFocusElement();\r
65 \r
66                 if (!e)\r
67                         return;\r
68 \r
69                 tinyMCE.openWindow({\r
70                         file : '../../plugins/style/props.htm',\r
71                         width : 480 + tinyMCE.getLang('lang_style_props_delta_width', 0),\r
72                         height : 320 + tinyMCE.getLang('lang_style_props_delta_height', 0)\r
73                 }, {\r
74                         editor_id : tinyMCE.selectedInstance.editorId,\r
75                         inline : "yes",\r
76                         style_text : e.style.cssText\r
77                 });\r
78         }\r
79 };\r
80 \r
81 tinyMCE.addPlugin("style", TinyMCE_StylePlugin);\r