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

Function handleKeyBinding

static/mergely/lib/codemirror.js:4138–4154  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

4136
4137 // Handle a key from the keydown event.
4138 function handleKeyBinding(cm, e) {
4139 var name = keyName(e, true);
4140 if (!name) return false;
4141
4142 if (e.shiftKey && !cm.state.keySeq) {
4143 // First try to resolve full name (including 'Shift-'). Failing
4144 // that, see if there is a cursor-motion command (starting with
4145 // 'go') bound to the keyname without 'Shift-'.
4146 return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);})
4147 || dispatchKey(cm, name, e, function(b) {
4148 if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
4149 return doHandleBinding(cm, b);
4150 });
4151 } else {
4152 return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });
4153 }
4154 }
4155
4156 // Handle a key from the keypress event
4157 function handleCharBinding(cm, e, ch) {

Callers 2

onKeyDownFunction · 0.70
onKeyPressFunction · 0.70

Calls 2

dispatchKeyFunction · 0.70
doHandleBindingFunction · 0.70

Tested by

no test coverage detected