mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-07-29 00:25:28 +00:00
removed warnings and enter read mode when opening with a file
This commit is contained in:
parent
a56dac76ac
commit
c2e40aabe4
@ -4,6 +4,7 @@ import { useSearchParams } from "react-router-dom";
|
|||||||
import { useToolParams } from "../hooks/useToolParams";
|
import { useToolParams } from "../hooks/useToolParams";
|
||||||
import { useFileWithUrl } from "../hooks/useFileWithUrl";
|
import { useFileWithUrl } from "../hooks/useFileWithUrl";
|
||||||
import { fileStorage } from "../services/fileStorage";
|
import { fileStorage } from "../services/fileStorage";
|
||||||
|
import { fileOpenService } from '../services/fileOpenService';
|
||||||
import AddToPhotosIcon from "@mui/icons-material/AddToPhotos";
|
import AddToPhotosIcon from "@mui/icons-material/AddToPhotos";
|
||||||
import ContentCutIcon from "@mui/icons-material/ContentCut";
|
import ContentCutIcon from "@mui/icons-material/ContentCut";
|
||||||
import ZoomInMapIcon from "@mui/icons-material/ZoomInMap";
|
import ZoomInMapIcon from "@mui/icons-material/ZoomInMap";
|
||||||
@ -324,7 +325,6 @@ export default function HomePage({ openedFilePath }: HomePageProps) {
|
|||||||
console.log('Loading opened file:', openedFilePath);
|
console.log('Loading opened file:', openedFilePath);
|
||||||
|
|
||||||
// Use the file open service to read the file
|
// Use the file open service to read the file
|
||||||
const { fileOpenService } = await import('../services/fileOpenService');
|
|
||||||
const fileData = await fileOpenService.readFileAsArrayBuffer(openedFilePath);
|
const fileData = await fileOpenService.readFileAsArrayBuffer(openedFilePath);
|
||||||
|
|
||||||
if (!fileData) {
|
if (!fileData) {
|
||||||
@ -337,9 +337,10 @@ export default function HomePage({ openedFilePath }: HomePageProps) {
|
|||||||
lastModified: Date.now()
|
lastModified: Date.now()
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add to active files and switch to viewer
|
// Add to active files, switch to viewer, and enable reader mode
|
||||||
addToActiveFiles(file);
|
addToActiveFiles(file);
|
||||||
setCurrentView('viewer');
|
setCurrentView('viewer');
|
||||||
|
setReaderMode(true);
|
||||||
|
|
||||||
console.log('Successfully loaded opened file:', fileData.fileName);
|
console.log('Successfully loaded opened file:', fileData.fileName);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user