From 5af64df152e22c7a460d75c221ed0bc0b842b73e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Feb 2026 22:00:51 +0200 Subject: [PATCH] Fix duplicate tabs on drag-and-drop and long URL overflow Guard against Windows/WebView2 firing duplicate drop events by tracking in-progress paths with a Set ref. Add overflow-wrap and word-break to markdown content so long unbroken strings wrap. --- src/App.tsx | 6 ++++++ src/styles.css | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 595aa8a..f8e824d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -599,6 +599,7 @@ function App() { }, [updateTabScrollState]); // Tauri native drag-and-drop (bypasses browser event interception) + const pendingDropPaths = useRef>(new Set()); useEffect(() => { let unlisten: (() => void) | undefined; getCurrentWebview().onDragDropEvent(async (event) => { @@ -611,6 +612,9 @@ function App() { const paths = event.payload.paths; const mdPath = paths.find((p: string) => p.endsWith('.md') || p.endsWith('.markdown') || p.endsWith('.txt')); if (mdPath) { + // Guard against duplicate drop events (Windows/WebView2 fires twice) + if (pendingDropPaths.current.has(mdPath)) return; + pendingDropPaths.current.add(mdPath); try { const existing = tabsRef.current.find(t => t.path === mdPath); if (existing) { @@ -628,6 +632,8 @@ function App() { } } catch (err) { console.error('Failed to read dropped file:', err); + } finally { + pendingDropPaths.current.delete(mdPath); } } } diff --git a/src/styles.css b/src/styles.css index 0f04fd8..d817cce 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1173,7 +1173,9 @@ html, body, #root { max-width: 680px; margin: 0 auto; color: var(--color-text-primary); - + overflow-wrap: break-word; + word-break: break-word; + /* Premium typography settings */ font-size: 17px; line-height: 1.7;