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

Function dispatchKey

static/mergely/lib/codemirror.js:4106–4135  ·  view source on GitHub ↗
(cm, name, e, handle)

Source from the content-addressed store, hash-verified

4104
4105 var stopSeq = new Delayed;
4106 function dispatchKey(cm, name, e, handle) {
4107 var seq = cm.state.keySeq;
4108 if (seq) {
4109 if (isModifierKey(name)) return "handled";
4110 stopSeq.set(50, function() {
4111 if (cm.state.keySeq == seq) {
4112 cm.state.keySeq = null;
4113 cm.display.input.reset();
4114 }
4115 });
4116 name = seq + " " + name;
4117 }
4118 var result = lookupKeyForEditor(cm, name, handle);
4119
4120 if (result == "multi")
4121 cm.state.keySeq = name;
4122 if (result == "handled")
4123 signalLater(cm, "keyHandled", cm, name, e);
4124
4125 if (result == "handled" || result == "multi") {
4126 e_preventDefault(e);
4127 restartBlink(cm);
4128 }
4129
4130 if (seq && !result && /\'$/.test(name)) {
4131 e_preventDefault(e);
4132 return true;
4133 }
4134 return !!result;
4135 }
4136
4137 // Handle a key from the keydown event.
4138 function handleKeyBinding(cm, e) {

Callers 2

handleKeyBindingFunction · 0.70
handleCharBindingFunction · 0.70

Calls 4

lookupKeyForEditorFunction · 0.70
signalLaterFunction · 0.70
restartBlinkFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected