MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / Doc

Function Doc

lib/web/CodeMirror/src/model/Doc.js:23–45  ·  view source on GitHub ↗
(text, mode, firstLine, lineSep, direction)

Source from the content-addressed store, hash-verified

21
22let nextDocId = 0
23let Doc = function(text, mode, firstLine, lineSep, direction) {
24 if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep, direction)
25 if (firstLine == null) firstLine = 0
26
27 BranchChunk.call(this, [new LeafChunk([new Line("", null)])])
28 this.first = firstLine
29 this.scrollTop = this.scrollLeft = 0
30 this.cantEdit = false
31 this.cleanGeneration = 1
32 this.modeFrontier = this.highlightFrontier = firstLine
33 let start = Pos(firstLine, 0)
34 this.sel = simpleSelection(start)
35 this.history = new History(null)
36 this.id = ++nextDocId
37 this.modeOption = mode
38 this.lineSep = lineSep
39 this.direction = (direction == "rtl") ? "rtl" : "ltr"
40 this.extend = false
41
42 if (typeof text == "string") text = this.splitLines(text)
43 updateDoc(this, {from: start, to: start, text: text})
44 setSelection(this, simpleSelection(start), sel_dontScroll)
45}
46
47Doc.prototype = createObj(BranchChunk.prototype, {
48 constructor: Doc,

Callers

nothing calls this directly

Calls 5

PosFunction · 0.90
simpleSelectionFunction · 0.90
updateDocFunction · 0.90
setSelectionFunction · 0.90
callMethod · 0.45

Tested by

no test coverage detected