mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-02 10:18:42 +00:00
Merge commit '457fe16f9c31d08fbb6f3493f17105aac2638e86' into block-notes
This commit is contained in:
@@ -17,18 +17,22 @@ export type InvenTreeHotkeyItem = [
|
||||
HotkeyItemOptions?
|
||||
];
|
||||
|
||||
export function useInvenTreeHotkeys(hotkeys: InvenTreeHotkeyItem[]) {
|
||||
// Register the hotkeys using the Mantine hook
|
||||
useHotkeys(
|
||||
hotkeys.map(([key, _, handler, options]) => [key, handler, options])
|
||||
);
|
||||
|
||||
// register to helper state to store hotkeys
|
||||
// This allows us to display the hotkeys in the UI
|
||||
const keyelems: [string, string][] = hotkeys.map(([key, description]) => [
|
||||
export function useInvenTreeHotkeys(_keys: InvenTreeHotkeyItem[]) {
|
||||
const keyelems: [string, string][] = _keys.map(([key, description]) => [
|
||||
key,
|
||||
description
|
||||
]);
|
||||
|
||||
const mappedHotkeys: [
|
||||
string,
|
||||
(event: KeyboardEvent) => void,
|
||||
HotkeyItemOptions?
|
||||
][] = _keys.map(([key, _, handler, options]) => [key, handler, options]);
|
||||
// Register the hotkeys using the Mantine hook
|
||||
useHotkeys(mappedHotkeys);
|
||||
|
||||
// register to helper state to store hotkeys
|
||||
// This allows us to display the hotkeys in the UI
|
||||
useEffect(() => {
|
||||
useLocalLibState.getState().addHotkeys(keyelems);
|
||||
return () =>
|
||||
|
||||
@@ -17,6 +17,7 @@ export type PanelType = {
|
||||
disabled?: boolean;
|
||||
showHeadline?: boolean;
|
||||
supportsDirty?: boolean;
|
||||
hotkey?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user