Skip to content

Commit f2d2938

Browse files
peterkroonmarijnh
authored andcommitted
Append image to wrapper
Append image to wrapper. No more appending to document. Works with multiple editors. Tested: 3 editors beneath each other on 1 page.
1 parent e653b1b commit f2d2938

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/codemirror.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ window.CodeMirror = (function() {
168168

169169
// Used for measuring wheel scrolling granularity
170170
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
171+
172+
//opera setDragImage hack
173+
if (opera) {
174+
var img = elt('img');
175+
img.width = '1';
176+
img.height = '1';
177+
img.setAttribute('style','position:fixed; top:0; left:0; right:0');
178+
d.wrapper.appendChild(img);
179+
}
171180

172181
return d;
173182
}
@@ -1612,8 +1621,9 @@ window.CodeMirror = (function() {
16121621

16131622
// Use dummy image instead of default browsers image.
16141623
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
1624+
var img = opera ? cm.display.wrapper.getElementsByTagName('img')[0] : elt('img');
16151625
if (e.dataTransfer.setDragImage && !safari)
1616-
e.dataTransfer.setDragImage(elt('img'), 0, 0);
1626+
e.dataTransfer.setDragImage(img, 0, 0);
16171627
}
16181628

16191629
function setScrollTop(cm, val) {

0 commit comments

Comments
 (0)