@file-viewer/renderer-pdf 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pdf.js +24 -1
- package/package.json +2 -2
package/dist/pdf.js
CHANGED
|
@@ -23,6 +23,20 @@ const createStyle = (documentRef) => {
|
|
|
23
23
|
.pdf-page-thumb--thumbnail{width:46px;height:60px;overflow:hidden;background:#fff}
|
|
24
24
|
.pdf-page-thumb--thumbnail img{display:block;width:100%;height:100%;object-fit:contain}
|
|
25
25
|
.pdf-page-thumb--thumbnail span{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%}
|
|
26
|
+
@media (max-width:720px){
|
|
27
|
+
.pdf-toolbar{flex-wrap:nowrap;gap:6px;min-height:44px;padding:5px 6px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
|
|
28
|
+
.pdf-toolbar::-webkit-scrollbar{display:none}
|
|
29
|
+
.pdf-toolbar-group{flex:0 0 auto;height:32px;gap:4px;padding:0 4px;border-radius:7px}
|
|
30
|
+
.pdf-toolbar-group--zoom{margin-left:0}
|
|
31
|
+
.pdf-icon-button,.pdf-scale-button{height:26px;border-radius:5px}
|
|
32
|
+
.pdf-icon-button{width:26px;font-size:16px}
|
|
33
|
+
.pdf-scale-button{width:54px;font-size:12px}
|
|
34
|
+
.pdf-page-meter{min-width:52px;font-size:12px}
|
|
35
|
+
.pdf-page-meter strong{font-size:13px}
|
|
36
|
+
.pdf-rotation-meter{min-width:30px;font-size:12px}
|
|
37
|
+
.pdf-nav-pane{width:min(82vw,280px);max-width:calc(100% - 52px)}
|
|
38
|
+
.pdfViewer{padding:12px 8px 22px}
|
|
39
|
+
}
|
|
26
40
|
`;
|
|
27
41
|
return style;
|
|
28
42
|
};
|
|
@@ -100,7 +114,15 @@ export default async function renderPdf(buffer, target, context) {
|
|
|
100
114
|
const toolbarVisible = (options === null || options === void 0 ? void 0 : options.toolbar) !== false;
|
|
101
115
|
const thumbnailsEnabled = (options === null || options === void 0 ? void 0 : options.thumbnails) === true;
|
|
102
116
|
const zoomEmitter = createFileViewerZoomChangeEmitter();
|
|
103
|
-
|
|
117
|
+
const isCompactViewport = () => {
|
|
118
|
+
const width = target.clientWidth || targetWindow.innerWidth || 0;
|
|
119
|
+
return width > 0 && width <= 720;
|
|
120
|
+
};
|
|
121
|
+
let navVisible = (options === null || options === void 0 ? void 0 : options.navigation) === false
|
|
122
|
+
? false
|
|
123
|
+
: typeof (options === null || options === void 0 ? void 0 : options.defaultNavigationVisible) === 'boolean'
|
|
124
|
+
? options.defaultNavigationVisible
|
|
125
|
+
: !isCompactViewport();
|
|
104
126
|
let navMode = 'pages';
|
|
105
127
|
let loadStatus = 'loading';
|
|
106
128
|
let errorMessage = '';
|
|
@@ -357,6 +379,7 @@ export default async function renderPdf(buffer, target, context) {
|
|
|
357
379
|
void renderPdfThumbnail(pageNumber);
|
|
358
380
|
};
|
|
359
381
|
const syncUi = () => {
|
|
382
|
+
root.classList.toggle('pdf-shell--compact', isCompactViewport());
|
|
360
383
|
root.classList.toggle('pdf-shell--nav-hidden', !navigationEnabled || !navVisible);
|
|
361
384
|
root.classList.toggle('pdf-shell--toolbar-hidden', !toolbarVisible);
|
|
362
385
|
navToggleButton.classList.toggle('pdf-icon-button--active', navVisible);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-pdf",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone PDF renderer plugin for Flyfish File Viewer powered by PDF.js.",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"LICENSE"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@file-viewer/core": "^2.1.
|
|
57
|
+
"@file-viewer/core": "^2.1.2",
|
|
58
58
|
"pdfjs-dist": "^6.0.227"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|