mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Use JSON imports instead of PDFJSDev.json
JSON imports are now supported by all tools used in PDF.js' build process. The `chromecom.js` file is bundled by webpack and import attributes are thus removed, so browser compatibility for this new syntax is not relevant.
This commit is contained in:
parent
658a0a16c1
commit
a8592d86a9
7 changed files with 7 additions and 26 deletions
|
@ -20,6 +20,9 @@ import { BasePreferences } from "./preferences.js";
|
|||
import { GenericL10n } from "./genericl10n.js";
|
||||
import { GenericScripting } from "./generic_scripting.js";
|
||||
|
||||
// These strings are from chrome/app/resources/generated_resources_*.xtb.
|
||||
import i18nFileAccessLabels from "./chrome-i18n-allow-access-to-file-urls.json" with { type: "json" };
|
||||
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) {
|
||||
throw new Error(
|
||||
'Module "pdfjs-web/chromecom" shall not be used outside CHROME build.'
|
||||
|
@ -194,11 +197,8 @@ function requestAccessToLocalFile(fileUrl, overlayManager, callback) {
|
|||
|
||||
// Use Chrome's definition of UI language instead of PDF.js's #lang=...,
|
||||
// because the shown string should match the UI at chrome://extensions.
|
||||
// These strings are from chrome/app/resources/generated_resources_*.xtb.
|
||||
const i18nFileAccessLabel = PDFJSDev.json(
|
||||
"$ROOT/web/chrome-i18n-allow-access-to-file-urls.json"
|
||||
)[chrome.i18n.getUILanguage?.()];
|
||||
|
||||
const i18nFileAccessLabel =
|
||||
i18nFileAccessLabels[chrome.i18n.getUILanguage?.()];
|
||||
if (i18nFileAccessLabel) {
|
||||
document.getElementById("chrome-file-access-label").textContent =
|
||||
i18nFileAccessLabel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue