diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts index da73d183e..d1b164b70 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts @@ -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() { diff --git a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts index 3e4315665..285936871 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts @@ -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',