This commit is contained in:
Manav Rathi
2025-03-05 15:17:26 +05:30
parent 270158dadc
commit ed76b41392

View File

@@ -43,7 +43,14 @@ import EditIcon from "@mui/icons-material/Edit";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined"; import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import FullscreenExitOutlinedIcon from "@mui/icons-material/FullscreenExitOutlined"; import FullscreenExitOutlinedIcon from "@mui/icons-material/FullscreenExitOutlined";
import FullscreenOutlinedIcon from "@mui/icons-material/FullscreenOutlined"; import FullscreenOutlinedIcon from "@mui/icons-material/FullscreenOutlined";
import { Button, Menu, MenuItem, styled, Typography } from "@mui/material"; import {
Button,
Dialog,
Menu,
MenuItem,
styled,
Typography,
} from "@mui/material";
import { t } from "i18next"; import { t } from "i18next";
import React, { import React, {
useCallback, useCallback,
@@ -603,12 +610,18 @@ const FileViewer: React.FC<FileViewerProps> = ({
}, []); }, []);
const handleToggleFullscreen = useCallback(() => { const handleToggleFullscreen = useCallback(() => {
handleMoreMenuClose();
void ( void (
document.fullscreenElement document.fullscreenElement
? document.exitFullscreen() ? document.exitFullscreen()
: document.body.requestFullscreen() : document.body.requestFullscreen()
).then(updateFullscreenStatus); ).then(updateFullscreenStatus);
}, [updateFullscreenStatus]); }, [handleMoreMenuClose, updateFullscreenStatus]);
const handleShortcuts = useCallback(() => {
handleMoreMenuClose();
showShortcuts();
}, [handleMoreMenuClose, showShortcuts]);
// Initial value of delegate. // Initial value of delegate.
if (!delegateRef.current) { if (!delegateRef.current) {
@@ -763,7 +776,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
<FullscreenOutlinedIcon /> <FullscreenOutlinedIcon />
)} )}
</MoreMenuItem> </MoreMenuItem>
<MoreMenuItem onClick={showShortcuts} sx={{ mt: "2px" }}> <MoreMenuItem onClick={handleShortcuts} sx={{ mt: "2px" }}>
<Typography sx={{ color: "fixed.dark.text.faint" }}> <Typography sx={{ color: "fixed.dark.text.faint" }}>
{pt("Shortcuts")} {pt("Shortcuts")}
</Typography> </Typography>
@@ -780,6 +793,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
file={activeAnnotatedFile?.file} file={activeAnnotatedFile?.file}
onSaveEditedCopy={handleSaveEditedCopy} onSaveEditedCopy={handleSaveEditedCopy}
/> />
<Shortcuts {...shortcutsVisibilityProps} />
</Container> </Container>
); );
}; };
@@ -838,9 +852,9 @@ const MoreMenuItemTitle: React.FC<React.PropsWithChildren> = ({ children }) => (
<Typography sx={{ fontWeight: "medium" }}>{children}</Typography> <Typography sx={{ fontWeight: "medium" }}>{children}</Typography>
); );
const MoreMenuItemMinorTitle: React.FC<React.PropsWithChildren> = ({ const Shortcuts: React.FC<ModalVisibilityProps> = (props) => (
children, <Dialog {...props}></Dialog>
}) => <Typography sx={{ fontWeight: "medium" }}>{children}</Typography>; );
const fileIsEditableImage = (file: EnteFile) => { const fileIsEditableImage = (file: EnteFile) => {
// Only images are editable. // Only images are editable.