Merge branch 'updates' into 'master'

add pdftron version to assets

See merge request redactmanager/red-ui!469
This commit is contained in:
Dan Percic 2024-06-20 14:14:24 +02:00
commit aacca45da6
4 changed files with 39 additions and 37 deletions

View File

@ -50,7 +50,7 @@
{ {
"glob": "**/*", "glob": "**/*",
"input": "node_modules/@pdftron/webviewer/public/", "input": "node_modules/@pdftron/webviewer/public/",
"output": "/assets/wv-resources/" "output": "/assets/wv-resources/10.10.1/"
}, },
{ {
"glob": "**/*", "glob": "**/*",

View File

@ -1,6 +1,10 @@
import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core'; import { ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; 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 { Router } from '@angular/router';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { environment } from '@environments/environment'; import { environment } from '@environments/environment';
@ -15,6 +19,7 @@ import {
} from '@iqser/common-ui'; } from '@iqser/common-ui';
import { getCurrentUser } from '@iqser/common-ui/lib/users'; import { getCurrentUser } from '@iqser/common-ui/lib/users';
import { AsControl, Debounce, getParam, trackByFactory, UI_ROOT_PATH_FN } from '@iqser/common-ui/lib/utils'; 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 WebViewer, { WebViewerInstance } from '@pdftron/webviewer';
import { import {
AppConfig, AppConfig,
@ -37,15 +42,10 @@ import { watermarkTranslations } from '@translations/watermark-translations';
import { Roles } from '@users/roles'; import { Roles } from '@users/roles';
import { UserPreferenceService } from '@users/user-preference.service'; import { UserPreferenceService } from '@users/user-preference.service';
import { stampPDFPage } from '@utils/page-stamper'; import { stampPDFPage } from '@utils/page-stamper';
import { ColorPickerModule } from 'ngx-color-picker';
import { BehaviorSubject, firstValueFrom, Observable, of } from 'rxjs'; import { BehaviorSubject, firstValueFrom, Observable, of } from 'rxjs';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
import { PaginatorComponent } from '../paginator/paginator.component'; 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<IWatermark> = { export const DEFAULT_WATERMARK: Partial<IWatermark> = {
text: 'Watermark', text: 'Watermark',
@ -93,6 +93,13 @@ interface WatermarkForm {
], ],
}) })
export class WatermarkScreenComponent implements OnInit { export class WatermarkScreenComponent implements OnInit {
@ViewChild('viewer', { static: true }) private readonly _viewer: ElementRef<HTMLDivElement>;
readonly #loaded$ = new BehaviorSubject(false);
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly #watermarkId = Number(getParam(WATERMARK_ID));
readonly #config = getConfig<AppConfig>();
#watermark: Partial<IWatermark> = {};
readonly #convertPath = inject(UI_ROOT_PATH_FN);
readonly iconButtonTypes = IconButtonTypes; readonly iconButtonTypes = IconButtonTypes;
readonly translations = watermarkTranslations; readonly translations = watermarkTranslations;
readonly trackBy = trackByFactory(); readonly trackBy = trackByFactory();
@ -110,13 +117,6 @@ export class WatermarkScreenComponent implements OnInit {
readonly watermarkHorizontalAlignments = Object.values(WATERMARK_HORIZONTAL_ALIGNMENTS); readonly watermarkHorizontalAlignments = Object.values(WATERMARK_HORIZONTAL_ALIGNMENTS);
readonly watermarkVerticalAlignments = Object.values(WATERMARK_VERTICAL_ALIGNMENTS); readonly watermarkVerticalAlignments = Object.values(WATERMARK_VERTICAL_ALIGNMENTS);
currentAlignment: WatermarkAlignment; currentAlignment: WatermarkAlignment;
@ViewChild('viewer', { static: true }) private readonly _viewer: ElementRef<HTMLDivElement>;
readonly #loaded$ = new BehaviorSubject(false);
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly #watermarkId = Number(getParam(WATERMARK_ID));
readonly #config = getConfig<AppConfig>();
#watermark: Partial<IWatermark> = {};
readonly #convertPath = inject(UI_ROOT_PATH_FN);
constructor( constructor(
private readonly _http: HttpClient, private readonly _http: HttpClient,
@ -249,7 +249,7 @@ export class WatermarkScreenComponent implements OnInit {
this.instance = await WebViewer( this.instance = await WebViewer(
{ {
licenseKey: this._licenseService.activeLicenseKey, 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'), css: this.#convertPath('/assets/pdftron/stylesheet.css'),
fullAPI: true, fullAPI: true,
isReadOnly: true, isReadOnly: true,

View File

@ -25,6 +25,25 @@ import TextTool = Core.Tools.TextTool;
@Injectable() @Injectable()
export class PdfViewer { export class PdfViewer {
#instance: WebViewerInstance;
readonly #convertPath = inject(UI_ROOT_PATH_FN);
readonly #licenseKey = inject(LicenseService).activeLicenseKey;
readonly #config = getConfig<AppConfig>();
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<number>(0);
readonly currentPage$ = inject(ActivatedRoute).queryParamMap.pipe( readonly currentPage$ = inject(ActivatedRoute).queryParamMap.pipe(
map(params => Number(params.get('page') ?? '1')), map(params => Number(params.get('page') ?? '1')),
shareDistinctLast(), shareDistinctLast(),
@ -45,25 +64,6 @@ export class PdfViewer {
ambientString: true, // return ambient string as part of the result ambientString: true, // return ambient string as part of the result
}; };
selectedText = ''; selectedText = '';
#instance: WebViewerInstance;
readonly #convertPath = inject(UI_ROOT_PATH_FN);
readonly #licenseKey = inject(LicenseService).activeLicenseKey;
readonly #config = getConfig<AppConfig>();
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<number>(0);
constructor( constructor(
private readonly _logger: NGXLogger, private readonly _logger: NGXLogger,
@ -357,7 +357,7 @@ export class PdfViewer {
const options: WebViewerOptions = { const options: WebViewerOptions = {
licenseKey: this.#licenseKey, licenseKey: this.#licenseKey,
fullAPI: true, fullAPI: true,
path: this.#convertPath('/assets/wv-resources'), path: this.#convertPath('/assets/wv-resources/10.10.1'),
css: this.#convertPath('/assets/pdftron/stylesheet.css'), css: this.#convertPath('/assets/pdftron/stylesheet.css'),
backendType: 'ems', backendType: 'ems',
}; };

View File

@ -23,7 +23,9 @@
"!/**/*.*", "!/**/*.*",
"!/**/*__*", "!/**/*__*",
"!/**/*__*/**", "!/**/*__*/**",
"!/ui/assets/wv-resources/core/webviewer-core.min.js", "!/ui/assets/wv-resources/**/webviewer-core.min.js",
"!/ui/assets/wv-resources/ui/webviewer-ui.min.js" "!/ui/assets/wv-resources/**/webviewer-ui.min.js",
"!/assets/wv-resources/**/webviewer-core.min.js",
"!/assets/wv-resources/**/webviewer-ui.min.js"
] ]
} }