MCPcopy Create free account
hub / github.com/breck7/scroll / removeClearedSpans

Function removeClearedSpans

external/.scrollLibs.js:6765–6780  ·  view source on GitHub ↗
(spans)

Source from the content-addressed store, hash-verified

6763 // When un/re-doing restores text containing marked spans, those
6764 // that have been explicitly cleared should not be restored.
6765 function removeClearedSpans(spans) {
6766 if (!spans) {
6767 return null
6768 }
6769 var out
6770 for (var i = 0; i < spans.length; ++i) {
6771 if (spans[i].marker.explicitlyCleared) {
6772 if (!out) {
6773 out = spans.slice(0, i)
6774 }
6775 } else if (out) {
6776 out.push(spans[i])
6777 }
6778 }
6779 return !out ? spans : out.length ? out : null
6780 }
6781
6782 // Retrieve and filter the old marked spans stored in a change event.
6783 function getOldSpans(doc, change) {

Callers 1

getOldSpansFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected