Merge pull request #11826 from Snuffleupagus/issue-11657

Change the "download" keyboard shortcut (Ctrl+S) handling, in GENERIC/CHROME builds, to utilize the `EventBus` (issue 11657); add a new "openfile" keyboard shortcut (Ctrl+O), in GENERIC builds
This commit is contained in:
Tim van der Meij 2020-04-21 00:15:14 +02:00 committed by GitHub
commit f243f0564e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2571,14 +2571,23 @@ function webViewerKeyDown(evt) {
}
}
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC || CHROME")) {
const { eventBus } = PDFViewerApplication;
// CTRL or META without shift
if (cmd === 1 || cmd === 8) {
switch (evt.keyCode) {
case 83: // s
PDFViewerApplication.download();
eventBus.dispatch("download", { source: window });
handled = true;
break;
case 79: // o
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
eventBus.dispatch("openfile", { source: window });
handled = true;
}
break;
}
}
}