MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / handleKeypress

Function handleKeypress

src/components/inputhints/index.js:88–98  ·  view source on GitHub ↗

* Handle keypress event * @param {KeyboardEvent} e Event

(e)

Source from the content-addressed store, hash-verified

86 * @param {KeyboardEvent} e Event
87 */
88 function handleKeypress(e) {
89 if (e.key !== "Enter") return;
90
91 e.preventDefault();
92 e.stopPropagation();
93 const activeHint = $ul.get(".active");
94 if (!activeHint) return;
95 const value = activeHint.getAttribute("value");
96 if (onSelect) onSelect(value);
97 else $input.value = value;
98 }
99
100 /**
101 * Handle keydown event

Callers

nothing calls this directly

Calls 4

onSelectFunction · 0.85
preventDefaultMethod · 0.45
stopPropagationMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected