@yudaocode/univer-pdfs-ui 1.6.204 → 1.6.206
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/lib/cjs/index.js +7 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +7 -2
- package/lib/es/index.js.map +1 -1
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -997,8 +997,13 @@ function configurePdfjsAssets(assets) {
|
|
|
997
997
|
defaultWorkerAttempted = true;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
+
function resolveGlobalPdfjsAssets() {
|
|
1001
|
+
const g = globalThis?.__YUDAO_UNIVER_PDFJS_ASSETS__;
|
|
1002
|
+
return g && typeof g === "object" ? g : void 0;
|
|
1003
|
+
}
|
|
1000
1004
|
function getPdfjsAssetsConfig() {
|
|
1001
|
-
|
|
1005
|
+
const eff = configuredAssets ?? resolveGlobalPdfjsAssets();
|
|
1006
|
+
return eff ? { ...eff } : void 0;
|
|
1002
1007
|
}
|
|
1003
1008
|
function ensurePdfjsWorker(assets) {
|
|
1004
1009
|
if (assets?.workerSrc) {
|
|
@@ -1072,7 +1077,7 @@ function evictOverflowCacheEntries() {
|
|
|
1072
1077
|
}
|
|
1073
1078
|
}
|
|
1074
1079
|
function loadPdfDocument(dataUri, overrideAssets) {
|
|
1075
|
-
const effectiveAssets = overrideAssets ?? configuredAssets;
|
|
1080
|
+
const effectiveAssets = overrideAssets ?? configuredAssets ?? resolveGlobalPdfjsAssets();
|
|
1076
1081
|
ensurePdfjsWorker(effectiveAssets);
|
|
1077
1082
|
const bytes = dataUriToUint8Array(dataUri);
|
|
1078
1083
|
const cacheKey = (0, import_univer_pdfs2.computePdfPayloadDigest)(bytes);
|