Add hotkey to close reader
This commit is contained in:
@@ -82,6 +82,7 @@ export const ReaderHotkeys = ({
|
|||||||
} = ReaderService.useSettings();
|
} = ReaderService.useSettings();
|
||||||
const automaticScrolling = useReaderAutoScrollContext();
|
const automaticScrolling = useReaderAutoScrollContext();
|
||||||
const { setShowPreview } = useReaderTapZoneContext();
|
const { setShowPreview } = useReaderTapZoneContext();
|
||||||
|
const exitReader = ReaderService.useExit();
|
||||||
|
|
||||||
const openChapter = ReaderControls.useOpenChapter();
|
const openChapter = ReaderControls.useOpenChapter();
|
||||||
const openPage = ReaderControls.useOpenPage();
|
const openPage = ReaderControls.useOpenPage();
|
||||||
@@ -216,6 +217,7 @@ export const ReaderHotkeys = ({
|
|||||||
}),
|
}),
|
||||||
[updateSetting, autoScroll.value],
|
[updateSetting, autoScroll.value],
|
||||||
);
|
);
|
||||||
|
useHotkeys(hotkeys[ReaderHotkey.EXIT_READER], exitReader, [exitReader]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
enableScope(HotkeyScope.READER);
|
enableScope(HotkeyScope.READER);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const READER_HOTKEY_TO_TITLE: Record<ReaderHotkey, TranslationKey> = {
|
|||||||
[ReaderHotkey.TOGGLE_AUTO_SCROLL]: 'reader.settings.hotkey.auto_scroll',
|
[ReaderHotkey.TOGGLE_AUTO_SCROLL]: 'reader.settings.hotkey.auto_scroll',
|
||||||
[ReaderHotkey.AUTO_SCROLL_SPEED_INCREASE]: 'reader.settings.hotkey.auto_scroll_speed_increase',
|
[ReaderHotkey.AUTO_SCROLL_SPEED_INCREASE]: 'reader.settings.hotkey.auto_scroll_speed_increase',
|
||||||
[ReaderHotkey.AUTO_SCROLL_SPEED_DECREASE]: 'reader.settings.hotkey.auto_scroll_speed_decrease',
|
[ReaderHotkey.AUTO_SCROLL_SPEED_DECREASE]: 'reader.settings.hotkey.auto_scroll_speed_decrease',
|
||||||
|
[ReaderHotkey.EXIT_READER]: 'reader.button.exit',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ReaderSettingHotkey = ({
|
export const ReaderSettingHotkey = ({
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ export const DEFAULT_READER_SETTINGS: IReaderSettings = {
|
|||||||
[ReaderHotkey.TOGGLE_AUTO_SCROLL]: ['space'],
|
[ReaderHotkey.TOGGLE_AUTO_SCROLL]: ['space'],
|
||||||
[ReaderHotkey.AUTO_SCROLL_SPEED_INCREASE]: ['b'],
|
[ReaderHotkey.AUTO_SCROLL_SPEED_INCREASE]: ['b'],
|
||||||
[ReaderHotkey.AUTO_SCROLL_SPEED_DECREASE]: ['v'],
|
[ReaderHotkey.AUTO_SCROLL_SPEED_DECREASE]: ['v'],
|
||||||
|
[ReaderHotkey.EXIT_READER]: ['c'],
|
||||||
},
|
},
|
||||||
imagePreLoadAmount: 5,
|
imagePreLoadAmount: 5,
|
||||||
shouldUseAutoWebtoonMode: true,
|
shouldUseAutoWebtoonMode: true,
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ export enum ReaderHotkey {
|
|||||||
TOGGLE_AUTO_SCROLL,
|
TOGGLE_AUTO_SCROLL,
|
||||||
AUTO_SCROLL_SPEED_INCREASE,
|
AUTO_SCROLL_SPEED_INCREASE,
|
||||||
AUTO_SCROLL_SPEED_DECREASE,
|
AUTO_SCROLL_SPEED_DECREASE,
|
||||||
|
EXIT_READER,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ReaderPagerProps
|
export interface ReaderPagerProps
|
||||||
|
|||||||
Reference in New Issue
Block a user