MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / onKeyPress

Function onKeyPress

static/js/codemirror/codemirror.js:1945–1958  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1943 }
1944
1945 function onKeyPress(e) {
1946 var cm = this;
1947 if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
1948 var keyCode = e.keyCode, charCode = e.charCode;
1949 if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
1950 if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
1951 var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
1952 if (this.options.electricChars && this.doc.mode.electricChars &&
1953 this.options.smartIndent && !isReadOnly(this) &&
1954 this.doc.mode.electricChars.indexOf(ch) > -1)
1955 setTimeout(operation(cm, function() {indentLine(cm, cm.doc.sel.to.line, "smart");}), 75);
1956 if (handleCharBinding(cm, e, ch)) return;
1957 fastPoll(cm);
1958 }
1959
1960 function onFocus(cm) {
1961 if (cm.options.readOnly == "nocursor") return;

Callers

nothing calls this directly

Calls 8

addStopFunction · 0.85
e_preventDefaultFunction · 0.85
handleKeyBindingFunction · 0.85
isReadOnlyFunction · 0.85
operationFunction · 0.85
indentLineFunction · 0.85
handleCharBindingFunction · 0.85
fastPollFunction · 0.85

Tested by

no test coverage detected