(e: KeyboardEvent)
| 81 | // TODO: switch to useKey() or some such |
| 82 | React.useEffect(() => { |
| 83 | const handleKeydown = (e: KeyboardEvent) => { |
| 84 | if (!isLegitKeypress(e)) return; |
| 85 | if (e.code == 'KeyS') { |
| 86 | changeImageDiffMode('side-by-side'); |
| 87 | } else if (e.code == 'KeyB') { |
| 88 | changeImageDiffMode('blink'); |
| 89 | } else if (e.code == 'KeyP') { |
| 90 | changePDiffMode(mode => PDIFF_MODES[(PDIFF_MODES.indexOf(mode) + 1) % 3]); |
| 91 | } |
| 92 | }; |
| 93 | document.addEventListener('keydown', handleKeydown); |
| 94 | return () => { |
| 95 | document.removeEventListener('keydown', handleKeydown); |
nothing calls this directly
no test coverage detected