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

Function leftButtonStartDrag

static/editor.md/lib/codemirror/lib/codemirror.js:3509–3533  ·  view source on GitHub ↗
(cm, e, start, modifier)

Source from the content-addressed store, hash-verified

3507 // Start a text drag. When it ends, see if any dragging actually
3508 // happen, and treat as a click if it didn't.
3509 function leftButtonStartDrag(cm, e, start, modifier) {
3510 var display = cm.display;
3511 var dragEnd = operation(cm, function(e2) {
3512 if (webkit) display.scroller.draggable = false;
3513 cm.state.draggingText = false;
3514 off(document, "mouseup", dragEnd);
3515 off(display.scroller, "drop", dragEnd);
3516 if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
3517 e_preventDefault(e2);
3518 if (!modifier)
3519 extendSelection(cm.doc, start);
3520 display.input.focus();
3521 // Work around unexplainable focus problem in IE9 (#2127)
3522 if (ie && ie_version == 9)
3523 setTimeout(function() {document.body.focus(); display.input.focus();}, 20);
3524 }
3525 });
3526 // Let the drag handler handle this.
3527 if (webkit) display.scroller.draggable = true;
3528 cm.state.draggingText = dragEnd;
3529 // IE's approach to draggable
3530 if (display.scroller.dragDrop) display.scroller.dragDrop();
3531 on(document, "mouseup", dragEnd);
3532 on(display.scroller, "drop", dragEnd);
3533 }
3534
3535 // Normal selection, as opposed to text dragging.
3536 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