(doc, change, selUpdate, ignoreReadOnly)
| 2350 | // Replace the range from from to to by the strings in replacement. |
| 2351 | // change is a {from, to, text [, origin]} object |
| 2352 | function makeChange(doc, change, selUpdate, ignoreReadOnly) { |
| 2353 | if (doc.cm) { |
| 2354 | if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, selUpdate, ignoreReadOnly); |
| 2355 | if (doc.cm.state.suppressEdits) return; |
| 2356 | } |
| 2357 | |
| 2358 | if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { |
| 2359 | change = filterChange(doc, change, true); |
| 2360 | if (!change) return; |
| 2361 | } |
| 2362 | |
| 2363 | // Possibly split or suppress the update based on the presence |
| 2364 | // of read-only spans in its range. |
| 2365 | var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); |
| 2366 | if (split) { |
| 2367 | for (var i = split.length - 1; i >= 1; --i) |
| 2368 | makeChangeNoReadonly(doc, {from: split[i].from, to: split[i].to, text: [""]}); |
| 2369 | if (split.length) |
| 2370 | makeChangeNoReadonly(doc, {from: split[0].from, to: split[0].to, text: change.text}, selUpdate); |
| 2371 | } else { |
| 2372 | makeChangeNoReadonly(doc, change, selUpdate); |
| 2373 | } |
| 2374 | } |
| 2375 | |
| 2376 | function makeChangeNoReadonly(doc, change, selUpdate) { |
| 2377 | if (change.text.length == 1 && change.text[0] == "" && posEq(change.from, change.to)) return; |
no test coverage detected