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