RED-6285: fix save button not hidden

This commit is contained in:
Dan Percic 2023-03-16 17:16:35 +02:00
parent 7ba8b51f8a
commit 5eab66c79e
2 changed files with 13 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<div class="content-container"> <div class="content-container">
<div #viewer class="viewer" id="viewer"></div> <div #viewer class="viewer" id="viewer"></div>
<div *ngIf="changed && currentUser.isAdmin" class="changes-box"> <div *ngIf="!!instance && changed && currentUser.isAdmin" class="changes-box">
<iqser-icon-button <iqser-icon-button
(action)="save()" (action)="save()"
[disabled]="!valid" [disabled]="!valid"

View File

@ -63,9 +63,9 @@ export class WatermarkScreenComponent implements OnInit {
]; ];
readonly orientationOptions = ['DIAGONAL', 'HORIZONTAL', 'VERTICAL']; readonly orientationOptions = ['DIAGONAL', 'HORIZONTAL', 'VERTICAL'];
@ViewChild('viewer', { static: true }) viewer: ElementRef<HTMLDivElement>; @ViewChild('viewer', { static: true }) viewer: ElementRef<HTMLDivElement>;
instance: WebViewerInstance;
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID); readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
readonly #watermarkId = Number(getParam(WATERMARK_ID)); readonly #watermarkId = Number(getParam(WATERMARK_ID));
private _instance: WebViewerInstance;
private _watermark: Partial<IWatermark> = {}; private _watermark: Partial<IWatermark> = {};
constructor( constructor(
@ -152,11 +152,11 @@ export class WatermarkScreenComponent implements OnInit {
} }
private async _loadViewer() { private async _loadViewer() {
if (this._instance) { if (this.instance) {
return; return;
} }
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'),
@ -168,15 +168,15 @@ export class WatermarkScreenComponent implements OnInit {
this.viewer.nativeElement, this.viewer.nativeElement,
); );
this._instance.UI.setTheme(this._userPreferenceService.getTheme()); this.instance.UI.setTheme(this._userPreferenceService.getTheme());
this._instance.Core.documentViewer.addEventListener('documentLoaded', async () => { this.instance.Core.documentViewer.addEventListener('documentLoaded', async () => {
this._loadingService.stop(); this._loadingService.stop();
await this._drawWatermark(); await this._drawWatermark();
}); });
if (environment.production) { if (environment.production) {
this._instance.Core.setCustomFontURL('https://' + window.location.host + this._convertPath('/assets/pdftron')); this.instance.Core.setCustomFontURL('https://' + window.location.host + this._convertPath('/assets/pdftron'));
} }
this._disableElements(); this._disableElements();
@ -185,16 +185,16 @@ export class WatermarkScreenComponent implements OnInit {
responseType: 'blob', responseType: 'blob',
}); });
const blobData = await firstValueFrom(request); const blobData = await firstValueFrom(request);
this._instance.UI.loadDocument(blobData, { filename: 'blank.pdf' }); this.instance.UI.loadDocument(blobData, { filename: 'blank.pdf' });
} }
private _disableElements() { private _disableElements() {
this._instance.UI.disableElements(['header', 'toolsHeader', 'pageNavOverlay', 'textPopup']); this.instance.UI.disableElements(['header', 'toolsHeader', 'pageNavOverlay', 'textPopup']);
} }
private async _drawWatermark() { private async _drawWatermark() {
const pdfNet = this._instance.Core.PDFNet; const pdfNet = this.instance.Core.PDFNet;
const document = await this._instance.Core.documentViewer.getDocument().getPDFDoc(); const document = await this.instance.Core.documentViewer.getDocument().getPDFDoc();
await stampPDFPage( await stampPDFPage(
document, document,
@ -208,8 +208,8 @@ export class WatermarkScreenComponent implements OnInit {
[1], [1],
this._licenseService.activeLicenseKey, this._licenseService.activeLicenseKey,
); );
this._instance.Core.documentViewer.refreshAll(); this.instance.Core.documentViewer.refreshAll();
this._instance.Core.documentViewer.updateView([0], 0); this.instance.Core.documentViewer.updateView([0], 0);
} }
private _getForm() { private _getForm() {