(doc, change, ignoreReadOnly)
| 4356 | // Apply a change to a document, and add it to the document's |
| 4357 | // history, and propagating it to all linked documents. |
| 4358 | function makeChange(doc, change, ignoreReadOnly) { |
| 4359 | if (doc.cm) { |
| 4360 | if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); |
| 4361 | if (doc.cm.state.suppressEdits) return; |
| 4362 | } |
| 4363 | |
| 4364 | if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { |
| 4365 | change = filterChange(doc, change, true); |
| 4366 | if (!change) return; |
| 4367 | } |
| 4368 | |
| 4369 | // Possibly split or suppress the update based on the presence |
| 4370 | // of read-only spans in its range. |
| 4371 | var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); |
| 4372 | if (split) { |
| 4373 | for (var i = split.length - 1; i >= 0; --i) |
| 4374 | makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); |
| 4375 | } else { |
| 4376 | makeChangeInner(doc, change); |
| 4377 | } |
| 4378 | } |
| 4379 | |
| 4380 | function makeChangeInner(doc, change) { |
| 4381 | if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; |
no test coverage detected