mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-10 22:32:17 +02:00
add physical key mapping for useHotkeys to support alt keyboard languages (#2051)
This commit is contained in:
@@ -2,8 +2,10 @@ import {
|
||||
type HotkeyItem as MantineHotkeyItem,
|
||||
useHotkeys as useMantineHotkeys,
|
||||
} from '@mantine/hooks';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { useAppStore } from '/@/renderer/store';
|
||||
import { withPhysicalKeys } from '/@/shared/utils/hotkeys';
|
||||
|
||||
const EMPTY_HOTKEYS: MantineHotkeyItem[] = [];
|
||||
|
||||
@@ -13,8 +15,10 @@ export const useHotkeys = (
|
||||
triggerOnContentEditable?: boolean,
|
||||
) => {
|
||||
const commandPaletteOpened = useAppStore((state) => state.commandPalette.opened);
|
||||
const physicalHotkeys = useMemo(() => withPhysicalKeys(hotkeys), [hotkeys]);
|
||||
|
||||
useMantineHotkeys(
|
||||
commandPaletteOpened ? EMPTY_HOTKEYS : hotkeys,
|
||||
commandPaletteOpened ? EMPTY_HOTKEYS : physicalHotkeys,
|
||||
tagsToIgnore,
|
||||
triggerOnContentEditable,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user