]> code.citadel.org Git - citadel.git/blobdiff - webcit/tiny_mce/plugins/contextmenu/editor_plugin_src.js
automake build is now a branch
[citadel.git] / webcit / tiny_mce / plugins / contextmenu / editor_plugin_src.js
diff --git a/webcit/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/webcit/tiny_mce/plugins/contextmenu/editor_plugin_src.js
deleted file mode 100644 (file)
index 42743e4..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/* Import plugin specific language pack */\r
-//tinyMCE.importPluginLanguagePack('contextmenu', 'en,zh_cn,cs,fa,fr_ca,fr,de,nb');\r
-if (!tinyMCE.settings['contextmenu_skip_plugin_css'])\r
-       tinyMCE.loadCSS(tinyMCE.baseURL + "/plugins/contextmenu/css/contextmenu.css");\r
-\r
-// Global contextmenu class instance\r
-var TinyMCE_contextmenu_contextMenu = null;\r
-\r
-function TinyMCE_contextmenu_getInfo() {\r
-       return {\r
-               longname : 'Context menus',\r
-               author : 'Moxiecode Systems',\r
-               authorurl : 'http://tinymce.moxiecode.com',\r
-               infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_contextmenu.html',\r
-               version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
-       };\r
-};\r
-\r
-function TinyMCE_contextmenu_initInstance(inst) {\r
-       // Is not working on MSIE 5.0 or Opera no contextmenu event\r
-       if (tinyMCE.isMSIE5_0 && tinyMCE.isOpera)\r
-               return;\r
-\r
-       // Add hide event handles\r
-       tinyMCE.addEvent(inst.getDoc(), "click", TinyMCE_contextmenu_hideContextMenu);\r
-       tinyMCE.addEvent(inst.getDoc(), "keypress", TinyMCE_contextmenu_hideContextMenu);\r
-       tinyMCE.addEvent(inst.getDoc(), "keydown", TinyMCE_contextmenu_hideContextMenu);\r
-       tinyMCE.addEvent(document, "click", TinyMCE_contextmenu_hideContextMenu);\r
-       tinyMCE.addEvent(document, "keypress", TinyMCE_contextmenu_hideContextMenu);\r
-       tinyMCE.addEvent(document, "keydown", TinyMCE_contextmenu_hideContextMenu);\r
-\r
-       var contextMenu = new ContextMenu({\r
-               commandhandler : "TinyMCE_contextmenu_commandHandler",\r
-               spacer_image : tinyMCE.baseURL + "/plugins/contextmenu/images/spacer.gif"\r
-       });\r
-\r
-       // Register global reference\r
-       TinyMCE_contextmenu_contextMenu = contextMenu;\r
-\r
-       // Attach contextmenu event\r
-       if (tinyMCE.isGecko) {\r
-               tinyMCE.addEvent(inst.getDoc(), "contextmenu", function(e) {TinyMCE_contextmenu_showContextMenu(tinyMCE.isMSIE ? inst.contentWindow.event : e, inst);});\r
-       } else\r
-               tinyMCE.addEvent(inst.getDoc(), "contextmenu", TinyMCE_contextmenu_onContextMenu);\r
-}\r
-\r
-function TinyMCE_contextmenu_onContextMenu(e) {\r
-       var elm = tinyMCE.isMSIE ? e.srcElement : e.target;\r
-       var targetInst, body;\r
-\r
-       // Find instance\r
-       if ((body = tinyMCE.getParentElement(elm, "body")) != null) {\r
-               for (var n in tinyMCE.instances) {\r
-                       var inst = tinyMCE.instances[n];\r
-                       if (!tinyMCE.isInstance(inst))\r
-                               continue;\r
-\r
-                       if (body == inst.getBody()) {\r
-                               targetInst = inst;\r
-                               break;\r
-                       }\r
-               }\r
-\r
-               return TinyMCE_contextmenu_showContextMenu(tinyMCE.isMSIE ? targetInst.contentWindow.event : e, targetInst);\r
-       }\r
-}\r
-\r
-function TinyMCE_contextmenu_showContextMenu(e, inst) {\r
-       function getAttrib(elm, name) {\r
-               return elm.getAttribute(name) ? elm.getAttribute(name) : "";\r
-       }\r
-\r
-       var x, y, elm, contextMenu;\r
-       var pos = tinyMCE.getAbsPosition(inst.iframeElement);\r
-\r
-       x = tinyMCE.isMSIE ? e.screenX : pos.absLeft + (e.pageX - inst.getBody().scrollLeft);\r
-       y = tinyMCE.isMSIE ? e.screenY : pos.absTop + (e.pageY - inst.getBody().scrollTop);\r
-       elm = tinyMCE.isMSIE ? e.srcElement : e.target;\r
-       contextMenu = TinyMCE_contextmenu_contextMenu;\r
-       contextMenu.inst = inst;\r
-\r
-       // Mozilla needs some time\r
-       window.setTimeout(function () {\r
-               var theme = tinyMCE.getParam("theme");\r
-\r
-               contextMenu.clearAll();\r
-               var sel = inst.getSelectedText().length != 0 || elm.nodeName == "IMG";\r
-\r
-               // Default items\r
-               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_cut_desc", "Cut", "", !sel);\r
-               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_copy_desc", "Copy", "", !sel);\r
-               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_paste_desc", "Paste", "", false);\r
-\r
-               // Get element\r
-               elm = tinyMCE.getParentElement(elm, "img,table,td");\r
-               if (elm) {\r
-                       switch (elm.nodeName) {\r
-                               case "IMG":\r
-                                       contextMenu.addSeparator();\r
-\r
-                                       // If flash\r
-                                       if (tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') == 0)\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_flash_props", "mceFlash");\r
-                                       else\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/image.gif", "$lang_image_props_desc", typeof(TinyMCE_advimage_getControlHTML) != "undefined" ? "mceAdvImage" : "mceImage");\r
-                                       break;\r
-\r
-                               case "TABLE":\r
-                               case "TD":\r
-                                       // Is table plugin loaded\r
-                                       if (typeof(TinyMCE_table_getControlHTML) != "undefined") {\r
-                                               var colspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "colspan");\r
-                                               var rowspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "rowspan");\r
-\r
-                                               colspan = colspan == "" ? "1" : colspan;\r
-                                               rowspan = rowspan == "" ? "1" : rowspan;\r
-\r
-                                               contextMenu.addSeparator();\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_table_cut_row_desc", "mceTableCutRow");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_table_copy_row_desc", "mceTableCopyRow");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_before_desc", "mceTablePasteRowBefore", "", inst.tableRowClipboard == null);\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_after_desc", "mceTablePasteRowAfter", "", inst.tableRowClipboard == null);\r
-\r
-/*                                             contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyleft.gif", "$lang_justifyleft_desc", "JustifyLeft", "", false);\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifycenter.gif", "$lang_justifycenter_desc", "JustifyCenter", "", false);\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyright.gif", "$lang_justifyright_desc", "JustifyRight", "", false);\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyfull.gif", "$lang_justifyfull_desc", "JustifyFull", "", false);*/\r
-                                               contextMenu.addSeparator();\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_props_desc", "mceInsertTable");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_cell_props.gif", "$lang_table_cell_desc", "mceTableCellProps");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete.gif", "$lang_table_del", "mceTableDelete");\r
-                                               contextMenu.addSeparator();\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_row_props.gif", "$lang_table_row_desc", "mceTableRowProps");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_before.gif", "$lang_table_row_before_desc", "mceTableInsertRowBefore");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_after.gif", "$lang_table_row_after_desc", "mceTableInsertRowAfter");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_row.gif", "$lang_table_delete_row_desc", "mceTableDeleteRow");\r
-                                               contextMenu.addSeparator();\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_before.gif", "$lang_table_col_before_desc", "mceTableInsertColBefore");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_after.gif", "$lang_table_col_after_desc", "mceTableInsertColAfter");\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_col.gif", "$lang_table_delete_col_desc", "mceTableDeleteCol");\r
-                                               contextMenu.addSeparator();\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_split_cells.gif", "$lang_table_split_cells_desc", "mceTableSplitCells", "", (colspan == "1" && rowspan == "1"));\r
-                                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_merge_cells.gif", "$lang_table_merge_cells_desc", "mceTableMergeCells", "", false);\r
-                                       }\r
-                                       break;\r
-                       }\r
-               }  else {\r
-                       // Add table specific\r
-                       if (typeof(TinyMCE_table_getControlHTML) != "undefined") {\r
-                               contextMenu.addSeparator();\r
-                               contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert");\r
-                       }\r
-               }\r
-\r
-               contextMenu.show(x, y);\r
-       }, 10);\r
-\r
-       // Cancel default handeling\r
-       tinyMCE.cancelEvent(e);\r
-       return false;\r
-}\r
-\r
-function TinyMCE_contextmenu_hideContextMenu() {\r
-       TinyMCE_contextmenu_contextMenu.hide();\r
-}\r
-\r
-function TinyMCE_contextmenu_commandHandler(command, value) {\r
-       TinyMCE_contextmenu_contextMenu.hide();\r
-\r
-       // UI must be true on these\r
-       var ui = false;\r
-       if (command == "mceInsertTable" || command == "mceTableCellProps" || command == "mceTableRowProps" || command == "mceTableMergeCells")\r
-               ui = true;\r
-\r
-       if (command == "Paste")\r
-               value = null;\r
-\r
-       TinyMCE_contextmenu_contextMenu.inst.execCommand(command, ui, value);\r
-}\r
-\r
-// Context menu class\r
-\r
-function ContextMenu(settings) {\r
-       // Default value function\r
-       function defParam(key, def_val) {\r
-               settings[key] = typeof(settings[key]) != "undefined" ? settings[key] : def_val;\r
-       }\r
-\r
-       var self = this;\r
-\r
-       this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");\r
-\r
-       // Setup contextmenu div\r
-       this.contextMenuDiv = document.createElement("div");\r
-       this.contextMenuDiv.className = "contextMenu";\r
-       this.contextMenuDiv.setAttribute("class", "contextMenu");\r
-       this.contextMenuDiv.style.display = "none";\r
-       this.contextMenuDiv.style.position = 'absolute';\r
-       this.contextMenuDiv.style.zindex = 1000;\r
-       this.contextMenuDiv.style.left = '0px';\r
-       this.contextMenuDiv.style.top = '0px';\r
-       this.contextMenuDiv.unselectable = "on";\r
-\r
-       document.body.appendChild(this.contextMenuDiv);\r
-\r
-       // Setup default values\r
-       defParam("commandhandler", "");\r
-       defParam("spacer_image", "images/spacer.gif");\r
-\r
-       this.items = new Array();\r
-       this.settings = settings;\r
-       this.html = "";\r
-\r
-       // IE Popup\r
-       if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera) {\r
-               this.pop = window.createPopup();\r
-               doc = this.pop.document;\r
-               doc.open();\r
-               doc.write('<html><head><link href="' + tinyMCE.baseURL + '/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');\r
-               doc.close();\r
-       }\r
-};\r
-\r
-ContextMenu.prototype.clearAll = function() {\r
-       this.html = "";\r
-       this.contextMenuDiv.innerHTML = "";\r
-};\r
-\r
-ContextMenu.prototype.addSeparator = function() {\r
-       this.html += '<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="' + this.settings['spacer_image'] + '" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="' + this.settings['spacer_image'] + '" /></td></tr>';\r
-};\r
-\r
-ContextMenu.prototype.addItem = function(icon, title, command, value, disabled) {\r
-       if (title.charAt(0) == '$')\r
-               title = tinyMCE.getLang(title.substring(1));\r
-\r
-       var onMouseDown = '';\r
-       var html = '';\r
-\r
-       if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0)\r
-               onMouseDown = 'contextMenu.execCommand(\'' + command + '\', \'' + value + '\');return false;';\r
-       else\r
-               onMouseDown = this.settings['commandhandler'] + '(\'' + command + '\', \'' + value + '\');return false;';\r
-\r
-       if (icon == "")\r
-               icon = this.settings['spacer_image'];\r
-\r
-       if (!disabled)\r
-               html += '<tr class="contextMenuItem" onmousedown="' + onMouseDown + '" onmouseover="tinyMCE.switchClass(this,\'contextMenuItemOver\');" onmouseout="tinyMCE.switchClass(this,\'contextMenuItem\');">';\r
-       else\r
-               html += '<tr class="contextMenuItemDisabled">';\r
-\r
-       html += '<td class="contextMenuIcon"><img src="' + icon + '" width="20" height="20" class="contextMenuImage" /></td>';\r
-       html += '<td><div class="contextMenuText">';\r
-\r
-       // Add text\r
-       html += title;\r
-\r
-       html += '</div></td>';\r
-       html += '</tr>';\r
-\r
-       // Add to main\r
-       this.html += html;\r
-};\r
-\r
-ContextMenu.prototype.show = function(x, y) {\r
-       if (this.html == "")\r
-               return;\r
-\r
-       var html = '';\r
-\r
-       html += '<table border="0" cellpadding="0" cellspacing="0">';\r
-       html += this.html;\r
-       html += '</table>';\r
-\r
-       this.contextMenuDiv.innerHTML = html;\r
-\r
-       if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera) {\r
-               var width, height;\r
-\r
-               // Get dimensions\r
-               this.contextMenuDiv.style.display = "block";\r
-               width = this.contextMenuDiv.offsetWidth;\r
-               height = this.contextMenuDiv.offsetHeight;\r
-               this.contextMenuDiv.style.display = "none";\r
-\r
-               // Setup popup and show\r
-               this.pop.document.body.innerHTML = '<div class="contextMenu">' + html + "</div>";\r
-               this.pop.document.tinyMCE = tinyMCE;\r
-               this.pop.document.contextMenu = this;\r
-               this.pop.show(x, y, width, height);\r
-       } else {\r
-               this.contextMenuDiv.style.left = x + 'px';\r
-               this.contextMenuDiv.style.top = y + 'px';\r
-               this.contextMenuDiv.style.display = "block";\r
-       }\r
-};\r
-\r
-ContextMenu.prototype.hide = function() {\r
-       if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera)\r
-               this.pop.hide();\r
-       else\r
-               this.contextMenuDiv.style.display = "none";\r
-};\r
-\r
-ContextMenu.prototype.execCommand = function(command, value) {\r
-       eval(this.settings['commandhandler'] + "(command, value);");\r
-};\r