From ba0501dab87f5735cfb1f923ab1a25a6f5a2a3a2 Mon Sep 17 00:00:00 2001 From: haoyuren <13851610112@163.com> Date: Sun, 15 Mar 2026 04:30:21 -0500 Subject: Fix PDF double-click text selection, add user-select: none to PDF container Co-Authored-By: Claude Opus 4.6 --- src/renderer/src/App.css | 1 + src/renderer/src/components/PdfViewer.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/renderer') diff --git a/src/renderer/src/App.css b/src/renderer/src/App.css index 4c3f731..d4c5d1f 100644 --- a/src/renderer/src/App.css +++ b/src/renderer/src/App.css @@ -1337,6 +1337,7 @@ html, body, #root { align-items: center; gap: 8px; background: #EDE5CE; + user-select: none; } .pdf-page { diff --git a/src/renderer/src/components/PdfViewer.tsx b/src/renderer/src/components/PdfViewer.tsx index 01896d7..c66df98 100644 --- a/src/renderer/src/components/PdfViewer.tsx +++ b/src/renderer/src/components/PdfViewer.tsx @@ -214,9 +214,11 @@ export default function PdfViewer() { // SyncTeX: double-click PDF → jump to source const handlePdfDoubleClick = useCallback(async (e: MouseEvent) => { + e.preventDefault() + e.stopPropagation() if (!pdfPath) { console.log('[synctex-ui] no pdfPath'); return } const canvas = (e.target as HTMLElement).closest('canvas.pdf-page') as HTMLCanvasElement | null - if (!canvas) { console.log('[synctex-ui] no canvas target'); return } + if (!canvas) { console.log('[synctex-ui] no canvas target, target was:', (e.target as HTMLElement).tagName, (e.target as HTMLElement).className); return } const container = containerRef.current if (!container) return -- cgit v1.2.3