mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-10 22:32:17 +02:00
wrap useHotkeys to disable on command palette open (#1925)
This commit is contained in:
@@ -3,5 +3,6 @@ export * from './use-check-for-updates';
|
||||
export * from './use-container-query';
|
||||
export * from './use-fast-average-color';
|
||||
export * from './use-hide-scrollbar';
|
||||
export * from './use-hotkeys';
|
||||
export * from './use-is-mounted';
|
||||
export * from './use-should-pad-titlebar';
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
type HotkeyItem as MantineHotkeyItem,
|
||||
useHotkeys as useMantineHotkeys,
|
||||
} from '@mantine/hooks';
|
||||
|
||||
import { useAppStore } from '/@/renderer/store';
|
||||
|
||||
const EMPTY_HOTKEYS: MantineHotkeyItem[] = [];
|
||||
|
||||
export const useHotkeys = (
|
||||
hotkeys: MantineHotkeyItem[],
|
||||
tagsToIgnore?: string[],
|
||||
triggerOnContentEditable?: boolean,
|
||||
) => {
|
||||
const commandPaletteOpened = useAppStore((state) => state.commandPalette.opened);
|
||||
useMantineHotkeys(
|
||||
commandPaletteOpened ? EMPTY_HOTKEYS : hotkeys,
|
||||
tagsToIgnore,
|
||||
triggerOnContentEditable,
|
||||
);
|
||||
};
|
||||
|
||||
export type HotkeyItem = MantineHotkeyItem;
|
||||
Reference in New Issue
Block a user