Drag/Drop on CodeMirror
Hi,
Is this something that is being looked at/re-enabled?
I haven't looked at it recently.
You could try commenting out the line:
// Don't allow drag/drop because it causes issues. See https://github.com/firebase/firepad/issues/36
utils.on(editorWrapper, 'dragstart', utils.stopEvent);
in lib/firepad.js, rebuilding firepad (grunt build) and see how it works for you. It seems like last time I tried it, there were still bugs but I don't recall the details. Sorry.
Affects Ace also.
Happy to accept a PR to limit the change to CodeMirror only if this is affecting folks using Ace.
im testing this cm.on("beforeChange", function(, change) { if (change.origin == "dragstart") change.cancel() if (change.origin == "dragenter") change.cancel() if (change.origin == "dragover") change.cancel() if (change.origin == "drop") change.cancel() }); cm.on('drop', function(data, e) { console.log(e); var coords = cm.coordsChar({ left: e.x, top: e.y }); var pos = firepad.codeMirror.indexFromPos(coords); var html = firepad.getHtmlFromSelection(); firepad.codeMirror_.replaceSelection('', 'end', '+input'); cm.setCursor(coords); setTimeout(function(){ firepad.insertHtmlAtCursor(html); }, 100); firepad.codeMirror_.focus(); e.preventDefault(); e.stopPropagation(); return false; });