Skip to content

Commit

Permalink
Fix drag/drop on Chrome by setting an image src
Browse files Browse the repository at this point in the history
Work around a Chrome regression where it aborts the drag if the
setDragImage image is src-less.

Closes codemirror#1810
  • Loading branch information
marijnh committed Sep 9, 2013
1 parent 0074346 commit 1564808
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -1912,6 +1912,7 @@ window.CodeMirror = (function() {
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
if (e.dataTransfer.setDragImage && !safari) {
var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
if (opera) {
img.width = img.height = 1;
cm.display.wrapper.appendChild(img);
Expand Down

0 comments on commit 1564808

Please sign in to comment.