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

Function prepareSelection

static/mergely/lib/codemirror.js:2304–2319  ·  view source on GitHub ↗
(cm, primary)

Source from the content-addressed store, hash-verified

2302 }
2303
2304 function prepareSelection(cm, primary) {
2305 var doc = cm.doc, result = {};
2306 var curFragment = result.cursors = document.createDocumentFragment();
2307 var selFragment = result.selection = document.createDocumentFragment();
2308
2309 for (var i = 0; i < doc.sel.ranges.length; i++) {
2310 if (primary === false && i == doc.sel.primIndex) continue;
2311 var range = doc.sel.ranges[i];
2312 var collapsed = range.empty();
2313 if (collapsed || cm.options.showCursorWhenSelecting)
2314 drawSelectionCursor(cm, range.head, curFragment);
2315 if (!collapsed)
2316 drawSelectionRange(cm, range, selFragment);
2317 }
2318 return result;
2319 }
2320
2321 // Draws a cursor for the given range
2322 function drawSelectionCursor(cm, head, output) {

Callers 1

codemirror.jsFile · 0.70

Calls 2

drawSelectionCursorFunction · 0.70
drawSelectionRangeFunction · 0.70

Tested by

no test coverage detected