Prevent a "TypeError: pdfViewer is null" when the viewer loads (PR 5413 followup)
Currently if you manage to e.g. open the console (with <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd>) before the viewer is initialized, the following will be printed in the console: `TypeError: pdfViewer is null`. This doesn't cause any actual errors, but nevertheless it seems like something we should avoid. Followup to PR 5413.
This commit is contained in:
parent
de9838018e
commit
6078901962
@ -2024,9 +2024,9 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||||||
if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
|
if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
|
||||||
// either CTRL or META key with optional SHIFT.
|
// either CTRL or META key with optional SHIFT.
|
||||||
var pdfViewer = PDFViewerApplication.pdfViewer;
|
var pdfViewer = PDFViewerApplication.pdfViewer;
|
||||||
var inPresentationMode =
|
var inPresentationMode = pdfViewer &&
|
||||||
pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
|
(pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
|
||||||
pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN;
|
pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN);
|
||||||
|
|
||||||
switch (evt.keyCode) {
|
switch (evt.keyCode) {
|
||||||
case 70: // f
|
case 70: // f
|
||||||
|
Loading…
x
Reference in New Issue
Block a user