Prevent native mobile context menu

This commit is contained in:
schroda
2025-06-10 22:09:02 +02:00
parent 3b0d91e4a6
commit 781d89a75a
4 changed files with 37 additions and 4 deletions

View File

@@ -39,6 +39,7 @@ import {
ChapterReadInfo,
ChapterScanlatorInfo,
} from '@/modules/chapter/Chapter.types.ts';
import { MediaQuery } from '@/modules/core/utils/MediaQuery.tsx';
type TChapter = ChapterIdInfo &
ChapterMangaInfo &
@@ -62,6 +63,7 @@ interface IProps {
export const ChapterCard = memo((props: IProps) => {
const { t } = useTranslation();
const theme = useTheme();
const preventMobileContextMenu = MediaQuery.usePreventMobileContextMenu();
const menuButtonRef = useRef<HTMLButtonElement>(null);
@@ -120,9 +122,10 @@ export const ChapterCard = memo((props: IProps) => {
<CardActionArea
component={Link}
to={Chapters.getReaderUrl(chapter)}
onContextMenu={preventMobileContextMenu}
sx={MediaQuery.preventMobileContextMenuSx()}
style={{
color: theme.palette.text[chapter.isRead ? 'disabled' : 'primary'],
userSelect: 'none',
}}
state={Chapters.getReaderOpenChapterLocationState(chapter, true)}
replace={mode === 'reader'}