From d6df45473650412839b94f3c79da4c9050910df2 Mon Sep 17 00:00:00 2001 From: delibae Date: Sun, 22 Feb 2026 03:33:22 +0900 Subject: [PATCH] feat: implement inline PDF viewer and adjust scaling logic in PdfViewer --- .../workspace/editor/latex-editor.tsx | 84 ++++++++++++++----- .../workspace/preview/pdf-viewer.tsx | 15 ++-- 2 files changed, 68 insertions(+), 31 deletions(-) diff --git a/apps/desktop/src/components/workspace/editor/latex-editor.tsx b/apps/desktop/src/components/workspace/editor/latex-editor.tsx index 27235ff..e3f8f29 100644 --- a/apps/desktop/src/components/workspace/editor/latex-editor.tsx +++ b/apps/desktop/src/components/workspace/editor/latex-editor.tsx @@ -28,7 +28,7 @@ import { import { unifiedMergeView, getChunks, acceptChunk, rejectChunk } from "@codemirror/merge"; import { latex, latexLinter } from "codemirror-lang-latex"; import { linter, lintGutter, forEachDiagnostic, type Diagnostic } from "@codemirror/lint"; -import { useDocumentStore } from "@/stores/document-store"; +import { useDocumentStore, type ProjectFile } from "@/stores/document-store"; import { useProposedChangesStore, type ProposedChange } from "@/stores/proposed-changes-store"; import { useClaudeChatStore } from "@/stores/claude-chat-store"; import { useHistoryStore } from "@/stores/history-store"; @@ -41,6 +41,8 @@ import { ProposedChangesPanel } from "@/components/claude-chat/proposed-changes- import { ImagePreview } from "./image-preview"; import { SearchPanel } from "./search-panel"; import { ProblemsPanel, type DiagnosticItem } from "./problems-panel"; +import { PdfViewer } from "@/components/workspace/preview/pdf-viewer"; +import { readFile } from "@tauri-apps/plugin-fs"; function getActiveFileContent(): string { const state = useDocumentStore.getState(); @@ -70,7 +72,7 @@ export function LatexEditor() { const isTextFile = activeFile?.type === "tex" || activeFile?.type === "bib" || activeFile?.type === "style" || activeFile?.type === "other"; const activeFileContent = activeFile?.content; - const [imageScale, setImageScale] = useState(0.5); + const [imageScale, setImageScale] = useState(1.0); const [isSearchOpen, setIsSearchOpen] = useState(false); const [searchQuery, setSearchQuery] = useState(""); const [matchCount, setMatchCount] = useState(0); @@ -598,25 +600,7 @@ export function LatexEditor() { }, []); if (activeFile?.type === "pdf") { - return ( -
- -
- {activeFile.dataUrl ? ( -