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

Function prepareSelection

static/editor.md/lib/codemirror/lib/codemirror.js:2201–2216  ·  view source on GitHub ↗
(cm, primary)

Source from the content-addressed store, hash-verified

2199 }
2200
2201 function prepareSelection(cm, primary) {
2202 var doc = cm.doc, result = {};
2203 var curFragment = result.cursors = document.createDocumentFragment();
2204 var selFragment = result.selection = document.createDocumentFragment();
2205
2206 for (var i = 0; i < doc.sel.ranges.length; i++) {
2207 if (primary === false && i == doc.sel.primIndex) continue;
2208 var range = doc.sel.ranges[i];
2209 var collapsed = range.empty();
2210 if (collapsed || cm.options.showCursorWhenSelecting)
2211 drawSelectionCursor(cm, range, curFragment);
2212 if (!collapsed)
2213 drawSelectionRange(cm, range, selFragment);
2214 }
2215 return result;
2216 }
2217
2218 // Draws a cursor for the given range
2219 function drawSelectionCursor(cm, range, output) {

Callers 1

codemirror.jsFile · 0.70

Calls 2

drawSelectionCursorFunction · 0.70
drawSelectionRangeFunction · 0.70

Tested by

no test coverage detected