Update app.js

This commit is contained in:
Aditya kumar singh 2025-09-16 00:33:42 +05:30
parent e751fd0f68
commit 244c528883

View File

@ -404,10 +404,10 @@ const PDFViewerApplication = {
const eventBus =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
? new FirefoxEventBus(
AppOptions.get("allowedGlobalEvents"),
externalServices,
AppOptions.get("isInAutomation")
)
AppOptions.get("allowedGlobalEvents"),
externalServices,
AppOptions.get("isInAutomation")
)
: new EventBus();
this.eventBus = AppOptions.eventBus = eventBus;
@ -448,30 +448,30 @@ const PDFViewerApplication = {
const annotationEditorMode = AppOptions.get("annotationEditorMode");
const pageColors =
AppOptions.get("forcePageColors") ||
window.matchMedia("(forced-colors: active)").matches
window.matchMedia("(forced-colors: active)").matches
? {
background: AppOptions.get("pageColorsBackground"),
foreground: AppOptions.get("pageColorsForeground"),
}
background: AppOptions.get("pageColorsBackground"),
foreground: AppOptions.get("pageColorsForeground"),
}
: null;
let altTextManager;
if (AppOptions.get("enableUpdatedAddImage")) {
altTextManager = appConfig.newAltTextDialog
? new NewAltTextManager(
appConfig.newAltTextDialog,
overlayManager,
eventBus
)
appConfig.newAltTextDialog,
overlayManager,
eventBus
)
: null;
} else {
altTextManager = appConfig.altTextDialog
? new AltTextManager(
appConfig.altTextDialog,
container,
overlayManager,
eventBus
)
appConfig.altTextDialog,
container,
overlayManager,
eventBus
)
: null;
}
@ -482,15 +482,15 @@ const PDFViewerApplication = {
const signatureManager =
AppOptions.get("enableSignatureEditor") && appConfig.addSignatureDialog
? new SignatureManager(
appConfig.addSignatureDialog,
appConfig.editSignatureDialog,
appConfig.annotationEditorParams?.editorSignatureAddSignature ||
null,
overlayManager,
l10n,
externalServices.createSignatureStorage(eventBus, abortSignal),
eventBus
)
appConfig.addSignatureDialog,
appConfig.editSignatureDialog,
appConfig.annotationEditorParams?.editorSignatureAddSignature ||
null,
overlayManager,
l10n,
externalServices.createSignatureStorage(eventBus, abortSignal),
eventBus
)
: null;
const ltr = appConfig.viewerContainer
@ -499,31 +499,31 @@ const PDFViewerApplication = {
const commentManager =
AppOptions.get("enableComment") && appConfig.editCommentDialog
? new CommentManager(
appConfig.editCommentDialog,
{
learnMoreUrl: AppOptions.get("commentLearnMoreUrl"),
sidebar:
appConfig.annotationEditorParams?.editorCommentsSidebar || null,
commentsList:
appConfig.annotationEditorParams?.editorCommentsSidebarList ||
null,
commentCount:
appConfig.annotationEditorParams?.editorCommentsSidebarCount ||
null,
sidebarTitle:
appConfig.annotationEditorParams?.editorCommentsSidebarTitle ||
null,
closeButton:
appConfig.annotationEditorParams
?.editorCommentsSidebarCloseButton || null,
commentToolbarButton:
appConfig.toolbar?.editorCommentButton || null,
},
eventBus,
linkService,
overlayManager,
ltr
)
appConfig.editCommentDialog,
{
learnMoreUrl: AppOptions.get("commentLearnMoreUrl"),
sidebar:
appConfig.annotationEditorParams?.editorCommentsSidebar || null,
commentsList:
appConfig.annotationEditorParams?.editorCommentsSidebarList ||
null,
commentCount:
appConfig.annotationEditorParams?.editorCommentsSidebarCount ||
null,
sidebarTitle:
appConfig.annotationEditorParams?.editorCommentsSidebarTitle ||
null,
closeButton:
appConfig.annotationEditorParams
?.editorCommentsSidebarCloseButton || null,
commentToolbarButton:
appConfig.toolbar?.editorCommentButton || null,
},
eventBus,
linkService,
overlayManager,
ltr
)
: null;
const enableHWA = AppOptions.get("enableHWA"),
@ -649,8 +649,8 @@ const PDFViewerApplication = {
overlayManager,
eventBus,
l10n,
/* fileNameLookup = */ () => this._docFilename,
/* titleLookup = */ () => this._docTitle
/* fileNameLookup = */() => this._docFilename,
/* titleLookup = */() => this._docTitle
);
}
@ -778,7 +778,7 @@ const PDFViewerApplication = {
const params = parseQueryString(queryString);
file = params.get("file") ?? AppOptions.get("defaultUrl");
try {
file = new URL(decodeURIComponent(file)).href;
file = new URL(file).href;
} catch {
file = encodeURIComponent(file).replaceAll("%2F", "/");
}
@ -957,7 +957,7 @@ const PDFViewerApplication = {
this,
"supportsPrinting",
AppOptions.get("supportsPrinting") &&
PDFPrintServiceFactory.supportsPrinting
PDFPrintServiceFactory.supportsPrinting
);
},
@ -1726,9 +1726,9 @@ const PDFViewerApplication = {
// Provides some basic debug information
console.log(
`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +
`${(metadata?.get("pdf:producer") || info.Producer || "-").trim()} / ` +
`${(metadata?.get("xmp:creatortool") || info.Creator || "-").trim()}` +
`] (PDF.js: ${version || "?"} [${build || "?"}])`
`${(metadata?.get("pdf:producer") || info.Producer || "-").trim()} / ` +
`${(metadata?.get("xmp:creatortool") || info.Creator || "-").trim()}` +
`] (PDF.js: ${version || "?"} [${build || "?"}])`
);
const pdfTitle = this._docTitle;
@ -2380,7 +2380,7 @@ const PDFViewerApplication = {
document.blockUnblockOnload?.(false);
// Ensure that this method is only ever run once.
this._unblockDocumentLoadEvent = () => {};
this._unblockDocumentLoadEvent = () => { };
},
/**