From b5937385c59b4ca87e4aac41085f45f1900ed6a6 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Mon, 6 Nov 2023 11:28:39 +0100 Subject: [PATCH 1/3] ACS-6067 Update thumbnails when file is changed --- lib/core/src/lib/viewer/components/pdf-viewer.component.html | 2 +- lib/core/src/lib/viewer/components/pdf-viewer.component.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.html b/lib/core/src/lib/viewer/components/pdf-viewer.component.html index cf83f4e1354..41a478e77db 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.html +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.html @@ -17,7 +17,7 @@ - + diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts index 63893ac3f98..91816fe5575 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts @@ -229,6 +229,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { renderingQueue: this.renderingQueueServices, eventBus: this.eventBus }); + this.isPanelDisabled = true; // cspell: disable-next this.eventBus.on('pagechanging', this.onPageChange); From 27699c07b9353de87c39a6911f0aba19ba50cd37 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 8 Nov 2023 10:37:47 +0100 Subject: [PATCH 2/3] ACS-6067 Added unit tests --- .../src/lib/viewer/components/pdf-viewer.component.html | 6 ++---- .../lib/viewer/components/pdf-viewer.component.spec.ts | 9 +++++++++ .../src/lib/viewer/components/pdf-viewer.component.ts | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.html b/lib/core/src/lib/viewer/components/pdf-viewer.component.html index 41a478e77db..9844cf51734 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.html +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.html @@ -16,10 +16,8 @@ - - - - + + diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts index a3361d08373..e33a9e0f22f 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.spec.ts @@ -27,6 +27,8 @@ import { take } from 'rxjs/operators'; import { AppConfigService } from '../../app-config/app-config.service'; import { CoreTestingModule } from '../../testing/core.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { PdfThumbListComponent } from '@alfresco/adf-core'; +import { By } from '@angular/platform-browser'; declare const pdfjsLib: any; @@ -354,6 +356,13 @@ describe('Test PdfViewer component', () => { done(); }); }, 55000); + + it('should not render PdfThumbListComponent during initialization of new pdfViewer', () => { + componentUrlTestComponent.pdfViewerComponent.toggleThumbnails(); + componentUrlTestComponent.urlFile = 'file.pdf'; + fixtureUrlTestComponent.detectChanges(); + expect(fixtureUrlTestComponent.debugElement.query(By.directive(PdfThumbListComponent))).toBeNull(); + }); }); describe('Viewer events', () => { diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts index 91816fe5575..08f535fd25b 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts @@ -205,6 +205,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { this.loadingPercent = Math.round(level * 100); }; + this.isPanelDisabled = true; this.loadingTask.promise .then((pdfDocument: PDFDocumentProxy) => { this.totalPages = pdfDocument.numPages; From 90e4e3d458a0a8056b8abc00acfd60a02a68acf7 Mon Sep 17 00:00:00 2001 From: Aleksander Sklorz Date: Wed, 8 Nov 2023 15:11:57 +0100 Subject: [PATCH 3/3] ACS-6067 Removed redundant line --- lib/core/src/lib/viewer/components/pdf-viewer.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts index 08f535fd25b..b9afb6c3769 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer.component.ts @@ -230,7 +230,6 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { renderingQueue: this.renderingQueueServices, eventBus: this.eventBus }); - this.isPanelDisabled = true; // cspell: disable-next this.eventBus.on('pagechanging', this.onPageChange);