RED-9944 - Action Items don't appear in document area in webviewer when bulk-select is still unintenionally active

This commit is contained in:
Valentin Mihai 2024-10-31 19:55:26 +02:00
parent ba3cb01f02
commit 90e8af9765
4 changed files with 38 additions and 7 deletions

View File

@ -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() {

View File

@ -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()}`

View File

@ -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();
});

View File

@ -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;