From 287b95a53878bdc8c524da79b24d7faba16fbb42 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 10 Oct 2024 16:48:06 +0300 Subject: [PATCH] RED-9944 - Action Items don't appear in document area in webviewer when bulk-select is still unintenionally active --- .../annotations-list/annotations-list.component.ts | 1 + .../file-preview/services/pdf-proxy.service.ts | 5 ++++- .../services/annotation-manager.service.ts | 13 ++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts index a6364564f..a57c30e43 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotations-list/annotations-list.component.ts @@ -79,6 +79,7 @@ export class AnnotationsListComponent extends HasScrollbarDirective { this._multiSelectService.activate(); } this._listingService.selectAnnotations(annotation); + this._annotationManager.setSelectedFromWorkload(); } referenceClicked(annotation: AnnotationWrapper): void { 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 7b7560376..0355df684 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 @@ -404,11 +404,14 @@ export class PdfProxyService { const annotationChangesAllowed = !this.#isDocumine || !this._state.file().excludedFromAutomaticAnalysis; const somePending = annotationWrappers.some(a => a.pending); + const selectedFromWorkload = untracked(this._annotationManager.selectedFromWorkload); + actions = - this._multiSelectService.inactive() && !this._documentViewer.selectedText.length && !somePending + (this._multiSelectService.inactive() || !selectedFromWorkload) && !this._documentViewer.selectedText.length && !somePending ? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers, annotationChangesAllowed)] : []; this._pdf.instance.UI.annotationPopup.update(actions); + this._annotationManager.resetSelectedFromWorkload(); } #getTitle(type: ManualRedactionEntryType) { diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts index 201d3560c..e214bf07e 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts @@ -1,5 +1,5 @@ import { inject, Injectable, signal } from '@angular/core'; -import { bool, List } from '@iqser/common-ui/lib/utils'; +import { bool, Debounce, List } from '@iqser/common-ui/lib/utils'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { Core } from '@pdftron/webviewer'; import { getLast, urlFileId } from '@utils/functions'; @@ -23,6 +23,8 @@ export class REDAnnotationManager { annotationHasBeenResized?: boolean = false; readonly #hidden = signal(new Set()); readonly hidden = this.#hidden.asReadonly(); + readonly #selectedFromWorkload = signal(false); + readonly selectedFromWorkload = this.#selectedFromWorkload.asReadonly(); #manager: AnnotationManager; readonly #logger = inject(NGXLogger); readonly #annotationSelected$ = new Subject<[Annotation[], string]>(); @@ -155,6 +157,15 @@ export class REDAnnotationManager { }); } + setSelectedFromWorkload() { + this.#selectedFromWorkload.set(true); + } + + @Debounce() + resetSelectedFromWorkload() { + this.#selectedFromWorkload.set(false); + } + #getById(annotation: AnnotationWrapper | string) { return this.#manager.getAnnotationById(getId(annotation)); }