Always register reader hotkeys

The hotkeys were never registered e.g. while loading or in case an error occurred
This commit is contained in:
schroda
2024-12-24 17:21:25 +01:00
parent 94b0e25df2
commit 72809309e1
2 changed files with 21 additions and 23 deletions

View File

@@ -281,6 +281,7 @@ const BaseReader = ({
status: true, status: true,
value: ( value: (
<Box sx={{ position: 'absolute' }}> <Box sx={{ position: 'absolute' }}>
<ReaderHotkeys scrollElementRef={scrollElementRef} />
<ReaderOverlay isVisible={isOverlayVisible} /> <ReaderOverlay isVisible={isOverlayVisible} />
{!scrollElementRef.current && ( {!scrollElementRef.current && (
<Box <Box
@@ -360,27 +361,24 @@ const BaseReader = ({
} }
return ( return (
<> <Box
<ReaderHotkeys scrollElementRef={scrollElementRef} /> sx={{
<Box position: 'relative',
sx={{ display: 'flex',
position: 'relative', flexDirection: 'column',
display: 'flex', width: `calc(100vw - ${readerNavBarWidth}px)`,
flexDirection: 'column', height: `100vh`,
width: `calc(100vw - ${readerNavBarWidth}px)`, marginLeft: `${readerNavBarWidth}px`,
height: `100vh`, transition: (theme) =>
marginLeft: `${readerNavBarWidth}px`, `width 0.${theme.transitions.duration.shortest}s, margin-left 0.${theme.transitions.duration.shortest}s`,
transition: (theme) => overflow: 'auto',
`width 0.${theme.transitions.duration.shortest}s, margin-left 0.${theme.transitions.duration.shortest}s`, backgroundColor: READER_BACKGROUND_TO_COLOR[backgroundColor],
overflow: 'auto', }}
backgroundColor: READER_BACKGROUND_TO_COLOR[backgroundColor], >
}} <ReaderViewer ref={scrollElementRef} />
> <TapZoneLayout />
<ReaderViewer ref={scrollElementRef} /> <ReaderRGBAFilter />
<TapZoneLayout /> </Box>
<ReaderRGBAFilter />
</Box>
</>
); );
}; };

View File

@@ -241,7 +241,7 @@ export class ReaderService {
isGlobal: boolean = false, isGlobal: boolean = false,
profile?: ReadingMode, profile?: ReadingMode,
): void { ): void {
if (!manga) { if (!manga || manga.id === -1) {
return; return;
} }
const key = getMetadataKey(setting, profile !== undefined ? [profile?.toString()] : undefined); const key = getMetadataKey(setting, profile !== undefined ? [profile?.toString()] : undefined);
@@ -305,7 +305,7 @@ export class ReaderService {
isGlobal: boolean = false, isGlobal: boolean = false,
profile?: string, profile?: string,
): void { ): void {
if (!manga) { if (!manga || manga.id === -1) {
return; return;
} }