| 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) { |