(doc, change, ignoreReadOnly)
| 7137 | // Apply a change to a document, and add it to the document's |
| 7138 | // history, and propagating it to all linked documents. |
| 7139 | function makeChange(doc, change, ignoreReadOnly) { |
| 7140 | if (doc.cm) { |
| 7141 | if (!doc.cm.curOp) { |
| 7142 | return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) |
| 7143 | } |
| 7144 | if (doc.cm.state.suppressEdits) { |
| 7145 | return |
| 7146 | } |
| 7147 | } |
| 7148 | |
| 7149 | if (hasHandler(doc, "beforeChange") || (doc.cm && hasHandler(doc.cm, "beforeChange"))) { |
| 7150 | change = filterChange(doc, change, true) |
| 7151 | if (!change) { |
| 7152 | return |
| 7153 | } |
| 7154 | } |
| 7155 | |
| 7156 | // Possibly split or suppress the update based on the presence |
| 7157 | // of read-only spans in its range. |
| 7158 | var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to) |
| 7159 | if (split) { |
| 7160 | for (var i = split.length - 1; i >= 0; --i) { |
| 7161 | makeChangeInner(doc, { from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin }) |
| 7162 | } |
| 7163 | } else { |
| 7164 | makeChangeInner(doc, change) |
| 7165 | } |
| 7166 | } |
| 7167 | |
| 7168 | function makeChangeInner(doc, change) { |
| 7169 | if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { |
no test coverage detected