MCPcopy Create free account
hub / github.com/TruthHun/BookStack / onKeyDown

Function onKeyDown

static/editor.md/lib/codemirror/lib/codemirror.js:3999–4018  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

3997
3998 var lastStoppedKey = null;
3999 function onKeyDown(e) {
4000 var cm = this;
4001 ensureFocus(cm);
4002 if (signalDOMEvent(cm, e)) return;
4003 // IE does strange things with escape.
4004 if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;
4005 var code = e.keyCode;
4006 cm.display.shift = code == 16 || e.shiftKey;
4007 var handled = handleKeyBinding(cm, e);
4008 if (presto) {
4009 lastStoppedKey = handled ? code : null;
4010 // Opera has no cut event... we try to at least catch the key combo
4011 if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
4012 cm.replaceSelection("", null, "cut");
4013 }
4014
4015 // Turn mouse into crosshair when Alt is held on Mac.
4016 if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
4017 showCrossHair(cm);
4018 }
4019
4020 function showCrossHair(cm) {
4021 var lineDiv = cm.display.lineDiv;

Callers

nothing calls this directly

Calls 4

ensureFocusFunction · 0.70
signalDOMEventFunction · 0.70
handleKeyBindingFunction · 0.70
showCrossHairFunction · 0.70

Tested by

no test coverage detected