MCPcopy
hub / github.com/DHTMLX/gantt / addEditorMethods

Function addEditorMethods

samples/common/codehighlight/codemirror.js:8226–8655  ·  view source on GitHub ↗
(CodeMirror)

Source from the content-addressed store, hash-verified

8224 // convenience.
8225
8226 function addEditorMethods(CodeMirror) {
8227 var optionHandlers = CodeMirror.optionHandlers;
8228
8229 var helpers = CodeMirror.helpers = {};
8230
8231 CodeMirror.prototype = {
8232 constructor: CodeMirror,
8233 focus: function(){window.focus(); this.display.input.focus();},
8234
8235 setOption: function(option, value) {
8236 var options = this.options, old = options[option];
8237 if (options[option] == value && option != "mode") { return }
8238 options[option] = value;
8239 if (optionHandlers.hasOwnProperty(option))
8240 { operation(this, optionHandlers[option])(this, value, old); }
8241 signal(this, "optionChange", this, option);
8242 },
8243
8244 getOption: function(option) {return this.options[option]},
8245 getDoc: function() {return this.doc},
8246
8247 addKeyMap: function(map, bottom) {
8248 this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
8249 },
8250 removeKeyMap: function(map) {
8251 var maps = this.state.keyMaps;
8252 for (var i = 0; i < maps.length; ++i)
8253 { if (maps[i] == map || maps[i].name == map) {
8254 maps.splice(i, 1);
8255 return true
8256 } }
8257 },
8258
8259 addOverlay: methodOp(function(spec, options) {
8260 var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
8261 if (mode.startState) { throw new Error("Overlays may not be stateful.") }
8262 insertSorted(this.state.overlays,
8263 {mode: mode, modeSpec: spec, opaque: options && options.opaque,
8264 priority: (options && options.priority) || 0},
8265 function (overlay) { return overlay.priority; });
8266 this.state.modeGen++;
8267 regChange(this);
8268 }),
8269 removeOverlay: methodOp(function(spec) {
8270 var overlays = this.state.overlays;
8271 for (var i = 0; i < overlays.length; ++i) {
8272 var cur = overlays[i].modeSpec;
8273 if (cur == spec || typeof spec == "string" && cur.name == spec) {
8274 overlays.splice(i, 1);
8275 this.state.modeGen++;
8276 regChange(this);
8277 return
8278 }
8279 }
8280 }),
8281
8282 indentLine: methodOp(function(n, dir, aggressive) {
8283 if (typeof dir != "string" && typeof dir != "number") {

Callers 1

codemirror.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