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

Function attachLocalSpans

static/editor.md/lib/codemirror/lib/codemirror.js:7772–7779  ·  view source on GitHub ↗
(doc, change, from, to)

Source from the content-addressed store, hash-verified

7770
7771 // Used to store marked span information in the history.
7772 function attachLocalSpans(doc, change, from, to) {
7773 var existing = change["spans_" + doc.id], n = 0;
7774 doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
7775 if (line.markedSpans)
7776 (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
7777 ++n;
7778 });
7779 }
7780
7781 // When un/re-doing restores text containing marked spans, those
7782 // that have been explicitly cleared should not be restored.

Callers 1

historyChangeFromChangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected