| 8012 | // When un/re-doing restores text containing marked spans, those |
| 8013 | // that have been explicitly cleared should not be restored. |
| 8014 | function removeClearedSpans(spans) { |
| 8015 | if (!spans) return null; |
| 8016 | for (var i = 0, out; i < spans.length; ++i) { |
| 8017 | if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } |
| 8018 | else if (out) out.push(spans[i]); |
| 8019 | } |
| 8020 | return !out ? spans : out.length ? out : null; |
| 8021 | } |
| 8022 | |
| 8023 | // Retrieve and filter the old marked spans stored in a change event. |
| 8024 | function getOldSpans(doc, change) { |