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

Function extend

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

Source from the content-addressed store, hash-verified

3636 var counter = 0;
3637
3638 function extend(e) {
3639 var curCount = ++counter;
3640 var cur = posFromMouse(cm, e, true, type == "rect");
3641 if (!cur) return;
3642 if (cmp(cur, lastPos) != 0) {
3643 ensureFocus(cm);
3644 extendTo(cur);
3645 var visible = visibleLines(display, doc);
3646 if (cur.line >= visible.to || cur.line < visible.from)
3647 setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
3648 } else {
3649 var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
3650 if (outside) setTimeout(operation(cm, function() {
3651 if (counter != curCount) return;
3652 display.scroller.scrollTop += outside;
3653 extend(e);
3654 }), 50);
3655 }
3656 }
3657
3658 function done(e) {
3659 counter = Infinity;

Callers 1

leftButtonSelectFunction · 0.70

Calls 6

posFromMouseFunction · 0.70
ensureFocusFunction · 0.70
extendToFunction · 0.70
visibleLinesFunction · 0.70
operationFunction · 0.70
cmpFunction · 0.50

Tested by

no test coverage detected