]> code.citadel.org Git - citadel.git/blobdiff - webcit/tiny_mce/plugins/style/editor_plugin_src.js
Upgrade of TinyMCE is in progress.
[citadel.git] / webcit / tiny_mce / plugins / style / editor_plugin_src.js
diff --git a/webcit/tiny_mce/plugins/style/editor_plugin_src.js b/webcit/tiny_mce/plugins/style/editor_plugin_src.js
new file mode 100755 (executable)
index 0000000..4fa8aaa
--- /dev/null
@@ -0,0 +1,83 @@
+/**\r
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $\r
+ *\r
+ * @author Moxiecode\r
+ * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.\r
+ */\r
+\r
+/* Import plugin specific language pack */\r
+tinyMCE.importPluginLanguagePack('style');\r
+\r
+var TinyMCE_StylePlugin = {\r
+       getInfo : function() {\r
+               return {\r
+                       longname : 'Style',\r
+                       author : 'Moxiecode Systems AB',\r
+                       authorurl : 'http://tinymce.moxiecode.com',\r
+                       infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',\r
+                       version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
+               };\r
+       },\r
+\r
+       getControlHTML : function(cn) {\r
+               switch (cn) {\r
+                       case "styleprops":\r
+                               return tinyMCE.getButtonHTML(cn, 'lang_style_styleinfo_desc', '{$pluginurl}/images/styleprops.gif', 'mceStyleProps', true);\r
+               }\r
+\r
+               return "";\r
+       },\r
+\r
+       execCommand : function(editor_id, element, command, user_interface, value) {\r
+               var e, inst;\r
+\r
+               // Handle commands\r
+               switch (command) {\r
+                       case "mceStyleProps":\r
+                               TinyMCE_StylePlugin._styleProps();\r
+                               return true;\r
+\r
+                       case "mceSetElementStyle":\r
+                               inst = tinyMCE.getInstanceById(editor_id);\r
+                               e = inst.selection.getFocusElement();\r
+\r
+                               if (e) {\r
+                                       e.style.cssText = value;\r
+                                       inst.repaint();\r
+                               }\r
+\r
+                               return true;\r
+               }\r
+\r
+               // Pass to next handler in chain\r
+               return false;\r
+       },\r
+\r
+       handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {\r
+               if (node.nodeName == 'BODY')\r
+                       tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonDisabled');\r
+               else\r
+                       tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonNormal');\r
+       },\r
+\r
+       // Private plugin specific methods\r
+\r
+       _styleProps : function() {\r
+               var e = tinyMCE.selectedInstance.selection.getFocusElement();\r
+\r
+               if (!e || e.nodeName == 'BODY')\r
+                       return;\r
+\r
+               tinyMCE.openWindow({\r
+                       file : '../../plugins/style/props.htm',\r
+                       width : 480 + tinyMCE.getLang('lang_style_props_delta_width', 0),\r
+                       height : 320 + tinyMCE.getLang('lang_style_props_delta_height', 0)\r
+               }, {\r
+                       editor_id : tinyMCE.selectedInstance.editorId,\r
+                       inline : "yes",\r
+                       style_text : e.style.cssText\r
+               });\r
+       }\r
+};\r
+\r
+tinyMCE.addPlugin("style", TinyMCE_StylePlugin);\r