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

Function leftButtonStartDrag

static/mergely/lib/codemirror.js:3634–3659  ·  view source on GitHub ↗
(cm, e, start, modifier)

Source from the content-addressed store, hash-verified

3632 // Start a text drag. When it ends, see if any dragging actually
3633 // happen, and treat as a click if it didn't.
3634 function leftButtonStartDrag(cm, e, start, modifier) {
3635 var display = cm.display, startTime = +new Date;
3636 var dragEnd = operation(cm, function(e2) {
3637 if (webkit) display.scroller.draggable = false;
3638 cm.state.draggingText = false;
3639 off(document, "mouseup", dragEnd);
3640 off(display.scroller, "drop", dragEnd);
3641 if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
3642 e_preventDefault(e2);
3643 if (!modifier && +new Date - 200 < startTime)
3644 extendSelection(cm.doc, start);
3645 // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
3646 if (webkit || ie && ie_version == 9)
3647 setTimeout(function() {document.body.focus(); display.input.focus();}, 20);
3648 else
3649 display.input.focus();
3650 }
3651 });
3652 // Let the drag handler handle this.
3653 if (webkit) display.scroller.draggable = true;
3654 cm.state.draggingText = dragEnd;
3655 // IE's approach to draggable
3656 if (display.scroller.dragDrop) display.scroller.dragDrop();
3657 on(document, "mouseup", dragEnd);
3658 on(display.scroller, "drop", dragEnd);
3659 }
3660
3661 // Normal selection, as opposed to text dragging.
3662 function leftButtonSelect(cm, e, start, type, addNew) {

Callers 1

leftButtonDownFunction · 0.70

Calls 3

operationFunction · 0.70
extendSelectionFunction · 0.70
onFunction · 0.50

Tested by

no test coverage detected