Spaces:
Running
Running
Commit ·
05f2e3b
1
Parent(s): ef55b85
Fix in-modal PDF preview rendering
Browse files- js/main.js +5 -9
- styles.css +15 -2
js/main.js
CHANGED
|
@@ -550,18 +550,14 @@ class App {
|
|
| 550 |
throw new Error(`PDF preview failed: ${response.status}`);
|
| 551 |
}
|
| 552 |
|
| 553 |
-
|
| 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 |
-
<
|
| 558 |
-
src="${
|
| 559 |
-
|
| 560 |
-
width="100%"
|
| 561 |
-
height="100%"
|
| 562 |
-
style="flex:1; border:0;"
|
| 563 |
title="${file.name} preview"
|
| 564 |
-
/>
|
| 565 |
</div>`;
|
| 566 |
} catch (err) {
|
| 567 |
body.innerHTML = this.previewFallback(
|
|
|
|
| 550 |
throw new Error(`PDF preview failed: ${response.status}`);
|
| 551 |
}
|
| 552 |
|
| 553 |
+
clearPreviewObjectUrl();
|
|
|
|
| 554 |
body.innerHTML = `
|
| 555 |
<div class="preview-pdf-wrap" style="width:100%; height:100%; display:flex; flex-direction:column;">
|
| 556 |
+
<iframe
|
| 557 |
+
src="${url}"
|
| 558 |
+
class="preview-pdf-frame"
|
|
|
|
|
|
|
|
|
|
| 559 |
title="${file.name} preview"
|
| 560 |
+
></iframe>
|
| 561 |
</div>`;
|
| 562 |
} catch (err) {
|
| 563 |
body.innerHTML = this.previewFallback(
|
styles.css
CHANGED
|
@@ -1315,8 +1315,8 @@ body {
|
|
| 1315 |
overflow: auto;
|
| 1316 |
background: #f8fafc;
|
| 1317 |
display: flex;
|
| 1318 |
-
align-items:
|
| 1319 |
-
justify-content:
|
| 1320 |
position: relative;
|
| 1321 |
}
|
| 1322 |
|
|
@@ -1327,6 +1327,19 @@ body {
|
|
| 1327 |
display: block;
|
| 1328 |
}
|
| 1329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1330 |
.preview-image {
|
| 1331 |
max-width: 100%;
|
| 1332 |
max-height: 100%;
|
|
|
|
| 1315 |
overflow: auto;
|
| 1316 |
background: #f8fafc;
|
| 1317 |
display: flex;
|
| 1318 |
+
align-items: stretch;
|
| 1319 |
+
justify-content: stretch;
|
| 1320 |
position: relative;
|
| 1321 |
}
|
| 1322 |
|
|
|
|
| 1327 |
display: block;
|
| 1328 |
}
|
| 1329 |
|
| 1330 |
+
.preview-pdf-wrap {
|
| 1331 |
+
flex: 1;
|
| 1332 |
+
min-height: 0;
|
| 1333 |
+
}
|
| 1334 |
+
|
| 1335 |
+
.preview-pdf-frame {
|
| 1336 |
+
width: 100%;
|
| 1337 |
+
height: 100%;
|
| 1338 |
+
border: 0;
|
| 1339 |
+
display: block;
|
| 1340 |
+
flex: 1;
|
| 1341 |
+
}
|
| 1342 |
+
|
| 1343 |
.preview-image {
|
| 1344 |
max-width: 100%;
|
| 1345 |
max-height: 100%;
|