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

Function onMouseDown

static/editor.md/lib/codemirror/lib/codemirror.js:3445–3480  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

3443 // middle-click-paste. Or it might be a click on something we should
3444 // not interfere with, such as a scrollbar or widget.
3445 function onMouseDown(e) {
3446 var cm = this, display = cm.display;
3447 if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return;
3448 display.shift = e.shiftKey;
3449
3450 if (eventInWidget(display, e)) {
3451 if (!webkit) {
3452 // Briefly turn off draggability, to allow widgets to do
3453 // normal dragging things.
3454 display.scroller.draggable = false;
3455 setTimeout(function(){display.scroller.draggable = true;}, 100);
3456 }
3457 return;
3458 }
3459 if (clickInGutter(cm, e)) return;
3460 var start = posFromMouse(cm, e);
3461 window.focus();
3462
3463 switch (e_button(e)) {
3464 case 1:
3465 if (start)
3466 leftButtonDown(cm, e, start);
3467 else if (e_target(e) == display.scroller)
3468 e_preventDefault(e);
3469 break;
3470 case 2:
3471 if (webkit) cm.state.lastMiddleDown = +new Date;
3472 if (start) extendSelection(cm.doc, start);
3473 setTimeout(function() {display.input.focus();}, 20);
3474 e_preventDefault(e);
3475 break;
3476 case 3:
3477 if (captureRightClick) onContextMenu(cm, e);
3478 break;
3479 }
3480 }
3481
3482 var lastClick, lastDoubleClick;
3483 function leftButtonDown(cm, e, start) {

Callers

nothing calls this directly

Calls 9

signalDOMEventFunction · 0.70
eventInWidgetFunction · 0.70
clickInGutterFunction · 0.70
posFromMouseFunction · 0.70
e_buttonFunction · 0.70
leftButtonDownFunction · 0.70
e_targetFunction · 0.70
extendSelectionFunction · 0.70
onContextMenuFunction · 0.70

Tested by

no test coverage detected