Merge branch 'RED-10528' into 'master'

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

See merge request redactmanager/red-ui!726
This commit is contained in:
Dan Percic 2024-11-25 14:58:27 +01:00
commit bf04423524
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',