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

Function defineOptions

external/.scrollLibs.js:10468–10741  ·  view source on GitHub ↗
(CodeMirror)

Source from the content-addressed store, hash-verified

10466 var optionHandlers = {}
10467
10468 function defineOptions(CodeMirror) {
10469 var optionHandlers = CodeMirror.optionHandlers
10470
10471 function option(name, deflt, handle, notOnInit) {
10472 CodeMirror.defaults[name] = deflt
10473 if (handle) {
10474 optionHandlers[name] = notOnInit
10475 ? function (cm, val, old) {
10476 if (old != Init) {
10477 handle(cm, val, old)
10478 }
10479 }
10480 : handle
10481 }
10482 }
10483
10484 CodeMirror.defineOption = option
10485
10486 // Passed to option handlers when there is no old value.
10487 CodeMirror.Init = Init
10488
10489 // These two are, on init, called from the constructor because they
10490 // have to be initialized before the editor can start at all.
10491 option(
10492 "value",
10493 "",
10494 function (cm, val) {
10495 return cm.setValue(val)
10496 },
10497 true
10498 )
10499 option(
10500 "mode",
10501 null,
10502 function (cm, val) {
10503 cm.doc.modeOption = val
10504 loadMode(cm)
10505 },
10506 true
10507 )
10508
10509 option("indentUnit", 2, loadMode, true)
10510 option("indentWithTabs", false)
10511 option("smartIndent", true)
10512 option(
10513 "tabSize",
10514 4,
10515 function (cm) {
10516 resetModeState(cm)
10517 clearCaches(cm)
10518 regChange(cm)
10519 },
10520 true
10521 )
10522
10523 option("lineSeparator", null, function (cm, val) {
10524 cm.doc.lineSep = val
10525 if (!val) {

Callers 1

.scrollLibs.jsFile · 0.85

Calls 15

optionFunction · 0.85
loadModeFunction · 0.85
resetModeStateFunction · 0.85
clearCachesFunction · 0.85
regChangeFunction · 0.85
PosFunction · 0.85
replaceRangeFunction · 0.85
themeChangedFunction · 0.85
guttersChangedFunction · 0.85
getKeyMapFunction · 0.85
setGuttersForLineNumbersFunction · 0.85
compensateForHScrollFunction · 0.85

Tested by

no test coverage detected