Add a new "openfile" keyboard shortcut (Ctrl+O), in GENERIC builds

Somewhat surprisingly, despite the GENERIC viewer implementing "openfile" support, there's never been a keyboard shortcut available. Similar to the previous patch, this utilizes the `EventBus` for consistency with the `Toolbar`/`SecondaryToolbar` buttons.

*Please note:* This patch should NOT be construed as carte blanche to simply convert all of the code in `webViewerKeyDown`, or elsewhere, to make use of the `EventBus` instead of direct function calls.
Any further changes, along the lines in this patch, would need to be evaluated on a case-by-case basis to determine if they are actually wanted, given that many/most existing cases in `webViewerKeyDown` should already be *indirectly* observable through the `EventBus` instance.
This commit is contained in:
Jonas Jenwald 2020-04-20 15:55:02 +02:00
parent a8a22283c3
commit 5733d9dd24

View File

@ -2581,6 +2581,13 @@ function webViewerKeyDown(evt) {
eventBus.dispatch("download", { source: window }); eventBus.dispatch("download", { source: window });
handled = true; handled = true;
break; break;
case 79: // o
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
eventBus.dispatch("openfile", { source: window });
handled = true;
}
break;
} }
} }
} }