MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / lookupKey

Function lookupKey

lib/web/CodeMirror/src/input/keymap.js:102–117  ·  view source on GitHub ↗
(key, map, handle, context)

Source from the content-addressed store, hash-verified

100}
101
102export function lookupKey(key, map, handle, context) {
103 map = getKeyMap(map)
104 let found = map.call ? map.call(key, context) : map[key]
105 if (found === false) return "nothing"
106 if (found === "...") return "multi"
107 if (found != null && handle(found)) return "handled"
108
109 if (map.fallthrough) {
110 if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
111 return lookupKey(key, map.fallthrough, handle, context)
112 for (let i = 0; i < map.fallthrough.length; i++) {
113 let result = lookupKey(key, map.fallthrough[i], handle, context)
114 if (result) return result
115 }
116 }
117}
118
119// Modifier key presses don't count as 'real' key presses for the
120// purpose of keymap fallthrough.

Callers 1

lookupKeyForEditorFunction · 0.90

Calls 2

getKeyMapFunction · 0.70
callMethod · 0.45

Tested by

no test coverage detected