Add hotkey to close reader

This commit is contained in:
schroda
2025-03-27 01:50:36 +01:00
parent 9322ed2b8e
commit b93c2d95e5
4 changed files with 5 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ export const ReaderHotkeys = ({
} = ReaderService.useSettings();
const automaticScrolling = useReaderAutoScrollContext();
const { setShowPreview } = useReaderTapZoneContext();
const exitReader = ReaderService.useExit();
const openChapter = ReaderControls.useOpenChapter();
const openPage = ReaderControls.useOpenPage();
@@ -216,6 +217,7 @@ export const ReaderHotkeys = ({
}),
[updateSetting, autoScroll.value],
);
useHotkeys(hotkeys[ReaderHotkey.EXIT_READER], exitReader, [exitReader]);
useEffect(() => {
enableScope(HotkeyScope.READER);

View File

@@ -36,6 +36,7 @@ const READER_HOTKEY_TO_TITLE: Record<ReaderHotkey, TranslationKey> = {
[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_DECREASE]: 'reader.settings.hotkey.auto_scroll_speed_decrease',
[ReaderHotkey.EXIT_READER]: 'reader.button.exit',
};
export const ReaderSettingHotkey = ({

View File

@@ -134,6 +134,7 @@ export const DEFAULT_READER_SETTINGS: IReaderSettings = {
[ReaderHotkey.TOGGLE_AUTO_SCROLL]: ['space'],
[ReaderHotkey.AUTO_SCROLL_SPEED_INCREASE]: ['b'],
[ReaderHotkey.AUTO_SCROLL_SPEED_DECREASE]: ['v'],
[ReaderHotkey.EXIT_READER]: ['c'],
},
imagePreLoadAmount: 5,
shouldUseAutoWebtoonMode: true,

View File

@@ -260,6 +260,7 @@ export enum ReaderHotkey {
TOGGLE_AUTO_SCROLL,
AUTO_SCROLL_SPEED_INCREASE,
AUTO_SCROLL_SPEED_DECREASE,
EXIT_READER,
}
export interface ReaderPagerProps