From eabf5b5d9aefcaa858124e255fdc258b3631d555 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijn@haverbeke.nl>
Date: Tue, 7 Jun 2016 12:05:21 +0200
Subject: [PATCH] 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 #2556
---
 lib/codemirror.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/codemirror.js b/lib/codemirror.js
index c56e147ee..ac0bd5407 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -3660,6 +3660,7 @@
     // Let the drag handler handle this.
     if (webkit) display.scroller.draggable = true;
     cm.state.draggingText = dragEnd;
+    dragEnd.copy = mac ? e.altKey : e.ctrlKey
     // IE's approach to draggable
     if (display.scroller.dragDrop) display.scroller.dragDrop();
     on(document, "mouseup", dragEnd);
@@ -3890,7 +3891,7 @@
       try {
         var text = e.dataTransfer.getData("Text");
         if (text) {
-          if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))
+          if (cm.state.draggingText && !cm.state.draggingText.copy)
             var selected = cm.listSelections();
           setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
           if (selected) for (var i = 0; i < selected.length; ++i)
-- 
GitLab