MCPcopy
hub / github.com/witheve/Eve / makeChange

Function makeChange

src/codemirror.js:4381–4401  ·  view source on GitHub ↗
(doc, change, ignoreReadOnly)

Source from the content-addressed store, hash-verified

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;

Callers 4

applyTextInputFunction · 0.85
loadFileFunction · 0.85
replaceRangeFunction · 0.85
codemirror.jsFile · 0.85

Calls 5

operationFunction · 0.85
hasHandlerFunction · 0.85
filterChangeFunction · 0.85
removeReadOnlyRangesFunction · 0.85
makeChangeInnerFunction · 0.85

Tested by

no test coverage detected