mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Merge pull request #18476 from Snuffleupagus/viewer-mv-docBaseUrl
Re-factor how the "docBaseUrl" API-option is set in the viewer
This commit is contained in:
commit
deaac2839e
2 changed files with 7 additions and 8 deletions
13
web/app.js
13
web/app.js
|
@ -854,7 +854,13 @@ const PDFViewerApplication = {
|
||||||
}
|
}
|
||||||
if (isDataScheme(url)) {
|
if (isDataScheme(url)) {
|
||||||
this._hideViewBookmark();
|
this._hideViewBookmark();
|
||||||
|
} else if (
|
||||||
|
typeof PDFJSDev !== "undefined" &&
|
||||||
|
PDFJSDev.test("MOZCENTRAL || CHROME")
|
||||||
|
) {
|
||||||
|
AppOptions.set("docBaseUrl", this.baseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
let title = getPdfFilenameFromUrl(url, "");
|
let title = getPdfFilenameFromUrl(url, "");
|
||||||
if (!title) {
|
if (!title) {
|
||||||
try {
|
try {
|
||||||
|
@ -996,13 +1002,6 @@ const PDFViewerApplication = {
|
||||||
/* downloadUrl = */ args.url
|
/* downloadUrl = */ args.url
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Always set `docBaseUrl` in development mode, and in the (various)
|
|
||||||
// extension builds.
|
|
||||||
if (typeof PDFJSDev === "undefined") {
|
|
||||||
AppOptions.set("docBaseUrl", document.URL.split("#", 1)[0]);
|
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
|
||||||
AppOptions.set("docBaseUrl", this.baseUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the necessary API parameters, using all the available options.
|
// Set the necessary API parameters, using all the available options.
|
||||||
const apiParams = AppOptions.getAll(OptionKind.API);
|
const apiParams = AppOptions.getAll(OptionKind.API);
|
||||||
|
|
|
@ -345,7 +345,7 @@ const defaultOptions = {
|
||||||
},
|
},
|
||||||
docBaseUrl: {
|
docBaseUrl: {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value: "",
|
value: typeof PDFJSDev === "undefined" ? document.URL.split("#", 1)[0] : "",
|
||||||
kind: OptionKind.API,
|
kind: OptionKind.API,
|
||||||
},
|
},
|
||||||
enableHWA: {
|
enableHWA: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue