drag&drop modifiers

When dragDrop is set to true only moving the text is allowed (and the + cursor is wrongly shown while dragging). Modifier keys have no effect. Can this (copy vs move) be achieved somehow?
Thanks for the answer!

Which browser shows the + cursor? You should be able to choose between move and copy by holding the ctrl key (or meta on Mac) to copy. Move is the default.

Chrome (49.0.2623.112 64-bit) on mac osx shows green + by default, when the action is move. Also tested here: http://codemirror.net/mode/markdown/index.html.
Thanks, for your answer and again for a wonderful editor!!

Could you see if setting dropEffect to "move" (when appropriate) solves this? My test Mac is dead (again), so I can’t currently test this.


document.addEventListener('dragstart', function(e) {
	e.dataTransfer.effectAllowed = "copyMove";
}, false);

resolves the problem. + is gone and now only appears when holding the alt key = copy. “move” also does the job.

I can’t do:

cm.on("dragstart", function(e) { ... }); 

as dataTransfer is not available … or I’m doing smth wrong?


and it seems that e.dataTransfer.dropEffect = "move"; doesn’t do anything.

Interesting. I hadn’t looked at effectAllowed before. Does this patch solve the issue for you?

Yes, it does!

This is still an issue with in Firefox. See https://bugzilla.mozilla.org/show_bug.cgi?id=1069898
It’s also not fixed in codemirror-5.17.0.

After reading the description from brojgar again I came to the conclusion: both issues are not related. They look similar but are not. In case of the latter it is correct to show the plus sign, but the instant the left mouse button is released, the internal state of the drop-effect is somehow forgotten and gets ignored. So the drag and drop action always results in moving of the selected text, even if the CTRL key was pressed.
I’m sorry for causing confusion with my previous post.

Could you create an issue on github will a full description? I’m having trouble condensing a bug description from this thread.