Re-factor how the "docBaseUrl" API-option is set in the viewer

This option is old enough that it predates e.g. the introduction of AppOptions, so it probably cannot hurt to re-factor this a little bit now.

 - In development-mode we can just set this directly in AppOptions.

 - In the extension-builds we still need to set it dynamically, however by moving this code we get the benefit of being able to avoid storing a data-URL in that case; note how [the API ignores those anyway](98e772727e/src/display/api.js (L256-L262)).
This commit is contained in:
Jonas Jenwald 2024-07-21 21:55:37 +02:00
parent 98e772727e
commit 12e083f60d
2 changed files with 7 additions and 8 deletions

View file

@ -345,7 +345,7 @@ const defaultOptions = {
},
docBaseUrl: {
/** @type {string} */
value: "",
value: typeof PDFJSDev === "undefined" ? document.URL.split("#", 1)[0] : "",
kind: OptionKind.API,
},
enableHWA: {