@yudaocode/univer-pdfs-ui 1.6.204 → 1.6.205
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/es/index.js
CHANGED
|
@@ -970,8 +970,13 @@ function configurePdfjsAssets(assets) {
|
|
|
970
970
|
defaultWorkerAttempted = true;
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
+
function resolveGlobalPdfjsAssets() {
|
|
974
|
+
const g = globalThis?.__YUDAO_UNIVER_PDFJS_ASSETS__;
|
|
975
|
+
return g && typeof g === "object" ? g : void 0;
|
|
976
|
+
}
|
|
973
977
|
function getPdfjsAssetsConfig() {
|
|
974
|
-
|
|
978
|
+
const eff = configuredAssets ?? resolveGlobalPdfjsAssets();
|
|
979
|
+
return eff ? { ...eff } : void 0;
|
|
975
980
|
}
|
|
976
981
|
function ensurePdfjsWorker(assets) {
|
|
977
982
|
if (assets?.workerSrc) {
|
|
@@ -1045,7 +1050,7 @@ function evictOverflowCacheEntries() {
|
|
|
1045
1050
|
}
|
|
1046
1051
|
}
|
|
1047
1052
|
function loadPdfDocument(dataUri, overrideAssets) {
|
|
1048
|
-
const effectiveAssets = overrideAssets ?? configuredAssets;
|
|
1053
|
+
const effectiveAssets = overrideAssets ?? configuredAssets ?? resolveGlobalPdfjsAssets();
|
|
1049
1054
|
ensurePdfjsWorker(effectiveAssets);
|
|
1050
1055
|
const bytes = dataUriToUint8Array(dataUri);
|
|
1051
1056
|
const cacheKey = computePdfPayloadDigest(bytes);
|