| 5298 | // HISTORY |
| 5299 | |
| 5300 | function makeHistory(startGen) { |
| 5301 | return { |
| 5302 | // Arrays of history events. Doing something adds an event to |
| 5303 | // done and clears undo. Undoing moves events from done to |
| 5304 | // undone, redoing moves them in the other direction. |
| 5305 | done: [], undone: [], undoDepth: Infinity, |
| 5306 | // Used to track when changes can be merged into a single undo |
| 5307 | // event |
| 5308 | lastTime: 0, lastOp: null, lastOrigin: null, |
| 5309 | // Used by the isClean() method |
| 5310 | generation: startGen || 1, maxGeneration: startGen || 1 |
| 5311 | }; |
| 5312 | } |
| 5313 | |
| 5314 | function attachLocalSpans(doc, change, from, to) { |
| 5315 | var existing = change["spans_" + doc.id], n = 0; |