| 7781 | // When un/re-doing restores text containing marked spans, those |
| 7782 | // that have been explicitly cleared should not be restored. |
| 7783 | function removeClearedSpans(spans) { |
| 7784 | if (!spans) return null; |
| 7785 | for (var i = 0, out; i < spans.length; ++i) { |
| 7786 | if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } |
| 7787 | else if (out) out.push(spans[i]); |
| 7788 | } |
| 7789 | return !out ? spans : out.length ? out : null; |
| 7790 | } |
| 7791 | |
| 7792 | // Retrieve and filter the old marked spans stored in a change event. |
| 7793 | function getOldSpans(doc, change) { |