Merge pull request #16006 from Snuffleupagus/viewer-rm-pdfDocument-checks
Miscellaneous small viewer improvements
This commit is contained in:
commit
ab6b4ca1f2
28
web/app.js
28
web/app.js
@ -2166,7 +2166,7 @@ function reportPageStatsPDFBug({ pageNumber }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function webViewerInitialized() {
|
function webViewerInitialized() {
|
||||||
const { appConfig, eventBus } = PDFViewerApplication;
|
const { appConfig, eventBus, l10n } = PDFViewerApplication;
|
||||||
let file;
|
let file;
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
const queryString = document.location.search.substring(1);
|
const queryString = document.location.search.substring(1);
|
||||||
@ -2217,7 +2217,7 @@ function webViewerInitialized() {
|
|||||||
|
|
||||||
if (!PDFViewerApplication.supportsDocumentFonts) {
|
if (!PDFViewerApplication.supportsDocumentFonts) {
|
||||||
AppOptions.set("disableFontFace", true);
|
AppOptions.set("disableFontFace", true);
|
||||||
PDFViewerApplication.l10n.get("web_fonts_disabled").then(msg => {
|
l10n.get("web_fonts_disabled").then(msg => {
|
||||||
console.warn(msg);
|
console.warn(msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2259,7 +2259,7 @@ function webViewerInitialized() {
|
|||||||
throw new Error("Not implemented: webViewerInitialized");
|
throw new Error("Not implemented: webViewerInitialized");
|
||||||
}
|
}
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
PDFViewerApplication.l10n.get("loading_error").then(msg => {
|
l10n.get("loading_error").then(msg => {
|
||||||
PDFViewerApplication._documentError(msg, reason);
|
PDFViewerApplication._documentError(msg, reason);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2487,14 +2487,10 @@ function webViewerDownload() {
|
|||||||
PDFViewerApplication.downloadOrSave();
|
PDFViewerApplication.downloadOrSave();
|
||||||
}
|
}
|
||||||
function webViewerFirstPage() {
|
function webViewerFirstPage() {
|
||||||
if (PDFViewerApplication.pdfDocument) {
|
PDFViewerApplication.page = 1;
|
||||||
PDFViewerApplication.page = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function webViewerLastPage() {
|
function webViewerLastPage() {
|
||||||
if (PDFViewerApplication.pdfDocument) {
|
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
|
||||||
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function webViewerNextPage() {
|
function webViewerNextPage() {
|
||||||
PDFViewerApplication.pdfViewer.nextPage();
|
PDFViewerApplication.pdfViewer.nextPage();
|
||||||
@ -2958,12 +2954,12 @@ function webViewerKeyDown(evt) {
|
|||||||
if (!PDFViewerApplication.supportsIntegratedFind) {
|
if (!PDFViewerApplication.supportsIntegratedFind) {
|
||||||
const { state } = PDFViewerApplication.findController;
|
const { state } = PDFViewerApplication.findController;
|
||||||
if (state) {
|
if (state) {
|
||||||
const eventState = Object.assign(Object.create(null), state, {
|
const newState = {
|
||||||
source: window,
|
source: window,
|
||||||
type: "again",
|
type: "again",
|
||||||
findPrevious: cmd === 5 || cmd === 12,
|
findPrevious: cmd === 5 || cmd === 12,
|
||||||
});
|
};
|
||||||
eventBus.dispatch("find", eventState);
|
eventBus.dispatch("find", { ...state, ...newState });
|
||||||
}
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
@ -2972,17 +2968,13 @@ function webViewerKeyDown(evt) {
|
|||||||
case 107: // FF '+' and '='
|
case 107: // FF '+' and '='
|
||||||
case 187: // Chrome '+'
|
case 187: // Chrome '+'
|
||||||
case 171: // FF with German keyboard
|
case 171: // FF with German keyboard
|
||||||
if (!isViewerInPresentationMode) {
|
PDFViewerApplication.zoomIn();
|
||||||
PDFViewerApplication.zoomIn();
|
|
||||||
}
|
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
case 173: // FF/Mac '-'
|
case 173: // FF/Mac '-'
|
||||||
case 109: // FF '-'
|
case 109: // FF '-'
|
||||||
case 189: // Chrome '-'
|
case 189: // Chrome '-'
|
||||||
if (!isViewerInPresentationMode) {
|
PDFViewerApplication.zoomOut();
|
||||||
PDFViewerApplication.zoomOut();
|
|
||||||
}
|
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
case 48: // '0'
|
case 48: // '0'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user