mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-21 01:46:32 +02:00
19 lines
555 B
TypeScript
19 lines
555 B
TypeScript
import {
|
|
type HotkeyItem as MantineHotkeyItem,
|
|
useHotkeys as useMantineHotkeys,
|
|
} from '@mantine/hooks';
|
|
import { useMemo } from 'react';
|
|
|
|
import { withPhysicalKeys } from '/@/shared/utils/hotkeys';
|
|
|
|
export const useHotkeys = (
|
|
hotkeys: MantineHotkeyItem[],
|
|
tagsToIgnore?: string[],
|
|
triggerOnContentEditable?: boolean,
|
|
) => {
|
|
const physicalHotkeys = useMemo(() => withPhysicalKeys(hotkeys), [hotkeys]);
|
|
useMantineHotkeys(physicalHotkeys, tagsToIgnore, triggerOnContentEditable);
|
|
};
|
|
|
|
export type HotkeyItem = MantineHotkeyItem;
|