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

Function dispatchKey

static/editor.md/lib/codemirror/lib/codemirror.js:3942–3971  ·  view source on GitHub ↗
(cm, name, e, handle)

Source from the content-addressed store, hash-verified

3940
3941 var stopSeq = new Delayed;
3942 function dispatchKey(cm, name, e, handle) {
3943 var seq = cm.state.keySeq;
3944 if (seq) {
3945 if (isModifierKey(name)) return "handled";
3946 stopSeq.set(50, function() {
3947 if (cm.state.keySeq == seq) {
3948 cm.state.keySeq = null;
3949 cm.display.input.reset();
3950 }
3951 });
3952 name = seq + " " + name;
3953 }
3954 var result = lookupKeyForEditor(cm, name, handle);
3955
3956 if (result == "multi")
3957 cm.state.keySeq = name;
3958 if (result == "handled")
3959 signalLater(cm, "keyHandled", cm, name, e);
3960
3961 if (result == "handled" || result == "multi") {
3962 e_preventDefault(e);
3963 restartBlink(cm);
3964 }
3965
3966 if (seq && !result && /\'$/.test(name)) {
3967 e_preventDefault(e);
3968 return true;
3969 }
3970 return !!result;
3971 }
3972
3973 // Handle a key from the keydown event.
3974 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