diff --git a/angular.json b/angular.json index d0f02141e..74a38dc98 100644 --- a/angular.json +++ b/angular.json @@ -50,7 +50,7 @@ { "glob": "**/*", "input": "node_modules/@pdftron/webviewer/public/", - "output": "/assets/wv-resources/" + "output": "/assets/wv-resources/10.10.1/" }, { "glob": "**/*", diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts index e21ab0f17..8c6d5284c 100644 --- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts @@ -1,6 +1,10 @@ +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; import { HttpClient } from '@angular/common/http'; import { ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; +import { MatIcon } from '@angular/material/icon'; +import { MatSlider, MatSliderThumb } from '@angular/material/slider'; +import { MatTooltip } from '@angular/material/tooltip'; import { Router } from '@angular/router'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { environment } from '@environments/environment'; @@ -15,6 +19,7 @@ import { } from '@iqser/common-ui'; import { getCurrentUser } from '@iqser/common-ui/lib/users'; import { AsControl, Debounce, getParam, trackByFactory, UI_ROOT_PATH_FN } from '@iqser/common-ui/lib/utils'; +import { TranslateModule } from '@ngx-translate/core'; import WebViewer, { WebViewerInstance } from '@pdftron/webviewer'; import { AppConfig, @@ -37,15 +42,10 @@ import { watermarkTranslations } from '@translations/watermark-translations'; import { Roles } from '@users/roles'; import { UserPreferenceService } from '@users/user-preference.service'; import { stampPDFPage } from '@utils/page-stamper'; +import { ColorPickerModule } from 'ngx-color-picker'; import { BehaviorSubject, firstValueFrom, Observable, of } from 'rxjs'; import { tap } from 'rxjs/operators'; import { PaginatorComponent } from '../paginator/paginator.component'; -import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; -import { TranslateModule } from '@ngx-translate/core'; -import { MatTooltip } from '@angular/material/tooltip'; -import { MatIcon } from '@angular/material/icon'; -import { MatSlider, MatSliderThumb } from '@angular/material/slider'; -import { ColorPickerModule } from 'ngx-color-picker'; export const DEFAULT_WATERMARK: Partial = { text: 'Watermark', @@ -93,6 +93,13 @@ interface WatermarkForm { ], }) export class WatermarkScreenComponent implements OnInit { + @ViewChild('viewer', { static: true }) private readonly _viewer: ElementRef; + readonly #loaded$ = new BehaviorSubject(false); + readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID); + readonly #watermarkId = Number(getParam(WATERMARK_ID)); + readonly #config = getConfig(); + #watermark: Partial = {}; + readonly #convertPath = inject(UI_ROOT_PATH_FN); readonly iconButtonTypes = IconButtonTypes; readonly translations = watermarkTranslations; readonly trackBy = trackByFactory(); @@ -110,13 +117,6 @@ export class WatermarkScreenComponent implements OnInit { readonly watermarkHorizontalAlignments = Object.values(WATERMARK_HORIZONTAL_ALIGNMENTS); readonly watermarkVerticalAlignments = Object.values(WATERMARK_VERTICAL_ALIGNMENTS); currentAlignment: WatermarkAlignment; - @ViewChild('viewer', { static: true }) private readonly _viewer: ElementRef; - readonly #loaded$ = new BehaviorSubject(false); - readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID); - readonly #watermarkId = Number(getParam(WATERMARK_ID)); - readonly #config = getConfig(); - #watermark: Partial = {}; - readonly #convertPath = inject(UI_ROOT_PATH_FN); constructor( private readonly _http: HttpClient, @@ -249,7 +249,7 @@ export class WatermarkScreenComponent implements OnInit { this.instance = await WebViewer( { licenseKey: this._licenseService.activeLicenseKey, - path: this.#convertPath('/assets/wv-resources'), + path: this.#convertPath('/assets/wv-resources/10.10.1'), css: this.#convertPath('/assets/pdftron/stylesheet.css'), fullAPI: true, isReadOnly: true, diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts index 8942e3438..a897f2d20 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts @@ -25,6 +25,25 @@ import TextTool = Core.Tools.TextTool; @Injectable() export class PdfViewer { + #instance: WebViewerInstance; + readonly #convertPath = inject(UI_ROOT_PATH_FN); + readonly #licenseKey = inject(LicenseService).activeLicenseKey; + readonly #config = getConfig(); + readonly #isCompareMode = signal(false); + readonly #isCompareMode$ = toObservable(this.#isCompareMode); + readonly #searchButton: IHeaderElement = { + type: 'actionButton', + img: this.#convertPath('/assets/icons/general/pdftron-action-search.svg'), + title: inject(TranslateService).instant(_('pdf-viewer.text-popup.actions.search')), + onClick: () => { + setTimeout(() => { + this.#searchForSelectedText(); + this.#focusSearch(); + }, 250); + }, + }; + readonly #destroyRef = inject(DestroyRef); + readonly #totalPages = signal(0); readonly currentPage$ = inject(ActivatedRoute).queryParamMap.pipe( map(params => Number(params.get('page') ?? '1')), shareDistinctLast(), @@ -45,25 +64,6 @@ export class PdfViewer { ambientString: true, // return ambient string as part of the result }; selectedText = ''; - #instance: WebViewerInstance; - readonly #convertPath = inject(UI_ROOT_PATH_FN); - readonly #licenseKey = inject(LicenseService).activeLicenseKey; - readonly #config = getConfig(); - readonly #isCompareMode = signal(false); - readonly #isCompareMode$ = toObservable(this.#isCompareMode); - readonly #searchButton: IHeaderElement = { - type: 'actionButton', - img: this.#convertPath('/assets/icons/general/pdftron-action-search.svg'), - title: inject(TranslateService).instant(_('pdf-viewer.text-popup.actions.search')), - onClick: () => { - setTimeout(() => { - this.#searchForSelectedText(); - this.#focusSearch(); - }, 250); - }, - }; - readonly #destroyRef = inject(DestroyRef); - readonly #totalPages = signal(0); constructor( private readonly _logger: NGXLogger, @@ -357,7 +357,7 @@ export class PdfViewer { const options: WebViewerOptions = { licenseKey: this.#licenseKey, fullAPI: true, - path: this.#convertPath('/assets/wv-resources'), + path: this.#convertPath('/assets/wv-resources/10.10.1'), css: this.#convertPath('/assets/pdftron/stylesheet.css'), backendType: 'ems', }; diff --git a/ngsw-config.json b/ngsw-config.json index 222ef9637..244fb97b9 100644 --- a/ngsw-config.json +++ b/ngsw-config.json @@ -23,7 +23,9 @@ "!/**/*.*", "!/**/*__*", "!/**/*__*/**", - "!/ui/assets/wv-resources/core/webviewer-core.min.js", - "!/ui/assets/wv-resources/ui/webviewer-ui.min.js" + "!/ui/assets/wv-resources/**/webviewer-core.min.js", + "!/ui/assets/wv-resources/**/webviewer-ui.min.js", + "!/assets/wv-resources/**/webviewer-core.min.js", + "!/assets/wv-resources/**/webviewer-ui.min.js" ] }