Merge branch 'RED-8375' into 'master'

Resolve RED-8375

Closes RED-8375

See merge request redactmanager/red-ui!270
This commit is contained in:
Dan Percic 2024-01-26 15:11:55 +01:00
commit 96a7084241
5 changed files with 14 additions and 27 deletions

View File

@ -5,6 +5,6 @@
[activeSelection]="pageHasSelection(pageNumber)"
[number]="pageNumber"
[read]="!!getViewedPage(viewedPages, pageNumber)"
[showDottedIcon]="hasOnlyManualRedactionsAndIsExcluded(pageNumber)"
[showDottedIcon]="isPageExcluded(pageNumber)"
></redaction-page-indicator>
</div>

View File

@ -49,9 +49,8 @@ export class PagesComponent implements AfterViewInit {
return this.#multiSelectService.active() && !!this.#listingService.selected.find(a => a.pageNumber === page);
}
hasOnlyManualRedactionsAndIsExcluded(pageNumber: number): boolean {
const hasOnlyManualRedactions = this.displayedAnnotations.get(pageNumber)?.every(annotation => annotation.manual);
return hasOnlyManualRedactions && this.#state.file().excludedPages.includes(pageNumber);
isPageExcluded(pageNumber: number): boolean {
return this.#state.file().excludedPages.includes(pageNumber);
}
getViewedPage(viewedPages: ViewedPage[], pageNumber: number) {

View File

@ -75,12 +75,10 @@ import { SkippedService } from './services/skipped.service';
import { StampService } from './services/stamp.service';
import { TablesService } from './services/tables.service';
import { ViewModeService } from './services/view-mode.service';
import { ALL_HOTKEYS, TextPopups } from './utils/constants';
import { ALL_HOTKEYS } from './utils/constants';
import { RedactTextData } from './utils/dialog-types';
import { AnnotationActionsService } from './services/annotation-actions.service';
const textActions = [TextPopups.REDACT_TEXT, TextPopups.ADD_HINT, TextPopups.ADD_FALSE_POSITIVE];
@Component({
templateUrl: './file-preview-screen.component.html',
styleUrls: ['./file-preview-screen.component.scss'],
@ -167,17 +165,20 @@ export class FilePreviewScreenComponent
);
effect(() => {
this.state.shouldUpdate();
this.state.updateExcludedPagesStyle();
if (this._documentViewer.pageComplete()) {
this.#setExcludedPageStyles();
}
});
effect(() => {
this.state.updateExcludedPagesStyle();
if (this._viewModeService.viewMode()) {
this.updateViewMode().then();
this._logger.info('[PDF] Stamp pdf');
this._stampService.stampPDF().then();
if (_documentViewer.loaded()) {
this._logger.info('[PDF] Stamp pdf');
this._stampService.stampPDF().then();
}
}
});
}
@ -767,20 +768,6 @@ export class FilePreviewScreenComponent
),
)
.subscribe();
const selectedTextEffect = this._documentViewer.selectedText$.pipe(
tap(() => {
const canPerformActions = this.pdfProxyService.canPerformActions();
const isCurrentPageExcluded = this.state.file().isPageExcluded(this.pdf.currentPage());
if (canPerformActions && !isCurrentPageExcluded) {
this.pdf.enable(textActions);
} else {
this.pdf.disable(textActions);
}
}),
);
this.addActiveScreenSubscription = selectedTextEffect.subscribe();
}
#handleDeletedDossier(): void {

View File

@ -44,7 +44,7 @@ export class FilePreviewStateService {
readonly dossierId = getParam(DOSSIER_ID);
readonly dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly fileId = getParam(FILE_ID);
readonly shouldUpdate = computed(() => this.file().excludedPages);
readonly updateExcludedPagesStyle = computed(() => this.file().excludedPages);
constructor(
private readonly _permissionsService: PermissionsService,

View File

@ -99,7 +99,6 @@ export class PdfProxyService {
this._pdf.isCompareMode();
this.#configureTextPopup();
this.#handleExcludedPageActions();
if (canPerformActions) {
this.#enableActions();
@ -107,6 +106,8 @@ export class PdfProxyService {
this.#disableActions();
this.#deactivateMultiSelect();
}
this.#handleExcludedPageActions();
},
{ allowSignalWrites: true },
);
@ -231,7 +232,7 @@ export class PdfProxyService {
let textPopupElementsToDisable = [...TEXT_POPUPS_TO_TOGGLE];
let headerElementsToDisable = [...HEADER_ITEMS_TO_TOGGLE];
if (this.canPerformActions()) {
if (this.canPerformActions() && !this.#isDocumine) {
this._pdf.enable(ALLOWED_ACTIONS_WHEN_PAGE_EXCLUDED);
this._viewerHeaderService.enable(ALLOWED_ACTIONS_WHEN_PAGE_EXCLUDED as HeaderElementType[]);