RED-10528: added support for F5 when the pdf viewer is focused.

This commit is contained in:
Nicoleta Panaghiu 2024-11-25 15:55:34 +02:00
parent 9d173f57bf
commit d20d99530a
2 changed files with 9 additions and 2 deletions

View File

@ -104,6 +104,7 @@ export class FileHeaderComponent implements OnInit, AfterViewInit, OnDetach, OnD
ngOnInit() {
document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener);
this._pdf.instance.UI.iframeWindow.addEventListener('keyup', this.handleKeyEvent);
}
ngAfterViewInit() {
@ -115,10 +116,12 @@ export class FileHeaderComponent implements OnInit, AfterViewInit, OnDetach, OnD
ngOnDetach() {
document.documentElement.removeEventListener('fullscreenchange', this.fullscreenListener);
this._pdf.instance.UI.iframeWindow.removeEventListener('keyup', this.handleKeyEvent);
}
ngOnDestroy() {
document.documentElement.removeEventListener('fullscreenchange', this.fullscreenListener);
this._pdf.instance.UI.iframeWindow.removeEventListener('keyup', this.handleKeyEvent);
}
async downloadOriginalFile({ cacheIdentifier, dossierId, fileId, filename }: File) {
@ -176,7 +179,7 @@ export class FileHeaderComponent implements OnInit, AfterViewInit, OnDetach, OnD
}
}
@HostListener('document:keyup', ['$event'])
@Bind()
handleKeyEvent($event: KeyboardEvent) {
if (this._router.url.indexOf('/file/') < 0) {
return;
@ -226,6 +229,10 @@ export class FileHeaderComponent implements OnInit, AfterViewInit, OnDetach, OnD
});
return;
}
if ($event.key === 'F5') {
window.location.reload();
}
}
#openFullScreen() {

View File

@ -19,7 +19,7 @@ export const ActionsHelpModeKeys = {
'hint-image': 'hint',
} as const;
export const ALL_HOTKEYS: List = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown', 'H', 'h'] as const;
export const ALL_HOTKEYS: List = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown', 'H', 'h', 'F5'] as const;
export const HeaderElements = {
SHAPE_TOOL_GROUP_BUTTON: 'SHAPE_TOOL_GROUP_BUTTON',