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 ad3c9c902..86c838768 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 @@ -248,6 +248,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this._viewerHeaderService.enableLoadAllAnnotations(); // Reset the button state (since the viewer is reused between files) super.ngOnDetach(); this.pdf.instance.UI.hotkeys.off('esc'); + this.pdf.instance.UI.iframeWindow.document.removeEventListener('click', this.handleViewerClick); this._changeRef.markForCheck(); } @@ -283,7 +284,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this._ngZone.run(() => { if (this._multiSelectService.active()) { const clickedElement = event.target as HTMLElement; - if (clickedElement.querySelector('#selectionrect')) { + if ( + clickedElement.querySelector('#selectionrect') || + clickedElement.id === `pageWidgetContainer${this.pdf.currentPage()}` + ) { if (!this._annotationManager.selected.length) { this._multiSelectService.deactivate(); } @@ -324,6 +328,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.removeEventListener('click', this.handleViewerClick); this.pdf.instance.UI.iframeWindow.document.addEventListener('click', this.handleViewerClick); }