Feature: attachment preview - reliable MIME + inline PDF on desktop and mobile
- MIME: Stalwart's download endpoint often returns application/octet-stream, so blob: previews silently downloaded (UUID filename) instead of rendering. Resolve the most specific MIME (attachment type -> filename ext -> blob type) and re-wrap the blob; also fixes inline preview for images and video. - Desktop PDF: render via <iframe> (reliable for blob: PDFs) instead of <object>. - Mobile PDF: no usable inline viewer (Android shows a blank frame / silent download; iOS Safari renders only the first page of a PDF in an <iframe>), so render with pdf.js (canvas, dynamic-imported so it stays off the desktop bundle; iOS-safe canvas cap). Double-tap zoom (fit -> 2x -> 3x -> fit) and 2-finger pinch zoom (to 4x), both centred on the gesture and pannable via native scrolling. - Route to pdf.js when navigator.pdfViewerEnabled is false (Android) and on iOS (incl. iPadOS, which reports true yet shows only the first page in a frame). - Modal header gains an open-in-new-tab icon (next to download/close); the Android/browser Back button closes the preview instead of navigating the page. - On a pdf.js render failure, offer an open-in-new-tab action as fallback.
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
"next": "^16.2.6",
|
||||
"next-intl": "^4.9.1",
|
||||
"otpauth": "^9.5.0",
|
||||
"pdfjs-dist": "^6.0.227",
|
||||
"pkijs": "^3.4.0",
|
||||
"postal-mime": "^2.7.4",
|
||||
"pvtsutils": "^1.3.6",
|
||||
|
||||
Reference in New Issue
Block a user