Merge branch 'VM/RED-7673' into 'master'

RED-7673 - Resize accept and decline actions not available in the document viewer

Closes RED-7673

See merge request redactmanager/red-ui!167
This commit is contained in:
Dan Percic 2023-10-30 13:49:17 +01:00
commit ae35280c9e
3 changed files with 11 additions and 14 deletions

View File

@ -58,7 +58,11 @@ export class PdfProxyService {
readonly currentUser = getCurrentUser<User>();
readonly pageChanged$ = this._pdf.pageChanged$.pipe(
tap(() => this.#handleExcludedPageActions()),
tap(() => this._pdf.resetAnnotationActions()),
tap(() => {
if (this._multiSelectService.inactive()) {
this._annotationManager.deselect();
}
}),
shareDistinctLast(),
);
readonly canPerformActions = computed(() => {
@ -143,7 +147,7 @@ export class PdfProxyService {
onClick: () => this._ngZone.run(() => this.#addRectangleManualRedaction()),
};
this._pdf.instance.UI.annotationPopup.add([addRectangleButton]);
this._pdf.instance.UI.annotationPopup.update([addRectangleButton]);
}
}
@ -280,7 +284,6 @@ export class PdfProxyService {
#processSelectedAnnotations(annotations: Annotation[], action: string) {
let nextAnnotations: Annotation[];
this._pdf.resetAnnotationActions();
if (action === 'deselected') {
this.#cancelResizeIfIsResizing(annotations);
@ -360,6 +363,7 @@ export class PdfProxyService {
return this.#configureRectangleAnnotationPopup(viewerAnnotations[0]);
}
let actions = [];
// Add hide action as last item
const allAreImage = annotationWrappers.reduce((acc, next) => acc && next.isImage, true);
if (allAreImage && !this._annotationManager.resizingAnnotationId) {
@ -383,11 +387,11 @@ export class PdfProxyService {
},
};
this._pdf.instance.UI.annotationPopup.add([visibilityButton]);
actions.push(visibilityButton);
}
const actions = this._pdfAnnotationActionsService.get(annotationWrappers);
this._pdf.instance.UI.annotationPopup.add(actions);
actions = this._multiSelectService.inactive() ? [...actions, ...this._pdfAnnotationActionsService.get(annotationWrappers)] : [];
this._pdf.instance.UI.annotationPopup.update(actions);
}
#getTitle(type: ManualRedactionEntryType) {

View File

@ -124,13 +124,6 @@ export class PdfViewer {
this.#instance.UI.closeElements(['searchPanel']);
}
resetAnnotationActions() {
if (this.#instance.UI.annotationPopup.getItems().length) {
this.#logger.info('[PDF] Reset annotation actions');
this.#instance.UI.annotationPopup.update([]);
}
}
navigateTo(page: string | number) {
const parsedNumber = typeof page === 'string' ? parseInt(page, 10) : page;
const paginationOffset = this.#paginationOffset;

View File

@ -39,7 +39,7 @@
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@nx/angular": "16.10.0",
"@pdftron/webviewer": "10.3.0",
"@pdftron/webviewer": "10.5.0",
"chart.js": "4.4.0",
"dayjs": "1.11.10",
"file-saver": "^2.0.5",