wrap useHotkeys to disable on command palette open (#1925)

This commit is contained in:
jeffvli
2026-04-28 19:31:41 -07:00
parent 8eab9edb15
commit f5eb3f1488
13 changed files with 35 additions and 11 deletions
+1
View File
@@ -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';
+23
View File
@@ -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;