Skip to content

Commit eabf5b5

Browse files
committed
Work around fact that FF doesn't set modifiers on drop events
Store the modifier in the original mouse event to choose between move and copy drags. Issue codemirror#2556
1 parent 2543f79 commit eabf5b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/codemirror.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3660,6 +3660,7 @@
36603660
// Let the drag handler handle this.
36613661
if (webkit) display.scroller.draggable = true;
36623662
cm.state.draggingText = dragEnd;
3663+
dragEnd.copy = mac ? e.altKey : e.ctrlKey
36633664
// IE's approach to draggable
36643665
if (display.scroller.dragDrop) display.scroller.dragDrop();
36653666
on(document, "mouseup", dragEnd);
@@ -3890,7 +3891,7 @@
38903891
try {
38913892
var text = e.dataTransfer.getData("Text");
38923893
if (text) {
3893-
if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))
3894+
if (cm.state.draggingText && !cm.state.draggingText.copy)
38943895
var selected = cm.listSelections();
38953896
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
38963897
if (selected) for (var i = 0; i < selected.length; ++i)

0 commit comments

Comments
 (0)