(doc, change, ignoreReadOnly)
| 3258 | // Apply a change to a document, and add it to the document's |
| 3259 | // history, and propagating it to all linked documents. |
| 3260 | function makeChange(doc, change, ignoreReadOnly) { |
| 3261 | if (doc.cm) { |
| 3262 | if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); |
| 3263 | if (doc.cm.state.suppressEdits) return; |
| 3264 | } |
| 3265 | |
| 3266 | if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { |
| 3267 | change = filterChange(doc, change, true); |
| 3268 | if (!change) return; |
| 3269 | } |
| 3270 | |
| 3271 | // Possibly split or suppress the update based on the presence |
| 3272 | // of read-only spans in its range. |
| 3273 | var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); |
| 3274 | if (split) { |
| 3275 | for (var i = split.length - 1; i >= 0; --i) |
| 3276 | makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); |
| 3277 | } else { |
| 3278 | makeChangeInner(doc, change); |
| 3279 | } |
| 3280 | } |
| 3281 | |
| 3282 | function makeChangeInner(doc, change) { |
| 3283 | if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; |
no test coverage detected