]> git.donarmstrong.com Git - roundcube.git/blobdiff - program/js/tiny_mce/plugins/xhtmlxtras/js/del.js
Imported Upstream version 0.2~alpha
[roundcube.git] / program / js / tiny_mce / plugins / xhtmlxtras / js / del.js
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js
new file mode 100644 (file)
index 0000000..005a619
--- /dev/null
@@ -0,0 +1,50 @@
+ /**\r
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $\r
+ *\r
+ * @author Moxiecode - based on work by Andrew Tetlaw\r
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.\r
+ */\r
+\r
+function init() {\r
+       SXE.initElementDialog('del');\r
+       if (SXE.currentAction == "update") {\r
+               setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));\r
+               setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));\r
+               SXE.showRemoveButton();\r
+       }\r
+}\r
+\r
+function setElementAttribs(elm) {\r
+       setAllCommonAttribs(elm);\r
+       setAttrib(elm, 'datetime');\r
+       setAttrib(elm, 'cite');\r
+}\r
+\r
+function insertDel() {\r
+       var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');\r
+\r
+       tinyMCEPopup.execCommand('mceBeginUndoLevel');\r
+       if (elm == null) {\r
+               var s = SXE.inst.selection.getContent();\r
+               if(s.length > 0) {\r
+                       tinyMCEPopup.execCommand('mceInsertContent', false, '<del id="#sxe_temp_del#">' + s + '</del>');\r
+                       var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});\r
+                       for (var i=0; i<elementArray.length; i++) {\r
+                               var elm = elementArray[i];\r
+                               setElementAttribs(elm);\r
+                       }\r
+               }\r
+       } else {\r
+               setElementAttribs(elm);\r
+       }\r
+       tinyMCEPopup.editor.nodeChanged();\r
+       tinyMCEPopup.execCommand('mceEndUndoLevel');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+function removeDel() {\r
+       SXE.removeElement('del');\r
+       tinyMCEPopup.close();\r
+}\r
+\r
+tinyMCEPopup.onInit.add(init);\r