MCPcopy Create free account
hub / github.com/sql-js/sql.js / makeChange

Function makeChange

GUI/codemirror/lib/codemirror.js:3296–3316  ·  view source on GitHub ↗
(doc, change, ignoreReadOnly)

Source from the content-addressed store, hash-verified

3294 // Apply a change to a document, and add it to the document's
3295 // history, and propagating it to all linked documents.
3296 function makeChange(doc, change, ignoreReadOnly) {
3297 if (doc.cm) {
3298 if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);
3299 if (doc.cm.state.suppressEdits) return;
3300 }
3301
3302 if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
3303 change = filterChange(doc, change, true);
3304 if (!change) return;
3305 }
3306
3307 // Possibly split or suppress the update based on the presence
3308 // of read-only spans in its range.
3309 var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
3310 if (split) {
3311 for (var i = split.length - 1; i >= 0; --i)
3312 makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text});
3313 } else {
3314 makeChangeInner(doc, change);
3315 }
3316 }
3317
3318 function makeChangeInner(doc, change) {
3319 if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return;

Callers 4

readInputFunction · 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…