diff --git a/lib/ace/mouse/dragdrop_handler.js b/lib/ace/mouse/dragdrop_handler.js index 8d760e6e..28d038b5 100644 --- a/lib/ace/mouse/dragdrop_handler.js +++ b/lib/ace/mouse/dragdrop_handler.js @@ -35,17 +35,17 @@ var dom = require("../lib/dom"); var event = require("../lib/event"); var useragent = require("../lib/useragent"); -// Safari accepts either image or element (but it must present in the DOM) -var proxy = dom.createElement('img'); -// Safari crashes without image data -proxy.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - function DragdropHandler(mouseHandler) { var editor = mouseHandler.editor; + // Safari accepts either image or element (but it must present in the DOM) + var proxy = dom.createElement("img"); + // Safari crashes without image data + proxy.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; + if (useragent.isOpera) { - proxy.style.cssText = 'width:1px;height:1px;position:fixed;top:0;z-index:-1'; + proxy.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;visibility:hidden"; editor.container.appendChild(proxy); } @@ -73,6 +73,12 @@ function DragdropHandler(mouseHandler) { }, 0); return e.preventDefault(); } + if (useragent.isOpera) { + proxy.style.visibility = "visible"; + setTimeout(function(){ + proxy.style.visibility = "hidden"; + }, 0); + } range = editor.getSelectionRange(); var dataTransfer = e.dataTransfer;