| 6679 | // When un/re-doing restores text containing marked spans, those |
| 6680 | // that have been explicitly cleared should not be restored. |
| 6681 | function removeClearedSpans(spans) { |
| 6682 | if (!spans) return null; |
| 6683 | for (var i = 0, out; i < spans.length; ++i) { |
| 6684 | if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } |
| 6685 | else if (out) out.push(spans[i]); |
| 6686 | } |
| 6687 | return !out ? spans : out.length ? out : null; |
| 6688 | } |
| 6689 | |
| 6690 | // Retrieve and filter the old marked spans stored in a change event. |
| 6691 | function getOldSpans(doc, change) { |