MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / Doc

Function Doc

static/libs/codemirror.js:6021–6043  ·  view source on GitHub ↗
(text, mode, firstLine, lineSep, direction)

Source from the content-addressed store, hash-verified

6019
6020var nextDocId = 0;
6021var Doc = function(text, mode, firstLine, lineSep, direction) {
6022 if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
6023 if (firstLine == null) { firstLine = 0; }
6024
6025 BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
6026 this.first = firstLine;
6027 this.scrollTop = this.scrollLeft = 0;
6028 this.cantEdit = false;
6029 this.cleanGeneration = 1;
6030 this.modeFrontier = this.highlightFrontier = firstLine;
6031 var start = Pos(firstLine, 0);
6032 this.sel = simpleSelection(start);
6033 this.history = new History(null);
6034 this.id = ++nextDocId;
6035 this.modeOption = mode;
6036 this.lineSep = lineSep;
6037 this.direction = (direction == "rtl") ? "rtl" : "ltr";
6038 this.extend = false;
6039
6040 if (typeof text == "string") { text = this.splitLines(text); }
6041 updateDoc(this, {from: start, to: start, text: text});
6042 setSelection(this, simpleSelection(start), sel_dontScroll);
6043};
6044
6045Doc.prototype = createObj(BranchChunk.prototype, {
6046 constructor: Doc,

Callers

nothing calls this directly

Calls 4

PosFunction · 0.85
simpleSelectionFunction · 0.85
updateDocFunction · 0.85
setSelectionFunction · 0.85

Tested by

no test coverage detected