MCPcopy Create free account
hub / github.com/feiyu563/PrometheusAlert / CodeMirror

Function CodeMirror

static/plugins/codemirror/codemirror.js:7885–7954  ·  view source on GitHub ↗
(place, options)

Source from the content-addressed store, hash-verified

7883 // that user code is usually dealing with.
7884
7885 function CodeMirror(place, options) {
7886 var this$1 = this;
7887
7888 if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
7889
7890 this.options = options = options ? copyObj(options) : {};
7891 // Determine effective options based on given values and defaults.
7892 copyObj(defaults, options, false);
7893
7894 var doc = options.value;
7895 if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
7896 else if (options.mode) { doc.modeOption = options.mode; }
7897 this.doc = doc;
7898
7899 var input = new CodeMirror.inputStyles[options.inputStyle](this);
7900 var display = this.display = new Display(place, doc, input, options);
7901 display.wrapper.CodeMirror = this;
7902 themeChanged(this);
7903 if (options.lineWrapping)
7904 { this.display.wrapper.className += " CodeMirror-wrap"; }
7905 initScrollbars(this);
7906
7907 this.state = {
7908 keyMaps: [], // stores maps added by addKeyMap
7909 overlays: [], // highlighting overlays, as added by addOverlay
7910 modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
7911 overwrite: false,
7912 delayingBlurEvent: false,
7913 focused: false,
7914 suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
7915 pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
7916 selectingText: false,
7917 draggingText: false,
7918 highlight: new Delayed(), // stores highlight worker timeout
7919 keySeq: null, // Unfinished key sequence
7920 specialChars: null
7921 };
7922
7923 if (options.autofocus && !mobile) { display.input.focus(); }
7924
7925 // Override magic textarea content restore that IE sometimes does
7926 // on our hidden textarea on reload
7927 if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
7928
7929 registerEventHandlers(this);
7930 ensureGlobalHandlers();
7931
7932 startOperation(this);
7933 this.curOp.forceUpdate = true;
7934 attachDoc(this, doc);
7935
7936 if ((options.autofocus && !mobile) || this.hasFocus())
7937 { setTimeout(function () {
7938 if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }
7939 }, 20); }
7940 else
7941 { onBlur(this); }
7942

Callers 2

fromTextAreaFunction · 0.85
merge.jsFile · 0.85

Calls 11

themeChangedFunction · 0.85
initScrollbarsFunction · 0.85
registerEventHandlersFunction · 0.85
ensureGlobalHandlersFunction · 0.85
startOperationFunction · 0.85
attachDocFunction · 0.85
endOperationFunction · 0.85
copyObjFunction · 0.70
onFocusFunction · 0.70
onBlurFunction · 0.70

Tested by

no test coverage detected