Skip to content

Commit ad58a76

Browse files
committed
Merge branch 'pdfviewer-arrows' into 'main'
PDF viewer: Allow navigation via arrow keys See merge request reportcreator/reportcreator!955
2 parents 0dfb061 + b275d0d commit ad58a76

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Sync scroll in markdown editor and preview
55
* Pin ghostscript version to fix bugs in pdf compression
66
* Prevent PDF rendering Vue warning about tr children of table tags
7+
* PDF viewer: Allow navigation via arrow keys
78
* UI: Add a button to expand collapsed menus
89
* UI: Fix sections not sorted in sidebar
910
* UI: Add shortcut indicator to save comments

packages/pdfviewer/src/viewer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ class PDFViewerApplicationClass {
240240
this.download();
241241
handled = true;
242242
}
243+
} else if (!e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey) {
244+
if (
245+
(e.key === 'ArrowLeft' && !this.pdfViewer.isHorizontalScrollbarEnabled) ||
246+
e.key === 'k' ||
247+
e.key === 'p'
248+
) {
249+
this.pdfViewer.previousPage();
250+
handled = true;
251+
} else if (
252+
(e.key === 'ArrowRight' && !this.pdfViewer.isHorizontalScrollbarEnabled) ||
253+
e.key === 'j' ||
254+
e.key === 'n'
255+
) {
256+
this.pdfViewer.nextPage();
257+
handled = true;
258+
}
243259
}
244260

245261
if (handled) {

0 commit comments

Comments
 (0)