MCPcopy
hub / github.com/nwutils/nw-sample-apps / onKeyDown

Function onKeyDown

mini-code-edit/cm/lib/codemirror.js:577–593  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

575
576 var lastStoppedKey = null, maybeTransition;
577 function onKeyDown(e) {
578 if (!focused) onFocus();
579 if (ie && e.keyCode == 27) { e.returnValue = false; }
580 if (pollingFast) { if (readInput()) pollingFast = false; }
581 if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
582 var code = e_prop(e, "keyCode");
583 // IE does strange things with escape.
584 setShift(code == 16 || e_prop(e, "shiftKey"));
585 // First give onKeyEvent option a chance to handle this.
586 var handled = handleKeyBinding(e);
587 if (window.opera) {
588 lastStoppedKey = handled ? code : null;
589 // Opera has no cut event... we try to at least catch the key combo
590 if (!handled && code == 88 && e_prop(e, mac ? "metaKey" : "ctrlKey"))
591 replaceSelection("");
592 }
593 }
594 function onKeyPress(e) {
595 if (pollingFast) readInput();
596 if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;

Callers

nothing calls this directly

Calls 7

onFocusFunction · 0.85
readInputFunction · 0.85
addStopFunction · 0.85
e_propFunction · 0.85
setShiftFunction · 0.85
handleKeyBindingFunction · 0.85
replaceSelectionFunction · 0.85

Tested by

no test coverage detected