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

Function attachLocalSpans

static/mergely/lib/codemirror.js:8003–8010  ·  view source on GitHub ↗
(doc, change, from, to)

Source from the content-addressed store, hash-verified

8001
8002 // Used to store marked span information in the history.
8003 function attachLocalSpans(doc, change, from, to) {
8004 var existing = change["spans_" + doc.id], n = 0;
8005 doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
8006 if (line.markedSpans)
8007 (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
8008 ++n;
8009 });
8010 }
8011
8012 // When un/re-doing restores text containing marked spans, those
8013 // that have been explicitly cleared should not be restored.

Callers 1

historyChangeFromChangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected