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

This commit is contained in:
Valentin Mihai 2023-10-27 14:37:49 +03:00
parent 092b8c2b28
commit 6923a00caf
3 changed files with 6 additions and 14 deletions

View File

@ -58,7 +58,6 @@ export class PdfProxyService {
readonly currentUser = getCurrentUser<User>();
readonly pageChanged$ = this._pdf.pageChanged$.pipe(
tap(() => this.#handleExcludedPageActions()),
tap(() => this._pdf.resetAnnotationActions()),
shareDistinctLast(),
);
readonly canPerformActions = computed(() => {
@ -143,7 +142,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 +279,6 @@ export class PdfProxyService {
#processSelectedAnnotations(annotations: Annotation[], action: string) {
let nextAnnotations: Annotation[];
this._pdf.resetAnnotationActions();
if (action === 'deselected') {
this.#cancelResizeIfIsResizing(annotations);
@ -360,6 +358,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 +382,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 = [...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",