feat: Improve PDF preview with fullscreen button

Changes:
1. Increased PDF preview height
   - Detail panel: 400px → 600px
   - More space for document viewing

2. Added Fullscreen button
   - Opens PDF in full-screen overlay
   - 90vw × 85vh size (almost full screen)
   - Better reading experience

3. Removed sandbox restriction
   - sandbox='allow-same-origin' removed
   - Allows PDF plugins to work correctly
   - Better browser compatibility

4. Layout improvement
   - Fullscreen button at top
   - PDF iframe below
   - Clean vertical layout

Result:
- PDF files display correctly 
- Fullscreen viewing available 
- Works with browser PDF viewer 

Files:
- src/page.html (PDF preview height, fullscreen button, sandbox removed)
This commit is contained in:
Warren
2026-05-17 05:44:32 +08:00
parent 09f0cb7ae9
commit 3cfc5eeb54
3 changed files with 410 additions and 2 deletions

View File

@@ -794,7 +794,12 @@ function showDetail(fuuid){
}else if(isDocImg){
h+="<img id=mb-preview-img src='"+src+"' style='max-width:100%;max-height:400px;border-radius:8px' onerror=\"this.onerror=null;this.alt='No preview'\">";
}else if(isDocPdf){
h+="<iframe sandbox='allow-same-origin' src='"+src+"' style='width:100%;height:400px;border:none;border-radius:8px;background:#fff'></iframe>";
h+="<div style='display:flex;flex-direction:column;width:100%'>";
h+="<div style='margin-bottom:8px'>";
h+="<button onclick=quickPreview('"+fuuid+"') style='background:#3b82f6;color:#fff;border:none;padding:6px 12px;border-radius:6px;cursor:pointer;font-size:14px'>Fullscreen 📺</button>";
h+="</div>";
h+="<iframe src='"+src+"' style='width:100%;height:600px;border:none;border-radius:8px;background:#fff'></iframe>";
h+="</div>";
}else{
h+="<div style='display:flex;flex-direction:column;align-items:center;width:100%'>";
h+="<div style='display:flex;gap:8px;margin-bottom:8px'>";
@@ -1103,7 +1108,7 @@ function quickPreview(fuuid){
}else if(isDocImg){
inner="<img src='"+src+"' style='max-width:90vw;max-height:85vh;border-radius:8px' onerror=\"this.onerror=null;this.alt='No preview'\">";
}else if(isDocPdf){
inner="<iframe sandbox='allow-same-origin' src='"+src+"' style='width:90vw;height:85vh;border:none;border-radius:8px;background:#fff'></iframe>";
inner="<iframe src='"+src+"' style='width:90vw;height:85vh;border:none;border-radius:8px;background:#fff'></iframe>";
}else{
inner="<img src='"+src+"' style='max-width:90vw;max-height:85vh;min-height:100px;min-width:100px;border-radius:8px' onerror=\"this.onerror=null;this.alt='No preview'\">";
}