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

Function addEditorMethods

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

Source from the content-addressed store, hash-verified

11289 // convenience.
11290
11291 function addEditorMethods(CodeMirror) {
11292 var optionHandlers = CodeMirror.optionHandlers
11293
11294 var helpers = (CodeMirror.helpers = {})
11295
11296 CodeMirror.prototype = {
11297 constructor: CodeMirror,
11298 focus: function () {
11299 window.focus()
11300 this.display.input.focus()
11301 },
11302
11303 setOption: function (option, value) {
11304 var options = this.options,
11305 old = options[option]
11306 if (options[option] == value && option != "mode") {
11307 return
11308 }
11309 options[option] = value
11310 if (optionHandlers.hasOwnProperty(option)) {
11311 operation(this, optionHandlers[option])(this, value, old)
11312 }
11313 signal(this, "optionChange", this, option)
11314 },
11315
11316 getOption: function (option) {
11317 return this.options[option]
11318 },
11319 getDoc: function () {
11320 return this.doc
11321 },
11322
11323 addKeyMap: function (map$$1, bottom) {
11324 this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1))
11325 },
11326 removeKeyMap: function (map$$1) {
11327 var maps = this.state.keyMaps
11328 for (var i = 0; i < maps.length; ++i) {
11329 if (maps[i] == map$$1 || maps[i].name == map$$1) {
11330 maps.splice(i, 1)
11331 return true
11332 }
11333 }
11334 },
11335
11336 addOverlay: methodOp(function (spec, options) {
11337 var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)
11338 if (mode.startState) {
11339 throw new Error("Overlays may not be stateful.")
11340 }
11341 insertSorted(this.state.overlays, { mode: mode, modeSpec: spec, opaque: options && options.opaque, priority: (options && options.priority) || 0 }, function (overlay) {
11342 return overlay.priority
11343 })
11344 this.state.modeGen++
11345 regChange(this)
11346 }),
11347 removeOverlay: methodOp(function (spec) {
11348 var this$1 = this

Callers 1

.scrollLibs.jsFile · 0.85

Calls 15

operationFunction · 0.85
signalFunction · 0.85
getKeyMapFunction · 0.85
methodOpFunction · 0.85
insertSortedFunction · 0.85
regChangeFunction · 0.85
isLineFunction · 0.85
indentLineFunction · 0.85
replaceOneSelectionFunction · 0.85
ensureCursorVisibleFunction · 0.85
takeTokenFunction · 0.85
PosFunction · 0.85

Tested by

no test coverage detected