mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
fix(files): give the file preview a working detach button
The button next to the file preview's close icon was Copy Content, whose overlapping-pages glyph reads as a pop-out control - and for a PDF or any media/binary preview it was completely dead: those branches never fill filePreviewContent, so the click hit an empty-content guard and did nothing, with no feedback. There is now a real detach button that opens the previewed file in a browser tab (raw route for PDFs/images/media/text, the server-converted PDF preview for docx/pptx), severs window.opener by hand so a blocked pop-up stays detectable, closes the overlay on success (which also stops any playing media), and disarms on close so it can never open a stale file. The copy button now toasts 'Nothing to copy in this preview' instead of staying silent. Verified live with Playwright against an isolated instance: button visible and armed on a PDF preview, file-raw answers 200, clicking opens the URL and tears the overlay down, text previews keep a working copy buffer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -567,6 +567,7 @@
|
||||
<div class="file-preview-actions">
|
||||
<button class="btn-icon-sm file-preview-edit-btn" id="filePreviewEditBtn" onclick="app.enterFilePreviewEdit()" title="Edit file" aria-label="Edit file" hidden><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z"/></svg></button>
|
||||
<button class="btn-icon-sm" onclick="app.copyFilePreviewContent()" title="Copy content">⎘</button>
|
||||
<button class="btn-icon-sm" id="filePreviewDetachBtn" onclick="app.detachFilePreview()" title="Open in new tab" aria-label="Open in new tab" hidden><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg></button>
|
||||
<button class="btn-icon-sm" onclick="app.closeFilePreview()" title="Close">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user