Spaces:
Running
Running
Commit ·
cbe1edf
1
Parent(s): 9bb9203
Keep PDF previews inside modal
Browse files- js/main.js +4 -11
js/main.js
CHANGED
|
@@ -552,21 +552,14 @@ class App {
|
|
| 552 |
|
| 553 |
const pdfBlob = await response.blob();
|
| 554 |
this.currentPreviewObjectUrl = URL.createObjectURL(pdfBlob);
|
| 555 |
-
const googleViewerUrl = `https://docs.google.com/gview?url=${encodeURIComponent(`${url}?download=true`)}&embedded=true`;
|
| 556 |
body.innerHTML = `
|
| 557 |
<div class="preview-pdf-wrap" style="width:100%; height:100%; display:flex; flex-direction:column;">
|
| 558 |
-
<
|
| 559 |
src="${this.currentPreviewObjectUrl}"
|
| 560 |
type="application/pdf"
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
/>
|
| 565 |
-
<div style="padding:12px 16px; border-top:1px solid rgba(0,0,0,0.06); display:flex; justify-content:flex-end;">
|
| 566 |
-
<a href="${googleViewerUrl}" target="_blank" rel="noopener noreferrer" class="btn-secondary" style="text-decoration:none;">
|
| 567 |
-
Open in Google Viewer
|
| 568 |
-
</a>
|
| 569 |
-
</div>
|
| 570 |
</div>`;
|
| 571 |
} catch (err) {
|
| 572 |
body.innerHTML = this.previewFallback(
|
|
|
|
| 552 |
|
| 553 |
const pdfBlob = await response.blob();
|
| 554 |
this.currentPreviewObjectUrl = URL.createObjectURL(pdfBlob);
|
|
|
|
| 555 |
body.innerHTML = `
|
| 556 |
<div class="preview-pdf-wrap" style="width:100%; height:100%; display:flex; flex-direction:column;">
|
| 557 |
+
<iframe
|
| 558 |
src="${this.currentPreviewObjectUrl}"
|
| 559 |
type="application/pdf"
|
| 560 |
+
class="preview-iframe"
|
| 561 |
+
title="${file.name} preview"
|
| 562 |
+
></iframe>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
</div>`;
|
| 564 |
} catch (err) {
|
| 565 |
body.innerHTML = this.previewFallback(
|