Merge pull request #14857 from Snuffleupagus/rm-webViewerOpenFileViaURL
Inline the `webViewerOpenFileViaURL` function in `webViewerInitialized`
This commit is contained in:
commit
75ac897284
39
web/app.js
39
web/app.js
@ -2229,7 +2229,18 @@ function webViewerInitialized() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
webViewerOpenFileViaURL(file);
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
|
if (file) {
|
||||||
|
PDFViewerApplication.open(file);
|
||||||
|
} else {
|
||||||
|
PDFViewerApplication._hideViewBookmark();
|
||||||
|
}
|
||||||
|
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
||||||
|
PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file);
|
||||||
|
PDFViewerApplication.initPassiveLoading();
|
||||||
|
} else {
|
||||||
|
throw new Error("Not implemented: webViewerInitialized");
|
||||||
|
}
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
PDFViewerApplication.l10n.get("loading_error").then(msg => {
|
PDFViewerApplication.l10n.get("loading_error").then(msg => {
|
||||||
PDFViewerApplication._documentError(msg, reason);
|
PDFViewerApplication._documentError(msg, reason);
|
||||||
@ -2237,25 +2248,6 @@ function webViewerInitialized() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function webViewerOpenFileViaURL(file) {
|
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|
||||||
if (file) {
|
|
||||||
PDFViewerApplication.open(file);
|
|
||||||
} else {
|
|
||||||
PDFViewerApplication._hideViewBookmark();
|
|
||||||
}
|
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
|
||||||
PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file);
|
|
||||||
PDFViewerApplication.initPassiveLoading();
|
|
||||||
} else {
|
|
||||||
if (file) {
|
|
||||||
throw new Error("Not implemented: webViewerOpenFileViaURL");
|
|
||||||
} else {
|
|
||||||
PDFViewerApplication._hideViewBookmark();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function webViewerPageRendered({ pageNumber, error }) {
|
function webViewerPageRendered({ pageNumber, error }) {
|
||||||
// If the page is still visible when it has finished rendering,
|
// If the page is still visible when it has finished rendering,
|
||||||
// ensure that the page number input loading indicator is hidden.
|
// ensure that the page number input loading indicator is hidden.
|
||||||
@ -2432,9 +2424,9 @@ function webViewerHashchange(evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let webViewerFileInputChange, webViewerOpenFile;
|
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
webViewerFileInputChange = function (evt) {
|
// eslint-disable-next-line no-var
|
||||||
|
var webViewerFileInputChange = function (evt) {
|
||||||
if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {
|
if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {
|
||||||
return; // Opening a new PDF file isn't supported in Presentation Mode.
|
return; // Opening a new PDF file isn't supported in Presentation Mode.
|
||||||
}
|
}
|
||||||
@ -2447,7 +2439,8 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|||||||
PDFViewerApplication.open(url);
|
PDFViewerApplication.open(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
webViewerOpenFile = function (evt) {
|
// eslint-disable-next-line no-var
|
||||||
|
var webViewerOpenFile = function (evt) {
|
||||||
const fileInput = PDFViewerApplication.appConfig.openFileInput;
|
const fileInput = PDFViewerApplication.appConfig.openFileInput;
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user