diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts index 0d92b4ea4..2913af38f 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.ts @@ -522,4 +522,16 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On }); return listItemsMap; } + + @HostListener('click', ['$event']) + clickInsideWorkloadView($event: MouseEvent) { + $event?.stopPropagation(); + } + + @HostListener('document: click') + clickOutsideWorkloadView() { + if (this.multiSelectService.active()) { + this.multiSelectService.deactivate(); + } + } } diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 958ee18f9..48df7cec0 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -307,6 +307,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni ngOnDestroy() { this.pdf.instance.UI.hotkeys.off('esc'); + this.pdf.instance.UI.iframeWindow.document.removeEventListener('click', this.handleViewerClick); super.ngOnDestroy(); } @@ -331,6 +332,15 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } } + @Bind() + handleViewerClick() { + this._ngZone.run(() => { + if (this._multiSelectService.active()) { + this._multiSelectService.deactivate(); + } + }); + } + async ngOnAttach(previousRoute: ActivatedRouteSnapshot) { if (!this.state.file().canBeOpened) { return this.#navigateToDossier(); @@ -361,6 +371,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this.#restoreOldFilters(); this.pdf.instance.UI.hotkeys.on('esc', this.handleEscInsideViewer); this._viewerHeaderService.resetLayers(); + this.pdf.instance.UI.iframeWindow.document.addEventListener('click', this.handleViewerClick); } openManualAnnotationDialog(manualRedactionEntryWrapper: ManualRedactionEntryWrapper) {