(doc, change, ignoreReadOnly)
| 3294 | // Apply a change to a document, and add it to the document's |
| 3295 | // history, and propagating it to all linked documents. |
| 3296 | function makeChange(doc, change, ignoreReadOnly) { |
| 3297 | if (doc.cm) { |
| 3298 | if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); |
| 3299 | if (doc.cm.state.suppressEdits) return; |
| 3300 | } |
| 3301 | |
| 3302 | if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { |
| 3303 | change = filterChange(doc, change, true); |
| 3304 | if (!change) return; |
| 3305 | } |
| 3306 | |
| 3307 | // Possibly split or suppress the update based on the presence |
| 3308 | // of read-only spans in its range. |
| 3309 | var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); |
| 3310 | if (split) { |
| 3311 | for (var i = split.length - 1; i >= 0; --i) |
| 3312 | makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); |
| 3313 | } else { |
| 3314 | makeChangeInner(doc, change); |
| 3315 | } |
| 3316 | } |
| 3317 | |
| 3318 | function makeChangeInner(doc, change) { |
| 3319 | if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; |
no test coverage detected
searching dependent graphs…