]> code.citadel.org Git - citadel.git/blobdiff - webcit/tiny_mce/plugins/_template/editor_plugin_src.js
re-added binary
[citadel.git] / webcit / tiny_mce / plugins / _template / editor_plugin_src.js
diff --git a/webcit/tiny_mce/plugins/_template/editor_plugin_src.js b/webcit/tiny_mce/plugins/_template/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..9378b49
--- /dev/null
@@ -0,0 +1,131 @@
+/* Import plugin specific language pack */\r
+tinyMCE.importPluginLanguagePack('template', 'en,he,no'); // <- Add a comma separated list of all supported languages\r
+\r
+/****\r
+ * Steps for creating a plugin from this template:\r
+ *\r
+ * 1. Change all "template" to the name of your plugin.\r
+ * 2. Remove all the callbacks in this file that you don't need.\r
+ * 3. Remove the popup.htm file if you don't need any popups.\r
+ * 4. Add your custom logic to the callbacks you needed.\r
+ * 5. Write documentation in a readme.txt file on how to use the plugin.\r
+ * 6. Upload it under the "Plugins" section at sourceforge.\r
+ *\r
+ ****/\r
+\r
+/**\r
+ * Information about the plugin.\r
+ */\r
+function TinyMCE_template_getInfo() {\r
+       return {\r
+               longname : 'Template plugin',\r
+               author : 'Your name',\r
+               authorurl : 'http://www.yoursite.com',\r
+               infourl : 'http://www.yoursite.com/docs/template.html',\r
+               version : "1.0"\r
+       };\r
+};\r
+\r
+/**\r
+ * Gets executed when a editor instance is initialized\r
+ */\r
+function TinyMCE_template_initInstance(inst) {\r
+       // You can take out plugin specific parameters\r
+       alert("Initialization parameter:" + tinyMCE.getParam("template_someparam", false));\r
+}\r
+\r
+/**\r
+ * Gets executed when a editor needs to generate a button.\r
+ */\r
+function TinyMCE_template_getControlHTML(control_name) {\r
+       switch (control_name) {\r
+               case "template":\r
+                       return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceTemplate\', true);" target="_self" onmousedown="return false;"><img id="{$editor_id}_template" src="{$pluginurl}/images/template.gif" title="{$lang_template_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';\r
+       }\r
+\r
+       return "";\r
+}\r
+\r
+/**\r
+ * Gets executed when a command is called.\r
+ */\r
+function TinyMCE_template_execCommand(editor_id, element, command, user_interface, value) {\r
+       // Handle commands\r
+       switch (command) {\r
+               // Remember to have the "mce" prefix for commands so they don't intersect with built in ones in the browser.\r
+               case "mceTemplate":\r
+                       // Show UI/Popup\r
+                       if (user_interface) {\r
+                               // Open a popup window and send in some custom data in a window argument\r
+                               var template = new Array();\r
+\r
+                               template['file'] = '../../plugins/template/popup.htm'; // Relative to theme\r
+                               template['width'] = 300;\r
+                               template['height'] = 200;\r
+\r
+                               tinyMCE.openWindow(template, {editor_id : editor_id, some_custom_arg : "somecustomdata"});\r
+\r
+                               // Let TinyMCE know that something was modified\r
+                               tinyMCE.triggerNodeChange(false);\r
+                       } else {\r
+                               // Do a command this gets called from the template popup\r
+                               alert("execCommand: mceTemplate gets called from popup.");\r
+                       }\r
+\r
+                       return true;\r
+       }\r
+\r
+       // Pass to next handler in chain\r
+       return false;\r
+}\r
+\r
+/**\r
+ * Gets executed when the selection/cursor position was changed.\r
+ */\r
+function TinyMCE_template_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {\r
+       // Deselect template button\r
+       tinyMCE.switchClassSticky(editor_id + '_template', 'mceButtonNormal');\r
+\r
+       // Select template button if parent node is a strong or b\r
+       if (node.parentNode.nodeName == "STRONG" || node.parentNode.nodeName == "B")\r
+               tinyMCE.switchClassSticky(editor_id + '_template', 'mceButtonSelected');\r
+\r
+       return true;\r
+}\r
+\r
+/**\r
+ * Gets executed when contents is inserted / retrived.\r
+ */\r
+function TinyMCE_template_cleanup(type, content) {\r
+       switch (type) {\r
+               case "get_from_editor":\r
+                       alert("[FROM] Value HTML string: " + content);\r
+\r
+                       // Do custom cleanup code here\r
+\r
+                       break;\r
+\r
+               case "insert_to_editor":\r
+                       alert("[TO] Value HTML string: " + content);\r
+\r
+                       // Do custom cleanup code here\r
+\r
+                       break;\r
+\r
+               case "get_from_editor_dom":\r
+                       alert("[FROM] Value DOM Element " + content.innerHTML);\r
+\r
+                       // Do custom cleanup code here\r
+\r
+                       break;\r
+\r
+               case "insert_to_editor_dom":\r
+                       alert("[TO] Value DOM Element: " + content.innerHTML);\r
+\r
+                       // Do custom cleanup code here\r
+\r
+                       break;\r
+       }\r
+\r
+       return content;\r
+}\r