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

Function onKeyDown

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

Source from the content-addressed store, hash-verified

1925
1926 var lastStoppedKey = null;
1927 function onKeyDown(e) {
1928 var cm = this;
1929 if (!cm.state.focused) onFocus(cm);
1930 if (ie && e.keyCode == 27) { e.returnValue = false; }
1931 if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
1932 var code = e.keyCode;
1933 // IE does strange things with escape.
1934 cm.doc.sel.shift = code == 16 || e.shiftKey;
1935 // First give onKeyEvent option a chance to handle this.
1936 var handled = handleKeyBinding(cm, e);
1937 if (opera) {
1938 lastStoppedKey = handled ? code : null;
1939 // Opera has no cut event... we try to at least catch the key combo
1940 if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
1941 cm.replaceSelection("");
1942 }
1943 }
1944
1945 function onKeyPress(e) {
1946 var cm = this;

Callers

nothing calls this directly

Calls 3

addStopFunction · 0.85
handleKeyBindingFunction · 0.85
onFocusFunction · 0.70

Tested by

no test coverage detected