(doc, change, ignoreReadOnly)
| 4379 | // Apply a change to a document, and add it to the document's |
| 4380 | // history, and propagating it to all linked documents. |
| 4381 | function makeChange(doc, change, ignoreReadOnly) { |
| 4382 | if (doc.cm) { |
| 4383 | if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); |
| 4384 | if (doc.cm.state.suppressEdits) return; |
| 4385 | } |
| 4386 | |
| 4387 | if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { |
| 4388 | change = filterChange(doc, change, true); |
| 4389 | if (!change) return; |
| 4390 | } |
| 4391 | |
| 4392 | // Possibly split or suppress the update based on the presence |
| 4393 | // of read-only spans in its range. |
| 4394 | var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); |
| 4395 | if (split) { |
| 4396 | for (var i = split.length - 1; i >= 0; --i) |
| 4397 | makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); |
| 4398 | } else { |
| 4399 | makeChangeInner(doc, change); |
| 4400 | } |
| 4401 | } |
| 4402 | |
| 4403 | function makeChangeInner(doc, change) { |
| 4404 | if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; |
no test coverage detected