@files-preview-app/preview-file 1.3.6 → 1.3.7
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/angular.cjs +497 -130
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.js +497 -130
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +497 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +497 -130
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +497 -130
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +497 -130
- package/dist/react.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/vue.cjs +497 -130
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +497 -130
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/angular.cjs
CHANGED
|
@@ -2165,16 +2165,22 @@ var PdfPlugin = class {
|
|
|
2165
2165
|
container.className = "fp-pdf-container";
|
|
2166
2166
|
container.style.width = "100%";
|
|
2167
2167
|
container.style.height = "100%";
|
|
2168
|
-
container.style.
|
|
2169
|
-
container.style.overflowY = "auto";
|
|
2170
|
-
container.style.display = "flex";
|
|
2171
|
-
container.style.flexDirection = "column";
|
|
2172
|
-
container.style.alignItems = "center";
|
|
2173
|
-
container.style.justifyContent = "flex-start";
|
|
2174
|
-
container.style.padding = "16px 8px";
|
|
2168
|
+
container.style.overflow = "auto";
|
|
2175
2169
|
container.style.backgroundColor = "#0f172a";
|
|
2176
2170
|
container.style.boxSizing = "border-box";
|
|
2177
2171
|
container.style.position = "relative";
|
|
2172
|
+
const scrollWrapper = document.createElement("div");
|
|
2173
|
+
scrollWrapper.className = "fp-pdf-scroll-wrapper";
|
|
2174
|
+
scrollWrapper.style.minWidth = "100%";
|
|
2175
|
+
scrollWrapper.style.minHeight = "100%";
|
|
2176
|
+
scrollWrapper.style.width = "max-content";
|
|
2177
|
+
scrollWrapper.style.height = "max-content";
|
|
2178
|
+
scrollWrapper.style.display = "flex";
|
|
2179
|
+
scrollWrapper.style.flexDirection = "column";
|
|
2180
|
+
scrollWrapper.style.alignItems = "center";
|
|
2181
|
+
scrollWrapper.style.justifyContent = "flex-start";
|
|
2182
|
+
scrollWrapper.style.padding = "16px 8px";
|
|
2183
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
2178
2184
|
const pageCard = document.createElement("div");
|
|
2179
2185
|
pageCard.className = "fp-pdf-page-card";
|
|
2180
2186
|
pageCard.style.boxShadow = "0 10px 35px rgba(0, 0, 0, 0.5)";
|
|
@@ -2187,7 +2193,8 @@ var PdfPlugin = class {
|
|
|
2187
2193
|
pageCard.style.transition = "box-shadow 0.2s ease";
|
|
2188
2194
|
let canvas = document.createElement("canvas");
|
|
2189
2195
|
pageCard.appendChild(canvas);
|
|
2190
|
-
|
|
2196
|
+
scrollWrapper.appendChild(pageCard);
|
|
2197
|
+
container.appendChild(scrollWrapper);
|
|
2191
2198
|
ctx.container.appendChild(container);
|
|
2192
2199
|
const standardFontsUrl = typeof window !== "undefined" && window.__PDF_STANDARD_FONTS_URL__ || "./standard_fonts/";
|
|
2193
2200
|
const cmapsUrl = typeof window !== "undefined" && window.__PDF_CMAPS_URL__ || "./cmaps/";
|
|
@@ -2696,17 +2703,86 @@ var MediaPlugin = class {
|
|
|
2696
2703
|
element = document.createElement("div");
|
|
2697
2704
|
element.textContent = "Unsupported media type";
|
|
2698
2705
|
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2706
|
+
const scrollWrapper = document.createElement("div");
|
|
2707
|
+
scrollWrapper.className = "fp-media-scroll-wrapper";
|
|
2708
|
+
scrollWrapper.style.minWidth = "100%";
|
|
2709
|
+
scrollWrapper.style.minHeight = "100%";
|
|
2710
|
+
scrollWrapper.style.width = "max-content";
|
|
2711
|
+
scrollWrapper.style.height = "max-content";
|
|
2712
|
+
scrollWrapper.style.display = "flex";
|
|
2713
|
+
scrollWrapper.style.justifyContent = "center";
|
|
2714
|
+
scrollWrapper.style.alignItems = "center";
|
|
2715
|
+
scrollWrapper.style.padding = "16px";
|
|
2716
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
2717
|
+
const sizer = document.createElement("div");
|
|
2718
|
+
sizer.className = "fp-media-sizer";
|
|
2719
|
+
sizer.style.position = "relative";
|
|
2720
|
+
sizer.style.flexShrink = "0";
|
|
2721
|
+
sizer.style.display = "flex";
|
|
2722
|
+
sizer.style.justifyContent = "center";
|
|
2723
|
+
sizer.style.alignItems = "center";
|
|
2724
|
+
sizer.appendChild(element);
|
|
2725
|
+
scrollWrapper.appendChild(sizer);
|
|
2726
|
+
ctx.container.style.overflow = "auto";
|
|
2727
|
+
ctx.container.style.padding = "0";
|
|
2728
|
+
ctx.container.innerHTML = "";
|
|
2729
|
+
ctx.container.appendChild(scrollWrapper);
|
|
2730
|
+
let naturalW = 800;
|
|
2731
|
+
let naturalH = 600;
|
|
2732
|
+
let baseW = 800;
|
|
2733
|
+
let baseH = 600;
|
|
2734
|
+
const updateBaseDimensions = () => {
|
|
2735
|
+
if (!isImage) return;
|
|
2736
|
+
const img = element;
|
|
2737
|
+
naturalW = img.naturalWidth || naturalW;
|
|
2738
|
+
naturalH = img.naturalHeight || naturalH;
|
|
2739
|
+
const availW = Math.max(100, ctx.container.clientWidth - 48);
|
|
2740
|
+
const availH = Math.max(100, ctx.container.clientHeight - 48);
|
|
2741
|
+
const fitRatio = Math.min(1, availW / naturalW, availH / naturalH);
|
|
2742
|
+
baseW = Math.max(1, Math.round(naturalW * fitRatio));
|
|
2743
|
+
baseH = Math.max(1, Math.round(naturalH * fitRatio));
|
|
2744
|
+
};
|
|
2704
2745
|
const applyTransform = () => {
|
|
2705
|
-
|
|
2746
|
+
if (isImage) {
|
|
2747
|
+
updateBaseDimensions();
|
|
2748
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
2749
|
+
const boxW = Math.round((isRotated90 ? baseH : baseW) * currentZoom);
|
|
2750
|
+
const boxH = Math.round((isRotated90 ? baseW : baseH) * currentZoom);
|
|
2751
|
+
sizer.style.width = `${boxW}px`;
|
|
2752
|
+
sizer.style.height = `${boxH}px`;
|
|
2753
|
+
element.style.width = `${baseW}px`;
|
|
2754
|
+
element.style.height = `${baseH}px`;
|
|
2755
|
+
element.style.maxWidth = "none";
|
|
2756
|
+
element.style.maxHeight = "none";
|
|
2757
|
+
element.style.transform = `scale(${currentZoom}) rotate(${rotation}deg)`;
|
|
2758
|
+
element.style.transformOrigin = "center center";
|
|
2759
|
+
element.style.flexShrink = "0";
|
|
2760
|
+
} else {
|
|
2761
|
+
element.style.transform = `scale(${currentZoom}) rotate(${rotation}deg)`;
|
|
2762
|
+
}
|
|
2706
2763
|
};
|
|
2764
|
+
if (isImage) {
|
|
2765
|
+
const img = element;
|
|
2766
|
+
if (img.complete && img.naturalWidth > 0) {
|
|
2767
|
+
updateBaseDimensions();
|
|
2768
|
+
applyTransform();
|
|
2769
|
+
} else {
|
|
2770
|
+
img.onload = () => {
|
|
2771
|
+
updateBaseDimensions();
|
|
2772
|
+
applyTransform();
|
|
2773
|
+
};
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
|
|
2777
|
+
if (currentZoom === 1) {
|
|
2778
|
+
applyTransform();
|
|
2779
|
+
}
|
|
2780
|
+
}) : null;
|
|
2781
|
+
ro?.observe(ctx.container);
|
|
2707
2782
|
const cleanup = () => {
|
|
2783
|
+
ro?.disconnect();
|
|
2708
2784
|
if (url) URL.revokeObjectURL(url);
|
|
2709
|
-
|
|
2785
|
+
scrollWrapper.remove();
|
|
2710
2786
|
ctx.container.innerHTML = "";
|
|
2711
2787
|
};
|
|
2712
2788
|
ctx.signal.addEventListener("abort", cleanup);
|
|
@@ -2899,7 +2975,7 @@ var DocxPlugin = class {
|
|
|
2899
2975
|
async render(ctx) {
|
|
2900
2976
|
const wrapper = document.createElement("div");
|
|
2901
2977
|
wrapper.className = "fp-docx-wrapper";
|
|
2902
|
-
wrapper.style.transformOrigin = "
|
|
2978
|
+
wrapper.style.transformOrigin = "center center";
|
|
2903
2979
|
wrapper.style.transition = "transform 0.2s ease";
|
|
2904
2980
|
wrapper.style.padding = "0";
|
|
2905
2981
|
wrapper.style.maxWidth = "none";
|
|
@@ -2909,11 +2985,31 @@ var DocxPlugin = class {
|
|
|
2909
2985
|
wrapper.style.flexDirection = "column";
|
|
2910
2986
|
wrapper.style.alignItems = "center";
|
|
2911
2987
|
wrapper.style.boxSizing = "border-box";
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2988
|
+
wrapper.style.flexShrink = "0";
|
|
2989
|
+
const sizer = document.createElement("div");
|
|
2990
|
+
sizer.className = "fp-docx-sizer";
|
|
2991
|
+
sizer.style.position = "relative";
|
|
2992
|
+
sizer.style.flexShrink = "0";
|
|
2993
|
+
sizer.style.display = "flex";
|
|
2994
|
+
sizer.style.justifyContent = "center";
|
|
2995
|
+
sizer.style.alignItems = "center";
|
|
2996
|
+
const scrollWrapper = document.createElement("div");
|
|
2997
|
+
scrollWrapper.className = "fp-docx-scroll-wrapper";
|
|
2998
|
+
scrollWrapper.style.minWidth = "100%";
|
|
2999
|
+
scrollWrapper.style.minHeight = "100%";
|
|
3000
|
+
scrollWrapper.style.width = "max-content";
|
|
3001
|
+
scrollWrapper.style.height = "max-content";
|
|
3002
|
+
scrollWrapper.style.display = "flex";
|
|
3003
|
+
scrollWrapper.style.justifyContent = "center";
|
|
3004
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
3005
|
+
scrollWrapper.style.padding = "16px 8px";
|
|
3006
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
3007
|
+
sizer.appendChild(wrapper);
|
|
3008
|
+
scrollWrapper.appendChild(sizer);
|
|
3009
|
+
ctx.container.style.overflow = "auto";
|
|
3010
|
+
ctx.container.style.padding = "0";
|
|
2915
3011
|
ctx.container.style.backgroundColor = "#f1f5f9";
|
|
2916
|
-
ctx.container.appendChild(
|
|
3012
|
+
ctx.container.appendChild(scrollWrapper);
|
|
2917
3013
|
const styleOverride = document.createElement("style");
|
|
2918
3014
|
styleOverride.textContent = `
|
|
2919
3015
|
.fp-docx-wrapper .docx-wrapper {
|
|
@@ -2952,8 +3048,8 @@ var DocxPlugin = class {
|
|
|
2952
3048
|
renderEndnotes: true,
|
|
2953
3049
|
useBase64URL: true
|
|
2954
3050
|
});
|
|
2955
|
-
if (!
|
|
2956
|
-
|
|
3051
|
+
if (!sizer.contains(wrapper)) {
|
|
3052
|
+
sizer.appendChild(wrapper);
|
|
2957
3053
|
}
|
|
2958
3054
|
if (wrapper.children.length > 0 && (wrapper.textContent?.trim().length ?? 0) > 0) {
|
|
2959
3055
|
renderedSuccessfully = true;
|
|
@@ -2990,8 +3086,8 @@ var DocxPlugin = class {
|
|
|
2990
3086
|
try {
|
|
2991
3087
|
wrapper.innerHTML = "";
|
|
2992
3088
|
this.renderXmlFallback(ctx, wrapper, createdBlobUrls);
|
|
2993
|
-
if (!
|
|
2994
|
-
|
|
3089
|
+
if (!sizer.contains(wrapper)) {
|
|
3090
|
+
sizer.appendChild(wrapper);
|
|
2995
3091
|
}
|
|
2996
3092
|
renderedSuccessfully = true;
|
|
2997
3093
|
} catch (fallbackErr) {
|
|
@@ -3006,8 +3102,8 @@ var DocxPlugin = class {
|
|
|
3006
3102
|
</p>
|
|
3007
3103
|
</div>
|
|
3008
3104
|
`;
|
|
3009
|
-
if (!
|
|
3010
|
-
|
|
3105
|
+
if (!sizer.contains(wrapper)) {
|
|
3106
|
+
sizer.appendChild(wrapper);
|
|
3011
3107
|
}
|
|
3012
3108
|
}
|
|
3013
3109
|
}
|
|
@@ -3110,15 +3206,18 @@ var DocxPlugin = class {
|
|
|
3110
3206
|
return Math.max(0.35, Math.min(3, sW));
|
|
3111
3207
|
};
|
|
3112
3208
|
const applyTransform = () => {
|
|
3113
|
-
wrapper.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
3114
|
-
wrapper.style.transformOrigin = "top center";
|
|
3115
3209
|
const activeEl = pageElements[currentPage - 1] || wrapper.querySelector("section.docx") || wrapper;
|
|
3210
|
+
const elW = activeEl.offsetWidth || 816;
|
|
3116
3211
|
const elH = activeEl.offsetHeight || 1056;
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
}
|
|
3212
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
3213
|
+
const boxW = Math.round((isRotated90 ? elH : elW) * scale);
|
|
3214
|
+
const boxH = Math.round((isRotated90 ? elW : elH) * scale);
|
|
3215
|
+
sizer.style.width = `${boxW}px`;
|
|
3216
|
+
sizer.style.height = `${boxH}px`;
|
|
3217
|
+
wrapper.style.width = `${elW}px`;
|
|
3218
|
+
wrapper.style.height = `${elH}px`;
|
|
3219
|
+
wrapper.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
3220
|
+
wrapper.style.transformOrigin = "center center";
|
|
3122
3221
|
};
|
|
3123
3222
|
let resizeObserver = null;
|
|
3124
3223
|
if (typeof ResizeObserver !== "undefined") {
|
|
@@ -3143,7 +3242,7 @@ var DocxPlugin = class {
|
|
|
3143
3242
|
for (const url of createdBlobUrls) {
|
|
3144
3243
|
URL.revokeObjectURL(url);
|
|
3145
3244
|
}
|
|
3146
|
-
|
|
3245
|
+
scrollWrapper.remove();
|
|
3147
3246
|
styleOverride.remove();
|
|
3148
3247
|
ctx.container.innerHTML = "";
|
|
3149
3248
|
};
|
|
@@ -3690,7 +3789,7 @@ var ExcelPlugin = class {
|
|
|
3690
3789
|
contentArea.style.flex = "1";
|
|
3691
3790
|
contentArea.style.overflow = "auto";
|
|
3692
3791
|
contentArea.style.padding = "16px";
|
|
3693
|
-
contentArea.style.
|
|
3792
|
+
contentArea.style.boxSizing = "border-box";
|
|
3694
3793
|
const tabsArea = document.createElement("div");
|
|
3695
3794
|
tabsArea.className = "fp-excel-tabs";
|
|
3696
3795
|
tabsArea.style.display = "flex";
|
|
@@ -3704,18 +3803,35 @@ var ExcelPlugin = class {
|
|
|
3704
3803
|
container.appendChild(tabsArea);
|
|
3705
3804
|
ctx.container.appendChild(container);
|
|
3706
3805
|
let scale = 1;
|
|
3806
|
+
let isUserZoomed = false;
|
|
3707
3807
|
let currentSheetIndex = 1;
|
|
3708
3808
|
let sheetNames = [];
|
|
3709
3809
|
let wb = null;
|
|
3710
3810
|
const applyTransform = () => {
|
|
3711
|
-
|
|
3712
|
-
|
|
3811
|
+
const sizer = contentArea.querySelector(".fp-excel-sizer");
|
|
3812
|
+
const table = contentArea.querySelector("table");
|
|
3813
|
+
if (!sizer || !table) return;
|
|
3814
|
+
if (!table._baseWidth && table.offsetWidth > 0) {
|
|
3815
|
+
table._baseWidth = table.offsetWidth;
|
|
3816
|
+
table._baseHeight = table.offsetHeight;
|
|
3817
|
+
}
|
|
3818
|
+
const baseW = table._baseWidth || table.offsetWidth || 800;
|
|
3819
|
+
const baseH = table._baseHeight || table.offsetHeight || 600;
|
|
3820
|
+
const scaledW = Math.round(baseW * scale);
|
|
3821
|
+
const scaledH = Math.round(baseH * scale);
|
|
3822
|
+
sizer.style.width = `${scaledW}px`;
|
|
3823
|
+
sizer.style.height = `${scaledH}px`;
|
|
3824
|
+
table.style.position = "absolute";
|
|
3825
|
+
table.style.top = "0";
|
|
3826
|
+
table.style.left = "0";
|
|
3827
|
+
table.style.transform = `scale(${scale})`;
|
|
3828
|
+
table.style.transformOrigin = "top left";
|
|
3713
3829
|
};
|
|
3714
3830
|
const calculateFitScale = () => {
|
|
3715
3831
|
const table = contentArea.querySelector("table");
|
|
3716
3832
|
if (!table) return 1;
|
|
3717
3833
|
const availW = Math.max(280, container.clientWidth - 48);
|
|
3718
|
-
const tW = table.offsetWidth || 800;
|
|
3834
|
+
const tW = table._baseWidth || table.offsetWidth || 800;
|
|
3719
3835
|
return Math.max(0.4, Math.min(1, availW / tW));
|
|
3720
3836
|
};
|
|
3721
3837
|
try {
|
|
@@ -3735,9 +3851,13 @@ var ExcelPlugin = class {
|
|
|
3735
3851
|
contentArea.innerHTML = '<div style="padding: 24px; color: #888;">Empty sheet</div>';
|
|
3736
3852
|
return;
|
|
3737
3853
|
}
|
|
3854
|
+
const sizer = document.createElement("div");
|
|
3855
|
+
sizer.className = "fp-excel-sizer";
|
|
3856
|
+
sizer.style.position = "relative";
|
|
3738
3857
|
const html = XLSX__namespace.utils.sheet_to_html(ws, { id: "fp-sheet-table", editable: false });
|
|
3739
|
-
|
|
3740
|
-
|
|
3858
|
+
sizer.innerHTML = html;
|
|
3859
|
+
contentArea.appendChild(sizer);
|
|
3860
|
+
const table = sizer.querySelector("table");
|
|
3741
3861
|
if (table) {
|
|
3742
3862
|
table.style.borderCollapse = "collapse";
|
|
3743
3863
|
table.style.fontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
|
|
@@ -3772,13 +3892,17 @@ var ExcelPlugin = class {
|
|
|
3772
3892
|
});
|
|
3773
3893
|
ctx.emit("page-change", { page: currentSheetIndex, total: sheetNames.length });
|
|
3774
3894
|
requestAnimationFrame(() => {
|
|
3775
|
-
|
|
3895
|
+
if (!isUserZoomed) {
|
|
3896
|
+
scale = calculateFitScale();
|
|
3897
|
+
}
|
|
3776
3898
|
applyTransform();
|
|
3777
3899
|
});
|
|
3778
3900
|
};
|
|
3779
3901
|
const ro = new ResizeObserver(() => {
|
|
3780
|
-
|
|
3781
|
-
|
|
3902
|
+
if (!isUserZoomed) {
|
|
3903
|
+
scale = calculateFitScale();
|
|
3904
|
+
applyTransform();
|
|
3905
|
+
}
|
|
3782
3906
|
});
|
|
3783
3907
|
ro.observe(container);
|
|
3784
3908
|
if (sheetNames.length > 0) {
|
|
@@ -3815,23 +3939,28 @@ var ExcelPlugin = class {
|
|
|
3815
3939
|
return {
|
|
3816
3940
|
destroy: cleanup,
|
|
3817
3941
|
zoomIn: () => {
|
|
3942
|
+
isUserZoomed = true;
|
|
3818
3943
|
scale += 0.15;
|
|
3819
3944
|
applyTransform();
|
|
3820
3945
|
},
|
|
3821
3946
|
zoomOut: () => {
|
|
3947
|
+
isUserZoomed = true;
|
|
3822
3948
|
scale = Math.max(0.2, scale - 0.15);
|
|
3823
3949
|
applyTransform();
|
|
3824
3950
|
},
|
|
3825
3951
|
getZoom: () => scale,
|
|
3826
3952
|
setZoom: (level) => {
|
|
3953
|
+
isUserZoomed = true;
|
|
3827
3954
|
scale = level;
|
|
3828
3955
|
applyTransform();
|
|
3829
3956
|
},
|
|
3830
3957
|
fitToPage: () => {
|
|
3958
|
+
isUserZoomed = false;
|
|
3831
3959
|
scale = calculateFitScale();
|
|
3832
3960
|
applyTransform();
|
|
3833
3961
|
},
|
|
3834
3962
|
resetZoom: () => {
|
|
3963
|
+
isUserZoomed = false;
|
|
3835
3964
|
scale = calculateFitScale();
|
|
3836
3965
|
contentArea.scrollTop = 0;
|
|
3837
3966
|
contentArea.scrollLeft = 0;
|
|
@@ -4063,21 +4192,41 @@ var CsvPlugin = class {
|
|
|
4063
4192
|
container.appendChild(tableWrapper);
|
|
4064
4193
|
ctx.container.appendChild(container);
|
|
4065
4194
|
let scale = 1;
|
|
4195
|
+
let isUserZoomed = false;
|
|
4066
4196
|
const calculateFitScale = () => {
|
|
4067
4197
|
const availW = Math.max(280, container.clientWidth - 48);
|
|
4068
|
-
const tW = table.offsetWidth || 800;
|
|
4198
|
+
const tW = table._baseWidth || table.offsetWidth || 800;
|
|
4069
4199
|
return Math.max(0.4, Math.min(1, availW / tW));
|
|
4070
4200
|
};
|
|
4071
4201
|
const applyScale = () => {
|
|
4072
|
-
|
|
4202
|
+
if (!table._baseWidth && table.offsetWidth > 0) {
|
|
4203
|
+
table._baseWidth = table.offsetWidth;
|
|
4204
|
+
table._baseHeight = table.offsetHeight;
|
|
4205
|
+
}
|
|
4206
|
+
const baseW = table._baseWidth || table.offsetWidth || 800;
|
|
4207
|
+
const baseH = table._baseHeight || table.offsetHeight || 600;
|
|
4208
|
+
const scaledW = Math.round(baseW * scale);
|
|
4209
|
+
const scaledH = Math.round(baseH * scale);
|
|
4210
|
+
tableWrapper.style.position = "relative";
|
|
4211
|
+
tableWrapper.style.width = `${scaledW}px`;
|
|
4212
|
+
tableWrapper.style.height = `${scaledH}px`;
|
|
4213
|
+
table.style.position = "absolute";
|
|
4214
|
+
table.style.top = "0";
|
|
4215
|
+
table.style.left = "0";
|
|
4216
|
+
table.style.transform = `scale(${scale})`;
|
|
4217
|
+
table.style.transformOrigin = "top left";
|
|
4073
4218
|
};
|
|
4074
4219
|
requestAnimationFrame(() => {
|
|
4075
|
-
|
|
4220
|
+
if (!isUserZoomed) {
|
|
4221
|
+
scale = calculateFitScale();
|
|
4222
|
+
}
|
|
4076
4223
|
applyScale();
|
|
4077
4224
|
});
|
|
4078
4225
|
const ro = new ResizeObserver(() => {
|
|
4079
|
-
|
|
4080
|
-
|
|
4226
|
+
if (!isUserZoomed) {
|
|
4227
|
+
scale = calculateFitScale();
|
|
4228
|
+
applyScale();
|
|
4229
|
+
}
|
|
4081
4230
|
});
|
|
4082
4231
|
ro.observe(container);
|
|
4083
4232
|
const cleanup = () => {
|
|
@@ -4150,23 +4299,28 @@ var CsvPlugin = class {
|
|
|
4150
4299
|
}];
|
|
4151
4300
|
},
|
|
4152
4301
|
zoomIn: () => {
|
|
4302
|
+
isUserZoomed = true;
|
|
4153
4303
|
scale += 0.1;
|
|
4154
4304
|
applyScale();
|
|
4155
4305
|
},
|
|
4156
4306
|
zoomOut: () => {
|
|
4307
|
+
isUserZoomed = true;
|
|
4157
4308
|
scale = Math.max(0.2, scale - 0.1);
|
|
4158
4309
|
applyScale();
|
|
4159
4310
|
},
|
|
4160
4311
|
getZoom: () => scale,
|
|
4161
4312
|
setZoom: (level) => {
|
|
4313
|
+
isUserZoomed = true;
|
|
4162
4314
|
scale = level;
|
|
4163
4315
|
applyScale();
|
|
4164
4316
|
},
|
|
4165
4317
|
fitToPage: () => {
|
|
4318
|
+
isUserZoomed = false;
|
|
4166
4319
|
scale = calculateFitScale();
|
|
4167
4320
|
applyScale();
|
|
4168
4321
|
},
|
|
4169
4322
|
resetZoom: () => {
|
|
4323
|
+
isUserZoomed = false;
|
|
4170
4324
|
scale = calculateFitScale();
|
|
4171
4325
|
container.scrollTop = 0;
|
|
4172
4326
|
container.scrollLeft = 0;
|
|
@@ -4402,15 +4556,27 @@ var CodePlugin = class {
|
|
|
4402
4556
|
let isUserZoomed = false;
|
|
4403
4557
|
const pre = document.createElement("pre");
|
|
4404
4558
|
const code = document.createElement("code");
|
|
4559
|
+
const sizer = document.createElement("div");
|
|
4560
|
+
const scrollWrapper = document.createElement("div");
|
|
4405
4561
|
if (isTxt) {
|
|
4406
|
-
container.style.
|
|
4407
|
-
container.style.overflowY = "auto";
|
|
4562
|
+
container.style.overflow = "auto";
|
|
4408
4563
|
container.style.backgroundColor = "#f1f5f9";
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4564
|
+
scrollWrapper.className = "fp-code-scroll-wrapper";
|
|
4565
|
+
scrollWrapper.style.minWidth = "100%";
|
|
4566
|
+
scrollWrapper.style.minHeight = "100%";
|
|
4567
|
+
scrollWrapper.style.width = "max-content";
|
|
4568
|
+
scrollWrapper.style.height = "max-content";
|
|
4569
|
+
scrollWrapper.style.display = "flex";
|
|
4570
|
+
scrollWrapper.style.justifyContent = "center";
|
|
4571
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
4572
|
+
scrollWrapper.style.padding = "16px 8px";
|
|
4573
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
4574
|
+
sizer.className = "fp-code-sizer";
|
|
4575
|
+
sizer.style.position = "relative";
|
|
4576
|
+
sizer.style.flexShrink = "0";
|
|
4577
|
+
sizer.style.display = "flex";
|
|
4578
|
+
sizer.style.justifyContent = "center";
|
|
4579
|
+
sizer.style.alignItems = "center";
|
|
4414
4580
|
pre.style.margin = "0 auto";
|
|
4415
4581
|
pre.style.fontFamily = "Consolas, 'Courier New', monospace";
|
|
4416
4582
|
pre.style.fontSize = "13px";
|
|
@@ -4425,8 +4591,9 @@ var CodePlugin = class {
|
|
|
4425
4591
|
pre.style.boxSizing = "border-box";
|
|
4426
4592
|
pre.style.boxShadow = "0 4px 24px rgba(0, 0, 0, 0.08)";
|
|
4427
4593
|
pre.style.borderRadius = "4px";
|
|
4428
|
-
pre.style.transformOrigin = "
|
|
4594
|
+
pre.style.transformOrigin = "center center";
|
|
4429
4595
|
pre.style.transition = "transform 0.15s ease";
|
|
4596
|
+
pre.style.flexShrink = "0";
|
|
4430
4597
|
} else {
|
|
4431
4598
|
container.style.overflow = "auto";
|
|
4432
4599
|
container.style.backgroundColor = "#1e1e1e";
|
|
@@ -4459,7 +4626,13 @@ var CodePlugin = class {
|
|
|
4459
4626
|
};
|
|
4460
4627
|
renderCodePage(rawPages[0] || (isTxt ? "" : fullText));
|
|
4461
4628
|
pre.appendChild(code);
|
|
4462
|
-
|
|
4629
|
+
if (isTxt) {
|
|
4630
|
+
sizer.appendChild(pre);
|
|
4631
|
+
scrollWrapper.appendChild(sizer);
|
|
4632
|
+
container.appendChild(scrollWrapper);
|
|
4633
|
+
} else {
|
|
4634
|
+
container.appendChild(pre);
|
|
4635
|
+
}
|
|
4463
4636
|
const showPage = (pageNum) => {
|
|
4464
4637
|
currentPage = Math.max(1, Math.min(totalPages, pageNum));
|
|
4465
4638
|
renderCodePage(rawPages[currentPage - 1] || (isTxt ? "" : fullText));
|
|
@@ -4476,10 +4649,16 @@ var CodePlugin = class {
|
|
|
4476
4649
|
};
|
|
4477
4650
|
const updateTransform = () => {
|
|
4478
4651
|
if (isTxt) {
|
|
4652
|
+
const elW = 816;
|
|
4653
|
+
const baseH = pre.offsetHeight || 1056;
|
|
4654
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
4655
|
+
const boxW = Math.round((isRotated90 ? baseH : elW) * zoomLevel);
|
|
4656
|
+
const boxH = Math.round((isRotated90 ? elW : baseH) * zoomLevel);
|
|
4657
|
+
sizer.style.width = `${boxW}px`;
|
|
4658
|
+
sizer.style.height = `${boxH}px`;
|
|
4659
|
+
pre.style.width = `${elW}px`;
|
|
4479
4660
|
pre.style.transform = `scale(${zoomLevel}) rotate(${rotation}deg)`;
|
|
4480
|
-
|
|
4481
|
-
const extraH = Math.max(0, scaledH - 1056);
|
|
4482
|
-
pre.style.marginBottom = `${extraH + 32}px`;
|
|
4661
|
+
pre.style.transformOrigin = "center center";
|
|
4483
4662
|
} else {
|
|
4484
4663
|
pre.style.transform = `rotate(${rotation}deg)`;
|
|
4485
4664
|
pre.style.fontSize = `${fontSize}px`;
|
|
@@ -4685,16 +4864,56 @@ var ArchivePlugin = class {
|
|
|
4685
4864
|
width: 100%;
|
|
4686
4865
|
height: 100%;
|
|
4687
4866
|
overflow: auto;
|
|
4688
|
-
padding: 24px;
|
|
4689
4867
|
box-sizing: border-box;
|
|
4690
4868
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
4691
|
-
transform-origin: top left;
|
|
4692
|
-
transition: transform 0.2s ease;
|
|
4693
4869
|
`;
|
|
4870
|
+
const scrollWrapper = document.createElement("div");
|
|
4871
|
+
scrollWrapper.className = "fp-archive-scroll-wrapper";
|
|
4872
|
+
scrollWrapper.style.cssText = `
|
|
4873
|
+
min-width: 100%;
|
|
4874
|
+
min-height: 100%;
|
|
4875
|
+
width: max-content;
|
|
4876
|
+
height: max-content;
|
|
4877
|
+
display: flex;
|
|
4878
|
+
justify-content: center;
|
|
4879
|
+
align-items: flex-start;
|
|
4880
|
+
padding: 24px;
|
|
4881
|
+
box-sizing: border-box;
|
|
4882
|
+
`;
|
|
4883
|
+
const sizer = document.createElement("div");
|
|
4884
|
+
sizer.className = "fp-archive-sizer";
|
|
4885
|
+
sizer.style.cssText = `
|
|
4886
|
+
position: relative;
|
|
4887
|
+
flex-shrink: 0;
|
|
4888
|
+
display: flex;
|
|
4889
|
+
justify-content: center;
|
|
4890
|
+
align-items: flex-start;
|
|
4891
|
+
`;
|
|
4892
|
+
const card = document.createElement("div");
|
|
4893
|
+
card.className = "fp-archive-card";
|
|
4894
|
+
card.style.cssText = `
|
|
4895
|
+
width: 900px;
|
|
4896
|
+
box-sizing: border-box;
|
|
4897
|
+
transform-origin: top center;
|
|
4898
|
+
transition: transform 0.15s ease;
|
|
4899
|
+
flex-shrink: 0;
|
|
4900
|
+
`;
|
|
4901
|
+
sizer.appendChild(card);
|
|
4902
|
+
scrollWrapper.appendChild(sizer);
|
|
4903
|
+
wrapper.appendChild(scrollWrapper);
|
|
4694
4904
|
ctx.container.innerHTML = "";
|
|
4695
4905
|
ctx.container.style.overflow = "auto";
|
|
4696
4906
|
ctx.container.appendChild(wrapper);
|
|
4697
4907
|
let scale = 1;
|
|
4908
|
+
const applyTransform = () => {
|
|
4909
|
+
const boxW = Math.round(900 * scale);
|
|
4910
|
+
const cardH = card.offsetHeight || 600;
|
|
4911
|
+
const boxH = Math.round(cardH * scale);
|
|
4912
|
+
sizer.style.width = `${boxW}px`;
|
|
4913
|
+
sizer.style.height = `${boxH}px`;
|
|
4914
|
+
card.style.transform = `scale(${scale})`;
|
|
4915
|
+
card.style.transformOrigin = "top center";
|
|
4916
|
+
};
|
|
4698
4917
|
const entries = await new Promise((resolve, reject) => {
|
|
4699
4918
|
fflate.unzip(new Uint8Array(ctx.buffer), (err, unzipped) => {
|
|
4700
4919
|
if (err) {
|
|
@@ -4718,7 +4937,7 @@ var ArchivePlugin = class {
|
|
|
4718
4937
|
});
|
|
4719
4938
|
const totalUncompressedSize = entries.reduce((acc, e) => acc + e.size, 0);
|
|
4720
4939
|
const renderUI = (filteredEntries) => {
|
|
4721
|
-
|
|
4940
|
+
card.innerHTML = `
|
|
4722
4941
|
<div style="max-width: 900px; margin: 0 auto; background: var(--fp-bg, #ffffff); border: 1px solid var(--fp-border, #e5e7eb); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden;">
|
|
4723
4942
|
<div style="padding: 16px 20px; background: var(--fp-toolbar-bg, #f9fafb); border-bottom: 1px solid var(--fp-border, #e5e7eb); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;">
|
|
4724
4943
|
<div>
|
|
@@ -4748,7 +4967,7 @@ var ArchivePlugin = class {
|
|
|
4748
4967
|
</div>
|
|
4749
4968
|
</div>
|
|
4750
4969
|
`;
|
|
4751
|
-
const tbody =
|
|
4970
|
+
const tbody = card.querySelector("#fp-archive-body");
|
|
4752
4971
|
if (filteredEntries.length === 0) {
|
|
4753
4972
|
tbody.innerHTML = `<tr><td colspan="3" style="padding: 24px; text-align: center; color: #9ca3af;">No matching files found</td></tr>`;
|
|
4754
4973
|
} else {
|
|
@@ -4777,19 +4996,20 @@ var ArchivePlugin = class {
|
|
|
4777
4996
|
}
|
|
4778
4997
|
});
|
|
4779
4998
|
});
|
|
4780
|
-
const searchInput =
|
|
4999
|
+
const searchInput = card.querySelector("#fp-archive-search");
|
|
4781
5000
|
if (searchInput) {
|
|
4782
5001
|
searchInput.addEventListener("input", () => {
|
|
4783
5002
|
const q = searchInput.value.toLowerCase().trim();
|
|
4784
5003
|
const filtered = q ? entries.filter((e) => e.path.toLowerCase().includes(q)) : entries;
|
|
4785
5004
|
renderUI(filtered);
|
|
4786
|
-
const newSearch =
|
|
5005
|
+
const newSearch = card.querySelector("#fp-archive-search");
|
|
4787
5006
|
if (newSearch) {
|
|
4788
5007
|
newSearch.value = q;
|
|
4789
5008
|
newSearch.focus();
|
|
4790
5009
|
}
|
|
4791
5010
|
});
|
|
4792
5011
|
}
|
|
5012
|
+
applyTransform();
|
|
4793
5013
|
};
|
|
4794
5014
|
renderUI(entries);
|
|
4795
5015
|
const cleanup = () => {
|
|
@@ -4801,26 +5021,26 @@ var ArchivePlugin = class {
|
|
|
4801
5021
|
destroy: cleanup,
|
|
4802
5022
|
zoomIn: () => {
|
|
4803
5023
|
scale += 0.1;
|
|
4804
|
-
|
|
5024
|
+
applyTransform();
|
|
4805
5025
|
},
|
|
4806
5026
|
zoomOut: () => {
|
|
4807
5027
|
scale = Math.max(0.3, scale - 0.1);
|
|
4808
|
-
|
|
5028
|
+
applyTransform();
|
|
4809
5029
|
},
|
|
4810
5030
|
getZoom: () => scale,
|
|
4811
5031
|
setZoom: (level) => {
|
|
4812
5032
|
scale = level;
|
|
4813
|
-
|
|
5033
|
+
applyTransform();
|
|
4814
5034
|
},
|
|
4815
5035
|
fitToPage: () => {
|
|
4816
5036
|
scale = 1;
|
|
4817
|
-
|
|
5037
|
+
applyTransform();
|
|
4818
5038
|
},
|
|
4819
5039
|
resetZoom: () => {
|
|
4820
5040
|
scale = 1;
|
|
4821
|
-
wrapper.
|
|
4822
|
-
|
|
4823
|
-
|
|
5041
|
+
wrapper.scrollTop = 0;
|
|
5042
|
+
wrapper.scrollLeft = 0;
|
|
5043
|
+
applyTransform();
|
|
4824
5044
|
},
|
|
4825
5045
|
download: () => {
|
|
4826
5046
|
downloadFile(ctx.buffer, ctx.metadata.name || "archive.zip", "application/zip");
|
|
@@ -5179,12 +5399,30 @@ var PptxPlugin = class {
|
|
|
5179
5399
|
width: 100%;
|
|
5180
5400
|
height: 100%;
|
|
5181
5401
|
overflow: auto;
|
|
5402
|
+
box-sizing: border-box;
|
|
5403
|
+
background: var(--fp-bg-canvas, #525659);
|
|
5404
|
+
`;
|
|
5405
|
+
const scrollWrapper = document.createElement("div");
|
|
5406
|
+
scrollWrapper.className = "fp-pptx-scroll-wrapper";
|
|
5407
|
+
scrollWrapper.style.cssText = `
|
|
5408
|
+
min-width: 100%;
|
|
5409
|
+
min-height: 100%;
|
|
5410
|
+
width: max-content;
|
|
5411
|
+
height: max-content;
|
|
5182
5412
|
display: flex;
|
|
5183
5413
|
justify-content: center;
|
|
5184
|
-
align-items:
|
|
5414
|
+
align-items: center;
|
|
5185
5415
|
padding: 24px;
|
|
5186
5416
|
box-sizing: border-box;
|
|
5187
|
-
|
|
5417
|
+
`;
|
|
5418
|
+
const sizer = document.createElement("div");
|
|
5419
|
+
sizer.className = "fp-pptx-sizer";
|
|
5420
|
+
sizer.style.cssText = `
|
|
5421
|
+
position: relative;
|
|
5422
|
+
flex-shrink: 0;
|
|
5423
|
+
display: flex;
|
|
5424
|
+
justify-content: center;
|
|
5425
|
+
align-items: center;
|
|
5188
5426
|
`;
|
|
5189
5427
|
const slideContainer = document.createElement("div");
|
|
5190
5428
|
slideContainer.className = "fp-slide-container";
|
|
@@ -5193,14 +5431,15 @@ var PptxPlugin = class {
|
|
|
5193
5431
|
border-radius: 4px;
|
|
5194
5432
|
overflow: hidden;
|
|
5195
5433
|
background: #ffffff;
|
|
5196
|
-
transform-origin:
|
|
5434
|
+
transform-origin: center center;
|
|
5197
5435
|
transition: transform 0.2s ease;
|
|
5198
|
-
|
|
5199
|
-
max-height: calc(100% - 48px);
|
|
5436
|
+
flex-shrink: 0;
|
|
5200
5437
|
`;
|
|
5201
5438
|
const canvas = document.createElement("canvas");
|
|
5202
5439
|
slideContainer.appendChild(canvas);
|
|
5203
|
-
|
|
5440
|
+
sizer.appendChild(slideContainer);
|
|
5441
|
+
scrollWrapper.appendChild(sizer);
|
|
5442
|
+
wrapper.appendChild(scrollWrapper);
|
|
5204
5443
|
ctx.container.innerHTML = "";
|
|
5205
5444
|
ctx.container.style.overflow = "auto";
|
|
5206
5445
|
ctx.container.appendChild(wrapper);
|
|
@@ -5212,7 +5451,17 @@ var PptxPlugin = class {
|
|
|
5212
5451
|
return Math.min(1, Math.min(availW / cW, availH / cH));
|
|
5213
5452
|
};
|
|
5214
5453
|
const applyTransform = () => {
|
|
5454
|
+
const cW = canvas.offsetWidth || 1280;
|
|
5455
|
+
const cH = canvas.offsetHeight || 720;
|
|
5456
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
5457
|
+
const boxW = Math.round((isRotated90 ? cH : cW) * scale);
|
|
5458
|
+
const boxH = Math.round((isRotated90 ? cW : cH) * scale);
|
|
5459
|
+
sizer.style.width = `${boxW}px`;
|
|
5460
|
+
sizer.style.height = `${boxH}px`;
|
|
5461
|
+
slideContainer.style.width = `${cW}px`;
|
|
5462
|
+
slideContainer.style.height = `${cH}px`;
|
|
5215
5463
|
slideContainer.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
5464
|
+
slideContainer.style.transformOrigin = "center center";
|
|
5216
5465
|
};
|
|
5217
5466
|
const renderCurrentSlide = async () => {
|
|
5218
5467
|
try {
|
|
@@ -5818,13 +6067,33 @@ var RtfPlugin = class {
|
|
|
5818
6067
|
wrapper.style.flexDirection = "column";
|
|
5819
6068
|
wrapper.style.alignItems = "center";
|
|
5820
6069
|
wrapper.style.backgroundColor = "transparent";
|
|
5821
|
-
wrapper.style.transformOrigin = "
|
|
6070
|
+
wrapper.style.transformOrigin = "center center";
|
|
5822
6071
|
wrapper.style.transition = "transform 0.15s ease";
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
6072
|
+
wrapper.style.flexShrink = "0";
|
|
6073
|
+
const sizer = document.createElement("div");
|
|
6074
|
+
sizer.className = "fp-rtf-sizer";
|
|
6075
|
+
sizer.style.position = "relative";
|
|
6076
|
+
sizer.style.flexShrink = "0";
|
|
6077
|
+
sizer.style.display = "flex";
|
|
6078
|
+
sizer.style.justifyContent = "center";
|
|
6079
|
+
sizer.style.alignItems = "center";
|
|
6080
|
+
const scrollWrapper = document.createElement("div");
|
|
6081
|
+
scrollWrapper.className = "fp-rtf-scroll-wrapper";
|
|
6082
|
+
scrollWrapper.style.minWidth = "100%";
|
|
6083
|
+
scrollWrapper.style.minHeight = "100%";
|
|
6084
|
+
scrollWrapper.style.width = "max-content";
|
|
6085
|
+
scrollWrapper.style.height = "max-content";
|
|
6086
|
+
scrollWrapper.style.display = "flex";
|
|
6087
|
+
scrollWrapper.style.justifyContent = "center";
|
|
6088
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
6089
|
+
scrollWrapper.style.padding = "16px 8px";
|
|
6090
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
6091
|
+
sizer.appendChild(wrapper);
|
|
6092
|
+
scrollWrapper.appendChild(sizer);
|
|
6093
|
+
ctx.container.style.overflow = "auto";
|
|
6094
|
+
ctx.container.style.padding = "0";
|
|
5826
6095
|
ctx.container.style.backgroundColor = "#f1f5f9";
|
|
5827
|
-
ctx.container.appendChild(
|
|
6096
|
+
ctx.container.appendChild(scrollWrapper);
|
|
5828
6097
|
let scale = 1;
|
|
5829
6098
|
let rotation = 0;
|
|
5830
6099
|
let pageElements = [];
|
|
@@ -5843,12 +6112,17 @@ var RtfPlugin = class {
|
|
|
5843
6112
|
return Math.max(0.4, Math.min(3, sW));
|
|
5844
6113
|
};
|
|
5845
6114
|
const applyTransform = () => {
|
|
5846
|
-
|
|
5847
|
-
wrapper.style.transformOrigin = "top center";
|
|
6115
|
+
const elW = pageWidth;
|
|
5848
6116
|
const baseH = pageHeight;
|
|
5849
|
-
const
|
|
5850
|
-
const
|
|
5851
|
-
|
|
6117
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
6118
|
+
const boxW = Math.round((isRotated90 ? baseH : elW) * scale);
|
|
6119
|
+
const boxH = Math.round((isRotated90 ? elW : baseH) * scale);
|
|
6120
|
+
sizer.style.width = `${boxW}px`;
|
|
6121
|
+
sizer.style.height = `${boxH}px`;
|
|
6122
|
+
wrapper.style.width = `${elW}px`;
|
|
6123
|
+
wrapper.style.height = `${baseH}px`;
|
|
6124
|
+
wrapper.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
6125
|
+
wrapper.style.transformOrigin = "center center";
|
|
5852
6126
|
};
|
|
5853
6127
|
const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
|
|
5854
6128
|
if (!isUserZoomed) {
|
|
@@ -6119,7 +6393,7 @@ var RtfPlugin = class {
|
|
|
6119
6393
|
}
|
|
6120
6394
|
const cleanup = () => {
|
|
6121
6395
|
resizeObserver?.disconnect();
|
|
6122
|
-
|
|
6396
|
+
scrollWrapper.remove();
|
|
6123
6397
|
ctx.container.innerHTML = "";
|
|
6124
6398
|
};
|
|
6125
6399
|
ctx.signal.addEventListener("abort", cleanup);
|
|
@@ -6294,23 +6568,44 @@ var HtmlPreviewPlugin = class {
|
|
|
6294
6568
|
ADD_TAGS: ["style", "link"],
|
|
6295
6569
|
ADD_ATTR: ["target", "rel"]
|
|
6296
6570
|
});
|
|
6571
|
+
const sizer = document.createElement("div");
|
|
6572
|
+
sizer.className = "fp-html-sizer";
|
|
6573
|
+
sizer.style.position = "relative";
|
|
6297
6574
|
const iframe = document.createElement("iframe");
|
|
6298
6575
|
iframe.className = "fp-html-iframe";
|
|
6299
|
-
iframe.style.width = "100%";
|
|
6300
|
-
iframe.style.height = "100%";
|
|
6301
6576
|
iframe.style.border = "none";
|
|
6302
6577
|
iframe.style.backgroundColor = "#ffffff";
|
|
6303
6578
|
iframe.style.transformOrigin = "top left";
|
|
6304
6579
|
iframe.style.transition = "transform 0.2s ease";
|
|
6305
6580
|
iframe.sandbox.add("allow-same-origin");
|
|
6581
|
+
sizer.appendChild(iframe);
|
|
6306
6582
|
ctx.container.style.overflow = "auto";
|
|
6307
6583
|
ctx.container.style.width = "100%";
|
|
6308
6584
|
ctx.container.style.height = "100%";
|
|
6309
|
-
ctx.container.
|
|
6585
|
+
ctx.container.innerHTML = "";
|
|
6586
|
+
ctx.container.appendChild(sizer);
|
|
6310
6587
|
iframe.srcdoc = sanitized;
|
|
6311
6588
|
let scale = 1;
|
|
6589
|
+
const applyTransform = () => {
|
|
6590
|
+
const baseW = Math.max(600, ctx.container.clientWidth || 800);
|
|
6591
|
+
const baseH = Math.max(400, ctx.container.clientHeight || 600);
|
|
6592
|
+
const scaledW = Math.round(baseW * scale);
|
|
6593
|
+
const scaledH = Math.round(baseH * scale);
|
|
6594
|
+
sizer.style.width = `${scaledW}px`;
|
|
6595
|
+
sizer.style.height = `${scaledH}px`;
|
|
6596
|
+
iframe.style.position = "absolute";
|
|
6597
|
+
iframe.style.top = "0";
|
|
6598
|
+
iframe.style.left = "0";
|
|
6599
|
+
iframe.style.width = `${baseW}px`;
|
|
6600
|
+
iframe.style.height = `${baseH}px`;
|
|
6601
|
+
iframe.style.transform = `scale(${scale})`;
|
|
6602
|
+
iframe.style.transformOrigin = "top left";
|
|
6603
|
+
};
|
|
6604
|
+
requestAnimationFrame(() => {
|
|
6605
|
+
applyTransform();
|
|
6606
|
+
});
|
|
6312
6607
|
const cleanup = () => {
|
|
6313
|
-
|
|
6608
|
+
sizer.remove();
|
|
6314
6609
|
ctx.container.innerHTML = "";
|
|
6315
6610
|
};
|
|
6316
6611
|
ctx.signal.addEventListener("abort", cleanup);
|
|
@@ -6318,26 +6613,26 @@ var HtmlPreviewPlugin = class {
|
|
|
6318
6613
|
destroy: cleanup,
|
|
6319
6614
|
zoomIn: () => {
|
|
6320
6615
|
scale += 0.1;
|
|
6321
|
-
|
|
6616
|
+
applyTransform();
|
|
6322
6617
|
},
|
|
6323
6618
|
zoomOut: () => {
|
|
6324
6619
|
scale = Math.max(0.2, scale - 0.1);
|
|
6325
|
-
|
|
6620
|
+
applyTransform();
|
|
6326
6621
|
},
|
|
6327
6622
|
getZoom: () => scale,
|
|
6328
6623
|
setZoom: (level) => {
|
|
6329
6624
|
scale = level;
|
|
6330
|
-
|
|
6625
|
+
applyTransform();
|
|
6331
6626
|
},
|
|
6332
6627
|
fitToPage: () => {
|
|
6333
6628
|
scale = 1;
|
|
6334
|
-
|
|
6629
|
+
applyTransform();
|
|
6335
6630
|
},
|
|
6336
6631
|
resetZoom: () => {
|
|
6337
6632
|
scale = 1;
|
|
6338
|
-
iframe.style.transform = "scale(1)";
|
|
6339
6633
|
ctx.container.scrollTop = 0;
|
|
6340
6634
|
ctx.container.scrollLeft = 0;
|
|
6635
|
+
applyTransform();
|
|
6341
6636
|
},
|
|
6342
6637
|
copy: () => {
|
|
6343
6638
|
navigator.clipboard.writeText(rawHtml);
|
|
@@ -6512,10 +6807,26 @@ var OpenDocumentPlugin = class {
|
|
|
6512
6807
|
container.className = "fp-odf-container";
|
|
6513
6808
|
container.style.width = "100%";
|
|
6514
6809
|
container.style.height = "100%";
|
|
6515
|
-
container.style.
|
|
6516
|
-
container.style.overflowY = "auto";
|
|
6517
|
-
container.style.padding = "16px 8px";
|
|
6810
|
+
container.style.overflow = "auto";
|
|
6518
6811
|
container.style.backgroundColor = "#f1f5f9";
|
|
6812
|
+
const scrollWrapper = document.createElement("div");
|
|
6813
|
+
scrollWrapper.className = "fp-odf-scroll-wrapper";
|
|
6814
|
+
scrollWrapper.style.minWidth = "100%";
|
|
6815
|
+
scrollWrapper.style.minHeight = "100%";
|
|
6816
|
+
scrollWrapper.style.width = "max-content";
|
|
6817
|
+
scrollWrapper.style.height = "max-content";
|
|
6818
|
+
scrollWrapper.style.display = "flex";
|
|
6819
|
+
scrollWrapper.style.justifyContent = "center";
|
|
6820
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
6821
|
+
scrollWrapper.style.padding = "16px 8px";
|
|
6822
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
6823
|
+
const sizer = document.createElement("div");
|
|
6824
|
+
sizer.className = "fp-odf-sizer";
|
|
6825
|
+
sizer.style.position = "relative";
|
|
6826
|
+
sizer.style.flexShrink = "0";
|
|
6827
|
+
sizer.style.display = "flex";
|
|
6828
|
+
sizer.style.justifyContent = "center";
|
|
6829
|
+
sizer.style.alignItems = "center";
|
|
6519
6830
|
const wrapper = document.createElement("div");
|
|
6520
6831
|
wrapper.className = "fp-odf-wrapper";
|
|
6521
6832
|
wrapper.style.margin = "0 auto";
|
|
@@ -6524,9 +6835,12 @@ var OpenDocumentPlugin = class {
|
|
|
6524
6835
|
wrapper.style.backgroundColor = "#ffffff";
|
|
6525
6836
|
wrapper.style.boxShadow = "0 2px 10px rgba(0,0,0,0.08)";
|
|
6526
6837
|
wrapper.style.borderRadius = "4px";
|
|
6527
|
-
wrapper.style.transformOrigin = "
|
|
6838
|
+
wrapper.style.transformOrigin = "center center";
|
|
6528
6839
|
wrapper.style.transition = "transform 0.15s ease";
|
|
6529
|
-
|
|
6840
|
+
wrapper.style.flexShrink = "0";
|
|
6841
|
+
sizer.appendChild(wrapper);
|
|
6842
|
+
scrollWrapper.appendChild(sizer);
|
|
6843
|
+
container.appendChild(scrollWrapper);
|
|
6530
6844
|
ctx.container.appendChild(container);
|
|
6531
6845
|
let scale = 1;
|
|
6532
6846
|
let rotation = 0;
|
|
@@ -6552,13 +6866,18 @@ var OpenDocumentPlugin = class {
|
|
|
6552
6866
|
return Math.max(0.4, Math.min(3, sW));
|
|
6553
6867
|
};
|
|
6554
6868
|
const applyTransform = () => {
|
|
6555
|
-
wrapper.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
6556
|
-
wrapper.style.transformOrigin = "top center";
|
|
6557
6869
|
const activeSlide = slides[currentPage - 1];
|
|
6870
|
+
const elW = isPresentation ? 960 : 816;
|
|
6558
6871
|
const baseH = activeSlide?.offsetHeight || wrapper.offsetHeight || 1056;
|
|
6559
|
-
const
|
|
6560
|
-
const
|
|
6561
|
-
|
|
6872
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
6873
|
+
const boxW = Math.round((isRotated90 ? baseH : elW) * scale);
|
|
6874
|
+
const boxH = Math.round((isRotated90 ? elW : baseH) * scale);
|
|
6875
|
+
sizer.style.width = `${boxW}px`;
|
|
6876
|
+
sizer.style.height = `${boxH}px`;
|
|
6877
|
+
wrapper.style.width = `${elW}px`;
|
|
6878
|
+
wrapper.style.height = `${baseH}px`;
|
|
6879
|
+
wrapper.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
6880
|
+
wrapper.style.transformOrigin = "center center";
|
|
6562
6881
|
};
|
|
6563
6882
|
const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
|
|
6564
6883
|
if (!isUserZoomed) {
|
|
@@ -7122,13 +7441,28 @@ var DocPlugin = class {
|
|
|
7122
7441
|
container.className = "fp-doc-container";
|
|
7123
7442
|
container.style.width = "100%";
|
|
7124
7443
|
container.style.height = "100%";
|
|
7125
|
-
container.style.
|
|
7126
|
-
container.style.overflowY = "auto";
|
|
7127
|
-
container.style.padding = "16px 8px";
|
|
7444
|
+
container.style.overflow = "auto";
|
|
7128
7445
|
container.style.backgroundColor = "#f1f5f9";
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7446
|
+
const scrollWrapper = document.createElement("div");
|
|
7447
|
+
scrollWrapper.className = "fp-doc-scroll-wrapper";
|
|
7448
|
+
scrollWrapper.style.minWidth = "100%";
|
|
7449
|
+
scrollWrapper.style.minHeight = "100%";
|
|
7450
|
+
scrollWrapper.style.width = "max-content";
|
|
7451
|
+
scrollWrapper.style.height = "max-content";
|
|
7452
|
+
scrollWrapper.style.display = "flex";
|
|
7453
|
+
scrollWrapper.style.justifyContent = "center";
|
|
7454
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
7455
|
+
scrollWrapper.style.padding = "16px 8px";
|
|
7456
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
7457
|
+
const sizer = document.createElement("div");
|
|
7458
|
+
sizer.className = "fp-doc-sizer";
|
|
7459
|
+
sizer.style.position = "relative";
|
|
7460
|
+
sizer.style.flexShrink = "0";
|
|
7461
|
+
sizer.style.display = "flex";
|
|
7462
|
+
sizer.style.justifyContent = "center";
|
|
7463
|
+
sizer.style.alignItems = "center";
|
|
7464
|
+
scrollWrapper.appendChild(sizer);
|
|
7465
|
+
container.appendChild(scrollWrapper);
|
|
7132
7466
|
ctx.container.appendChild(container);
|
|
7133
7467
|
let scale = 1;
|
|
7134
7468
|
let extractedRawText = "";
|
|
@@ -7176,10 +7510,11 @@ var DocPlugin = class {
|
|
|
7176
7510
|
pageCard.style.padding = "72px 56px";
|
|
7177
7511
|
pageCard.style.boxSizing = "border-box";
|
|
7178
7512
|
pageCard.style.display = i === 0 ? "block" : "none";
|
|
7179
|
-
pageCard.style.transformOrigin = "
|
|
7513
|
+
pageCard.style.transformOrigin = "center center";
|
|
7180
7514
|
pageCard.style.transition = "transform 0.15s ease";
|
|
7181
7515
|
pageCard.style.fontFamily = 'Calibri, "Segoe UI", Arial, sans-serif';
|
|
7182
7516
|
pageCard.style.color = "#1e293b";
|
|
7517
|
+
pageCard.style.flexShrink = "0";
|
|
7183
7518
|
if (isFallback && i === 0) {
|
|
7184
7519
|
pageCard.innerHTML = `
|
|
7185
7520
|
<div style="border-bottom: 1px solid #e2e8f0; padding-bottom: 12px; margin-bottom: 24px;">
|
|
@@ -7191,18 +7526,23 @@ var DocPlugin = class {
|
|
|
7191
7526
|
} else {
|
|
7192
7527
|
pageCard.innerHTML = this.formatDocToHtml(rawPages[i], ctx.metadata.name || "Document");
|
|
7193
7528
|
}
|
|
7194
|
-
|
|
7529
|
+
sizer.appendChild(pageCard);
|
|
7195
7530
|
pageCards.push(pageCard);
|
|
7196
7531
|
}
|
|
7197
7532
|
let rotation = 0;
|
|
7198
7533
|
const applyTransform = () => {
|
|
7199
7534
|
const activeCard = pageCards[currentPage - 1];
|
|
7200
7535
|
if (activeCard) {
|
|
7201
|
-
|
|
7536
|
+
const baseW = 816;
|
|
7202
7537
|
const baseH = activeCard.offsetHeight || 1056;
|
|
7203
|
-
const
|
|
7204
|
-
const
|
|
7205
|
-
|
|
7538
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
7539
|
+
const boxW = Math.round((isRotated90 ? baseH : baseW) * scale);
|
|
7540
|
+
const boxH = Math.round((isRotated90 ? baseW : baseH) * scale);
|
|
7541
|
+
sizer.style.width = `${boxW}px`;
|
|
7542
|
+
sizer.style.height = `${boxH}px`;
|
|
7543
|
+
activeCard.style.width = `${baseW}px`;
|
|
7544
|
+
activeCard.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
7545
|
+
activeCard.style.transformOrigin = "center center";
|
|
7206
7546
|
}
|
|
7207
7547
|
};
|
|
7208
7548
|
const showPage = (pageNum) => {
|
|
@@ -7210,11 +7550,11 @@ var DocPlugin = class {
|
|
|
7210
7550
|
pageCards.forEach((card, idx) => {
|
|
7211
7551
|
if (idx + 1 === currentPage) {
|
|
7212
7552
|
card.style.display = "block";
|
|
7213
|
-
card.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
7214
7553
|
} else {
|
|
7215
7554
|
card.style.display = "none";
|
|
7216
7555
|
}
|
|
7217
7556
|
});
|
|
7557
|
+
applyTransform();
|
|
7218
7558
|
container.scrollTop = 0;
|
|
7219
7559
|
ctx.emit("page-change", { page: currentPage, total: totalPages });
|
|
7220
7560
|
};
|
|
@@ -7285,6 +7625,8 @@ var DocPlugin = class {
|
|
|
7285
7625
|
fitMode = "width";
|
|
7286
7626
|
scale = calculateFitScale("width");
|
|
7287
7627
|
rotation = 0;
|
|
7628
|
+
container.scrollTop = 0;
|
|
7629
|
+
container.scrollLeft = 0;
|
|
7288
7630
|
ctx.container.scrollTop = 0;
|
|
7289
7631
|
ctx.container.scrollLeft = 0;
|
|
7290
7632
|
applyTransform();
|
|
@@ -7809,17 +8151,30 @@ var PptPlugin = class {
|
|
|
7809
8151
|
container.style.width = "100%";
|
|
7810
8152
|
container.style.height = "100%";
|
|
7811
8153
|
container.style.overflow = "auto";
|
|
7812
|
-
container.style.display = "flex";
|
|
7813
|
-
container.style.justifyContent = "center";
|
|
7814
|
-
container.style.alignItems = "center";
|
|
7815
|
-
container.style.padding = "32px 16px";
|
|
7816
8154
|
container.style.backgroundColor = "#0f172a";
|
|
7817
8155
|
container.style.boxSizing = "border-box";
|
|
8156
|
+
const scrollWrapper = document.createElement("div");
|
|
8157
|
+
scrollWrapper.className = "fp-ppt-scroll-wrapper";
|
|
8158
|
+
scrollWrapper.style.minWidth = "100%";
|
|
8159
|
+
scrollWrapper.style.minHeight = "100%";
|
|
8160
|
+
scrollWrapper.style.width = "max-content";
|
|
8161
|
+
scrollWrapper.style.height = "max-content";
|
|
8162
|
+
scrollWrapper.style.display = "flex";
|
|
8163
|
+
scrollWrapper.style.justifyContent = "center";
|
|
8164
|
+
scrollWrapper.style.alignItems = "center";
|
|
8165
|
+
scrollWrapper.style.padding = "32px 16px";
|
|
8166
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
8167
|
+
const sizer = document.createElement("div");
|
|
8168
|
+
sizer.className = "fp-ppt-sizer";
|
|
8169
|
+
sizer.style.position = "relative";
|
|
8170
|
+
sizer.style.flexShrink = "0";
|
|
8171
|
+
sizer.style.display = "flex";
|
|
8172
|
+
sizer.style.justifyContent = "center";
|
|
8173
|
+
sizer.style.alignItems = "center";
|
|
7818
8174
|
const slideCard = document.createElement("div");
|
|
7819
8175
|
slideCard.className = "fp-ppt-slide-card";
|
|
7820
8176
|
slideCard.style.width = "960px";
|
|
7821
|
-
slideCard.style.
|
|
7822
|
-
slideCard.style.maxHeight = "calc(100% - 48px)";
|
|
8177
|
+
slideCard.style.height = "540px";
|
|
7823
8178
|
slideCard.style.aspectRatio = "16 / 9";
|
|
7824
8179
|
slideCard.style.backgroundColor = "#ffffff";
|
|
7825
8180
|
slideCard.style.boxShadow = "0 12px 40px rgba(0,0,0,0.35)";
|
|
@@ -7829,7 +8184,9 @@ var PptPlugin = class {
|
|
|
7829
8184
|
slideCard.style.transition = "transform 0.2s ease";
|
|
7830
8185
|
slideCard.style.transformOrigin = "center center";
|
|
7831
8186
|
slideCard.style.flexShrink = "0";
|
|
7832
|
-
|
|
8187
|
+
sizer.appendChild(slideCard);
|
|
8188
|
+
scrollWrapper.appendChild(sizer);
|
|
8189
|
+
container.appendChild(scrollWrapper);
|
|
7833
8190
|
ctx.container.appendChild(container);
|
|
7834
8191
|
let scale = 1;
|
|
7835
8192
|
let rotation = 0;
|
|
@@ -7842,7 +8199,17 @@ var PptPlugin = class {
|
|
|
7842
8199
|
return Math.min(1, Math.min(availW / 960, availH / 540));
|
|
7843
8200
|
};
|
|
7844
8201
|
const applyTransform = () => {
|
|
8202
|
+
const cW = 960;
|
|
8203
|
+
const cH = 540;
|
|
8204
|
+
const isRotated90 = rotation % 180 !== 0;
|
|
8205
|
+
const boxW = Math.round((isRotated90 ? cH : cW) * scale);
|
|
8206
|
+
const boxH = Math.round((isRotated90 ? cW : cH) * scale);
|
|
8207
|
+
sizer.style.width = `${boxW}px`;
|
|
8208
|
+
sizer.style.height = `${boxH}px`;
|
|
8209
|
+
slideCard.style.width = `${cW}px`;
|
|
8210
|
+
slideCard.style.height = `${cH}px`;
|
|
7845
8211
|
slideCard.style.transform = `scale(${scale}) rotate(${rotation}deg)`;
|
|
8212
|
+
slideCard.style.transformOrigin = "center center";
|
|
7846
8213
|
};
|
|
7847
8214
|
setTimeout(() => {
|
|
7848
8215
|
scale = calculateFitScale();
|