Use physical keys for voice message shortcut

This commit is contained in:
Fedor Indutny 2021-09-29 15:21:51 -07:00 committed by GitHub
parent 3e31a7405b
commit 1f0e38f649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,8 @@
import { useEffect } from 'react';
import { get } from 'lodash';
import * as KeyboardLayout from '../services/keyboardLayout';
type KeyboardShortcutHandlerType = (ev: KeyboardEvent) => boolean;
function isCmdOrCtrl(ev: KeyboardEvent): boolean {
@ -17,7 +19,9 @@ export function getStartRecordingShortcut(
startAudioRecording: () => unknown
): KeyboardShortcutHandlerType {
return ev => {
const { key, shiftKey } = ev;
const { shiftKey } = ev;
const key = KeyboardLayout.lookup(ev);
if (isCmdOrCtrl(ev) && shiftKey && (key === 'v' || key === 'V')) {
startAudioRecording();