MCPcopy Create free account
hub / github.com/TruthHun/BookStack / onDragStart

Function onDragStart

static/editor.md/lib/codemirror/lib/codemirror.js:3759–3779  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

3757 }
3758
3759 function onDragStart(cm, e) {
3760 if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
3761 if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
3762
3763 e.dataTransfer.setData("Text", cm.getSelection());
3764
3765 // Use dummy image instead of default browsers image.
3766 // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
3767 if (e.dataTransfer.setDragImage && !safari) {
3768 var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
3769 img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
3770 if (presto) {
3771 img.width = img.height = 1;
3772 cm.display.wrapper.appendChild(img);
3773 // Force a relayout, or Opera won't use our image for some obscure reason
3774 img._top = img.offsetTop;
3775 }
3776 e.dataTransfer.setDragImage(img, 0, 0);
3777 if (presto) img.parentNode.removeChild(img);
3778 }
3779 }
3780
3781 // SCROLL EVENTS
3782

Callers 1

registerEventHandlersFunction · 0.70

Calls 3

signalDOMEventFunction · 0.70
eventInWidgetFunction · 0.70
eltFunction · 0.70

Tested by

no test coverage detected