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

Function filterSelectionChange

static/mergely/lib/codemirror.js:2162–2177  ·  view source on GitHub ↗
(doc, sel, options)

Source from the content-addressed store, hash-verified

2160 // Give beforeSelectionChange handlers a change to influence a
2161 // selection update.
2162 function filterSelectionChange(doc, sel, options) {
2163 var obj = {
2164 ranges: sel.ranges,
2165 update: function(ranges) {
2166 this.ranges = [];
2167 for (var i = 0; i < ranges.length; i++)
2168 this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
2169 clipPos(doc, ranges[i].head));
2170 },
2171 origin: options && options.origin
2172 };
2173 signal(doc, "beforeSelectionChange", doc, obj);
2174 if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
2175 if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);
2176 else return sel;
2177 }
2178
2179 function setSelectionReplaceHistory(doc, sel, options) {
2180 var done = doc.history.done, last = lst(done);

Callers 1

setSelectionNoUndoFunction · 0.70

Calls 2

clipPosFunction · 0.70
normalizeSelectionFunction · 0.70

Tested by

no test coverage detected