MCPcopy Create free account
hub / github.com/breck7/scroll / attachDoc

Function attachDoc

external/.scrollLibs.js:6578–6592  ·  view source on GitHub ↗
(cm, doc)

Source from the content-addressed store, hash-verified

6576
6577 // Attach a document to an editor.
6578 function attachDoc(cm, doc) {
6579 if (doc.cm) {
6580 throw new Error("This document is already in use.")
6581 }
6582 cm.doc = doc
6583 doc.cm = cm
6584 estimateLineHeights(cm)
6585 loadMode(cm)
6586 setDirectionClass(cm)
6587 if (!cm.options.lineWrapping) {
6588 findMaxLine(cm)
6589 }
6590 cm.options.mode = doc.modeOption
6591 regChange(cm)
6592 }
6593
6594 function setDirectionClass(cm) {
6595 ;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")

Callers 2

CodeMirrorFunction · 0.85
addEditorMethodsFunction · 0.85

Calls 5

estimateLineHeightsFunction · 0.85
loadModeFunction · 0.85
setDirectionClassFunction · 0.85
findMaxLineFunction · 0.85
regChangeFunction · 0.85

Tested by

no test coverage detected