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

Function attachDoc

lib/web/CodeMirror/src/model/document_data.js:90–100  ·  view source on GitHub ↗
(cm, doc)

Source from the content-addressed store, hash-verified

88
89// Attach a document to an editor.
90export function attachDoc(cm, doc) {
91 if (doc.cm) throw new Error("This document is already in use.")
92 cm.doc = doc
93 doc.cm = cm
94 estimateLineHeights(cm)
95 loadMode(cm)
96 setDirectionClass(cm)
97 if (!cm.options.lineWrapping) findMaxLine(cm)
98 cm.options.mode = doc.modeOption
99 regChange(cm)
100}
101
102function setDirectionClass(cm) {
103 ;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")

Callers 2

methods.jsFile · 0.90
CodeMirrorFunction · 0.90

Calls 5

estimateLineHeightsFunction · 0.90
loadModeFunction · 0.90
findMaxLineFunction · 0.90
regChangeFunction · 0.90
setDirectionClassFunction · 0.70

Tested by

no test coverage detected