Use physical keys for voice message shortcut
This commit is contained in:
parent
3e31a7405b
commit
1f0e38f649
1 changed files with 5 additions and 1 deletions
|
@ -4,6 +4,8 @@
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
|
|
||||||
|
import * as KeyboardLayout from '../services/keyboardLayout';
|
||||||
|
|
||||||
type KeyboardShortcutHandlerType = (ev: KeyboardEvent) => boolean;
|
type KeyboardShortcutHandlerType = (ev: KeyboardEvent) => boolean;
|
||||||
|
|
||||||
function isCmdOrCtrl(ev: KeyboardEvent): boolean {
|
function isCmdOrCtrl(ev: KeyboardEvent): boolean {
|
||||||
|
@ -17,7 +19,9 @@ export function getStartRecordingShortcut(
|
||||||
startAudioRecording: () => unknown
|
startAudioRecording: () => unknown
|
||||||
): KeyboardShortcutHandlerType {
|
): KeyboardShortcutHandlerType {
|
||||||
return ev => {
|
return ev => {
|
||||||
const { key, shiftKey } = ev;
|
const { shiftKey } = ev;
|
||||||
|
|
||||||
|
const key = KeyboardLayout.lookup(ev);
|
||||||
|
|
||||||
if (isCmdOrCtrl(ev) && shiftKey && (key === 'v' || key === 'V')) {
|
if (isCmdOrCtrl(ev) && shiftKey && (key === 'v' || key === 'V')) {
|
||||||
startAudioRecording();
|
startAudioRecording();
|
||||||
|
|
Loading…
Reference in a new issue