Prevent default action on hotkey by default
This commit is contained in:
@@ -33,7 +33,7 @@ import {
|
||||
|
||||
const useHotkeys = (...args: Parameters<typeof useHotKeysHook>): ReturnType<typeof useHotKeysHook> => {
|
||||
const [keys, callback, options, dependencies] = args;
|
||||
return useHotKeysHook(keys, callback, { ...options, ...HOTKEY_SCOPES.reader }, dependencies);
|
||||
return useHotKeysHook(keys, callback, { preventDefault: true, ...options, ...HOTKEY_SCOPES.reader }, dependencies);
|
||||
};
|
||||
|
||||
const updateSettingCycleThrough = <Setting extends keyof IReaderSettings>(
|
||||
@@ -73,9 +73,7 @@ export const ReaderHotkeys = ({
|
||||
|
||||
useHotkeys(hotkeys[ReaderHotkey.PREVIOUS_PAGE], () => ReaderControls.openPage('previous'));
|
||||
useHotkeys(hotkeys[ReaderHotkey.NEXT_PAGE], () => ReaderControls.openPage('next'));
|
||||
useHotkeys(
|
||||
hotkeys[ReaderHotkey.SCROLL_BACKWARD],
|
||||
() => {
|
||||
useHotkeys(hotkeys[ReaderHotkey.SCROLL_BACKWARD], () => {
|
||||
const autoScroll = getReaderAutoScrollStore();
|
||||
const { readingMode, readingDirection, scrollAmount } = getReaderSettingsStore();
|
||||
|
||||
@@ -97,12 +95,8 @@ export const ReaderHotkeys = ({
|
||||
getReaderTapZoneStore().setShowPreview,
|
||||
scrollAmount,
|
||||
);
|
||||
},
|
||||
{ preventDefault: true },
|
||||
);
|
||||
useHotkeys(
|
||||
hotkeys[ReaderHotkey.SCROLL_FORWARD],
|
||||
() => {
|
||||
});
|
||||
useHotkeys(hotkeys[ReaderHotkey.SCROLL_FORWARD], () => {
|
||||
const autoScroll = getReaderAutoScrollStore();
|
||||
const { readingMode, readingDirection, scrollAmount } = getReaderSettingsStore();
|
||||
|
||||
@@ -124,9 +118,7 @@ export const ReaderHotkeys = ({
|
||||
getReaderTapZoneStore().setShowPreview,
|
||||
scrollAmount,
|
||||
);
|
||||
},
|
||||
{ preventDefault: true },
|
||||
);
|
||||
});
|
||||
useHotkeys(
|
||||
hotkeys[ReaderHotkey.PREVIOUS_CHAPTER],
|
||||
() => ReaderControls.openChapter(getOptionForDirection('previous', 'next', readerThemeDirection)),
|
||||
@@ -180,9 +172,7 @@ export const ReaderHotkeys = ({
|
||||
true,
|
||||
);
|
||||
});
|
||||
useHotkeys(hotkeys[ReaderHotkey.TOGGLE_AUTO_SCROLL], () => getReaderAutoScrollStore().toggleActive(), {
|
||||
preventDefault: true,
|
||||
});
|
||||
useHotkeys(hotkeys[ReaderHotkey.TOGGLE_AUTO_SCROLL], () => getReaderAutoScrollStore().toggleActive(), {});
|
||||
useHotkeys(hotkeys[ReaderHotkey.AUTO_SCROLL_SPEED_DECREASE], () =>
|
||||
ReaderService.updateSetting('autoScroll', {
|
||||
...getReaderSettingsStore().autoScroll,
|
||||
|
||||
Reference in New Issue
Block a user