MCPcopy Create free account
hub / github.com/danvk/webdiff / handleKeydown

Function handleKeydown

ts/DiffOptions.tsx:77–84  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

75
76 React.useEffect(() => {
77 const handleKeydown = (e: KeyboardEvent) => {
78 if (!isLegitKeypress(e)) return;
79 if (e.code == 'KeyW') {
80 updateOptions(options => ({ignoreAllSpace: !options.ignoreAllSpace}));
81 } else if (e.code == 'KeyB') {
82 updateOptions(options => ({ignoreSpaceChange: !options.ignoreSpaceChange}));
83 }
84 };
85 document.addEventListener('keydown', handleKeydown);
86 return () => {
87 document.removeEventListener('keydown', handleKeydown);

Callers

nothing calls this directly

Calls 1

isLegitKeypressFunction · 0.90

Tested by

no test coverage detected