From 18197c7e3f3b383da5cfcdc5ea046bd64198bc29 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Wed, 23 Aug 2023 14:26:35 +0300 Subject: [PATCH] DM-339: Fixed red border not disappearing. --- .../file-preview-screen.component.ts | 23 +++++++++---------- .../services/file-preview-state.service.ts | 1 + 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index c4a1e465a..44fb634fc 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -166,6 +166,7 @@ export class FilePreviewScreenComponent ); effect(() => { + this.state.shouldUpdate(); if (this._documentViewer.pageComplete()) { this.#setExcludedPageStyles(); } @@ -625,19 +626,17 @@ export class FilePreviewScreenComponent #setExcludedPageStyles() { const file = this._filesMapService.get(this.dossierId, this.fileId); - setTimeout(() => { - const iframeDoc = this.pdf.instance.UI.iframeWindow.document; - const currentPage = this.pdf.currentPage(); - const elementId = `pageWidgetContainer${currentPage}`; - const pageContainer = iframeDoc.getElementById(elementId); - if (pageContainer) { - if (file.excludedPages.includes(currentPage)) { - pageContainer.classList.add('excluded-page'); - } else { - pageContainer.classList.remove('excluded-page'); - } + const iframeDoc = this.pdf.instance.UI.iframeWindow.document; + const currentPage = this.pdf.currentPage(); + const elementId = `pageWidgetContainer${currentPage}`; + const pageContainer = iframeDoc.getElementById(elementId); + if (pageContainer) { + if (file.excludedPages.includes(currentPage)) { + pageContainer.classList.add('excluded-page'); + } else { + pageContainer.classList.remove('excluded-page'); } - }, 100); + } } #subscribeToFileUpdates(): void { diff --git a/apps/red-ui/src/app/modules/file-preview/services/file-preview-state.service.ts b/apps/red-ui/src/app/modules/file-preview/services/file-preview-state.service.ts index e331aaa97..cff5a8ebf 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/file-preview-state.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/file-preview-state.service.ts @@ -44,6 +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); constructor( private readonly _permissionsService: PermissionsService,