Support "produced characters" as hotkeys
"Produced characters" were not supported as hotkeys. I.e., using "!" as a hotkey was not possible.
This commit is contained in:
24
src/lib/react-hotkeys-hook/useHotkeys.ts
Normal file
24
src/lib/react-hotkeys-hook/useHotkeys.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
// oxlint-disable-next-line no-restricted-imports
|
||||
import { useHotkeys as orgUseHotkeys } from 'react-hotkeys-hook';
|
||||
|
||||
export const useHotkeys = (...args: Parameters<typeof orgUseHotkeys>): ReturnType<typeof orgUseHotkeys> => {
|
||||
const [keys, callback, options, dependencies] = args;
|
||||
return orgUseHotkeys(
|
||||
keys,
|
||||
callback,
|
||||
{
|
||||
preventDefault: true,
|
||||
useKey: true,
|
||||
...options,
|
||||
},
|
||||
dependencies,
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user