@tindtechnologies/pdfjs-viewer 5.4.624-tind.3 → 5.4.624-tind.5
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/build/pdf.mjs
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* pdfjsVersion = 5.4.0
|
|
25
|
-
* pdfjsBuild =
|
|
25
|
+
* pdfjsBuild = 9d59081
|
|
26
26
|
*/
|
|
27
27
|
/******/ // The require scope
|
|
28
28
|
/******/ var __webpack_require__ = {};
|
|
@@ -16121,7 +16121,7 @@ class InternalRenderTask {
|
|
|
16121
16121
|
}
|
|
16122
16122
|
}
|
|
16123
16123
|
const version = "5.4.0";
|
|
16124
|
-
const build = "
|
|
16124
|
+
const build = "9d59081";
|
|
16125
16125
|
|
|
16126
16126
|
;// ./src/display/editor/color_picker.js
|
|
16127
16127
|
|
package/build/pdf.sandbox.mjs
CHANGED
package/build/pdf.worker.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
const OPEN_PATCHED_FLAG = Symbol("tindPdfViewerApplicationOpenPatched");
|
|
2
|
+
const registeredDocuments = new WeakSet();
|
|
3
|
+
const SIDEBAR_VIEW_NONE = 0;
|
|
4
|
+
|
|
1
5
|
function patchPDFViewerApplicationOpen(evt) {
|
|
2
|
-
const
|
|
6
|
+
const sourceWindow = evt?.detail?.source;
|
|
7
|
+
if (sourceWindow && sourceWindow !== window) {
|
|
8
|
+
// Ignore events emitted by sibling iframe viewers sharing parent.document.
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const win = sourceWindow || window;
|
|
3
13
|
const app = win.PDFViewerApplication;
|
|
4
|
-
|
|
14
|
+
const appOptions = win.PDFViewerApplicationOptions;
|
|
15
|
+
if (!app || !appOptions || app[OPEN_PATCHED_FLAG]) {
|
|
5
16
|
return;
|
|
6
17
|
}
|
|
7
18
|
|
|
19
|
+
// Force the initial sidebar state to "closed" and ignore stored view history.
|
|
20
|
+
appOptions.set("sidebarViewOnLoad", SIDEBAR_VIEW_NONE);
|
|
21
|
+
|
|
8
22
|
const params = new URLSearchParams(win.location.search);
|
|
9
23
|
const rangeChunkSize = Number(params.get("chunksize"));
|
|
10
24
|
if (!Number.isInteger(rangeChunkSize) || rangeChunkSize <= 0) {
|
|
25
|
+
app[OPEN_PATCHED_FLAG] = true;
|
|
11
26
|
return;
|
|
12
27
|
}
|
|
13
28
|
|
|
@@ -15,6 +30,25 @@ function patchPDFViewerApplicationOpen(evt) {
|
|
|
15
30
|
|
|
16
31
|
const originalOpen = app.open.bind(app);
|
|
17
32
|
app.open = (args) => originalOpen({ ...args, rangeChunkSize, disableStream });
|
|
33
|
+
app[OPEN_PATCHED_FLAG] = true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function addWebViewerLoadedListener(targetDocument) {
|
|
37
|
+
if (!targetDocument || registeredDocuments.has(targetDocument)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
targetDocument.addEventListener(
|
|
42
|
+
"webviewerloaded",
|
|
43
|
+
patchPDFViewerApplicationOpen,
|
|
44
|
+
);
|
|
45
|
+
registeredDocuments.add(targetDocument);
|
|
18
46
|
}
|
|
19
47
|
|
|
20
|
-
document
|
|
48
|
+
addWebViewerLoadedListener(document);
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
addWebViewerLoadedListener(window.parent?.document);
|
|
52
|
+
} catch {
|
|
53
|
+
// Cross-origin or sandboxed iframe: parent.document is inaccessible.
|
|
54
|
+
}
|