From 90e8af976589ef9ab65f9fffe74e767e85215072 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 31 Oct 2024 19:55:26 +0200 Subject: [PATCH] RED-9944 - Action Items don't appear in document area in webviewer when bulk-select is still unintenionally active --- .../annotation-actions.component.ts | 4 +-- .../file-preview-screen.component.ts | 9 ++++-- .../services/pdf-proxy.service.ts | 4 +-- .../modules/file-preview/utils/constants.ts | 28 +++++++++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts index ae64768f4..2ec1353b6 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.ts @@ -133,14 +133,14 @@ export class AnnotationActionsComponent { const viewerAnnotations = untracked(this.viewerAnnotations); this._annotationManager.hide(viewerAnnotations); this._annotationManager.deselect(); - this._annotationManager.addToHidden(viewerAnnotations[0].Id); + viewerAnnotations.forEach(a => this._annotationManager.addToHidden(a.Id)); } showAnnotation() { const viewerAnnotations = untracked(this.viewerAnnotations); this._annotationManager.show(viewerAnnotations); this._annotationManager.deselect(); - this._annotationManager.removeFromHidden(viewerAnnotations[0].Id); + viewerAnnotations.forEach(a => this._annotationManager.removeFromHidden(a.Id)); } resize() { 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 3c1fdfbdc..a6f5aefff 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 @@ -72,6 +72,7 @@ import { FileHeaderComponent } from './components/file-header/file-header.compon import { StructuredComponentManagementComponent } from './components/structured-component-management/structured-component-management.component'; import { DocumentInfoService } from './services/document-info.service'; import { RectangleAnnotationDialog } from './dialogs/rectangle-annotation-dialog/rectangle-annotation-dialog.component'; +import { ANNOTATION_ACTION_ICONS, ANNOTATION_ACTIONS } from './utils/constants'; @Component({ templateUrl: './file-preview-screen.component.html', @@ -284,9 +285,11 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni this._ngZone.run(() => { if (event.isTrusted) { const clickedElement = event.target as HTMLElement; - const editingAnnotation = - (clickedElement as HTMLImageElement).src?.includes('edit.svg') || clickedElement.getAttribute('aria-label') === 'Edit'; - if (this._multiSelectService.active() && !editingAnnotation) { + const actionIconClicked = ANNOTATION_ACTION_ICONS.some(action => + (clickedElement as HTMLImageElement).src?.includes(action), + ); + const actionClicked = ANNOTATION_ACTIONS.some(action => clickedElement.getAttribute('aria-label')?.includes(action)); + if (this._multiSelectService.active() && !actionIconClicked && !actionClicked) { if ( clickedElement.querySelector('#selectionrect') || clickedElement.id === `pageWidgetContainer${this.pdf.currentPage()}` diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts index 0355df684..c0804337c 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts @@ -389,10 +389,10 @@ export class PdfProxyService { this._ngZone.run(() => { if (allAreVisible) { this._annotationManager.hide(viewerAnnotations); - this._annotationManager.addToHidden(viewerAnnotations[0].Id); + viewerAnnotations.forEach(a => this._annotationManager.addToHidden(a.Id)); } else { this._annotationManager.show(viewerAnnotations); - this._annotationManager.removeFromHidden(viewerAnnotations[0].Id); + viewerAnnotations.forEach(a => this._annotationManager.removeFromHidden(a.Id)); } this._annotationManager.deselect(); }); 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 1b1590059..3e4315665 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 @@ -45,3 +45,31 @@ export const TextPopups = { } as const; export const HIDE_SKIPPED = 'hide-skipped'; + +export const ANNOTATION_ACTION_ICONS = [ + 'resize', + 'edit', + 'trash', + 'check', + 'thumb-up', + 'pdftron-action-add-redaction', + 'visibility-off', +] as const; +export const ANNOTATION_ACTIONS = [ + 'Resize', + 'Größe ändern', + 'Edit', + 'Bearbeiten', + 'Remove', + 'Entfernen', + 'Accept recommendation', + 'Empfehlung annehmen', + 'Force redaction', + 'Schwärzung erzwingen', + 'Force hint', + 'Hinweis erzwingen', + 'Redact', + 'Schwärzen', + 'Hide', + 'Ausblenden', +] as const;