diff --git a/apps/red-ui/src/app/app-config/app-config.service.ts b/apps/red-ui/src/app/app-config/app-config.service.ts index 8e529ea31..23f546e90 100644 --- a/apps/red-ui/src/app/app-config/app-config.service.ts +++ b/apps/red-ui/src/app/app-config/app-config.service.ts @@ -7,7 +7,6 @@ export enum AppConfigKey { OAUTH_URL = 'OAUTH_URL', OAUTH_CLIENT_ID = 'OAUTH_CLIENT_ID', API_URL = 'API_URL', - PDFTRON_LICENSE = 'PDFTRON_LICENSE', ADMIN_CONTACT_NAME = 'ADMIN_CONTACT_NAME', ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL' } diff --git a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html index 97c622c52..d960065a9 100644 --- a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html @@ -19,7 +19,7 @@
- +
diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index f5779ce62..80e821b64 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -32,7 +32,6 @@ [fileData]="displayData" [fileStatus]="appStateService.activeFile" (annotationSelected)="handleAnnotationSelected($event)" - (keyUp)="handleKeyEvent($event)" (manualAnnotationRequested)="openManualRedactionDialog($event)" (pageChanged)="viewerPageChanged($event)" (viewerReady)="viewerReady($event)" diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index 7c3c7577e..68f3e7995 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -406,9 +406,9 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy { if (!this.redactedView) { this._annotationDrawService.drawAnnotations( this.instance, - this.annotations.filter((item) => (annotationIdToDraw ? item.id === annotationIdToDraw : true)), - !!annotationIdToDraw + this.annotations.filter((item) => (annotationIdToDraw ? item.id === annotationIdToDraw : true)) ); + document.querySelectorAll('iframe')[0].click(); } }); } diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index dd31e1670..e61abb45d 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -1,5 +1,5 @@ import { AfterViewInit, Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; -import { AppConfigKey, AppConfigService } from '../../../app-config/app-config.service'; +import { AppConfigService } from '../../../app-config/app-config.service'; import { ManualRedactionEntry, Rectangle } from '@redaction/red-ui-http'; import WebViewer, { WebViewerInstance } from '@pdftron/webviewer'; import { TranslateService } from '@ngx-translate/core'; @@ -10,6 +10,7 @@ import { AnnotationWrapper } from '../model/annotation.wrapper'; import { ManualAnnotationService } from '../service/manual-annotation.service'; import { FileStatusWrapper } from '../model/file-status.wrapper'; import { KeycloakService } from 'keycloak-angular'; +import { environment } from '../../../../environments/environment'; export interface ViewerState { displayMode?: any; @@ -37,7 +38,6 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { @Output() annotationSelected = new EventEmitter(); @Output() manualAnnotationRequested = new EventEmitter(); @Output() pageChanged = new EventEmitter(); - @Output() keyUp = new EventEmitter(); @Output() viewerReady = new EventEmitter(); @@ -74,10 +74,9 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { } private _loadViewer() { - const license = this._appConfigService.getConfig(AppConfigKey.PDFTRON_LICENSE); WebViewer( { - licenseKey: license, + licenseKey: environment.licenseKey ? atob(environment.licenseKey) : null, isReadOnly: true, path: '/assets/wv-resources' }, @@ -95,24 +94,12 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { } }); - // instance.docViewer.on('pageComplete', (p) => { - // this._ngZone.run(() => this.pageChanged.emit(p)); - // }); + instance.docViewer.on('pageComplete', (p) => { + this._ngZone.run(() => this.pageChanged.emit(p)); + }); instance.docViewer.on('documentLoaded', this._documentLoaded); - // instance.docViewer.on('keyDown', ($event) => { - // if ($event.key.startsWith('Arrow')) { - // $event.preventDefault(); - // } - // }); - // - // instance.docViewer.on('keyUp', ($event) => { - // if ($event.key.startsWith('Arrow')) { - // this.keyUp.emit($event); - // } - // }); - // initialize state this._restoreState(null, instance); diff --git a/apps/red-ui/src/app/screens/file/service/annotation-draw.service.ts b/apps/red-ui/src/app/screens/file/service/annotation-draw.service.ts index b4d1c838c..6ab0f5c99 100644 --- a/apps/red-ui/src/app/screens/file/service/annotation-draw.service.ts +++ b/apps/red-ui/src/app/screens/file/service/annotation-draw.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { WebViewerInstance } from '@pdftron/webviewer'; -import { ManualRedactionEntry, Rectangle } from '@redaction/red-ui-http'; +import { Rectangle } from '@redaction/red-ui-http'; import { hexToRgb } from '../../../utils/functions'; import { AppStateService } from '../../../state/app-state.service'; import { AnnotationWrapper } from '../model/annotation.wrapper'; @@ -11,22 +11,18 @@ import { AnnotationWrapper } from '../model/annotation.wrapper'; export class AnnotationDrawService { constructor(private readonly _appStateService: AppStateService) {} - public drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[], redraw: boolean = false) { + public drawAnnotations(activeViewer: WebViewerInstance, annotationWrappers: AnnotationWrapper[]) { const annotations = []; annotationWrappers.forEach((annotation) => { - annotations.push(this.drawAnnotation(activeViewer, annotation)); + annotations.push(this.computeAnnotation(activeViewer, annotation)); }); const annotationManager = activeViewer.annotManager; annotationManager.addAnnotations(annotations, true); - if (redraw) { - annotations.forEach((annotation) => { - annotationManager.redrawAnnotation(annotation); - }); - } + annotationManager.drawAnnotationsFromList(annotations); } - public drawAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper) { + public computeAnnotation(activeViewer: WebViewerInstance, annotationWrapper: AnnotationWrapper) { const pageNumber = annotationWrapper.pageNumber; const highlight = new activeViewer.Annotations.TextHighlightAnnotation(); highlight.PageNumber = pageNumber; diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index a7169b843..bfcb40971 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,6 +1,5 @@ { "OAUTH_URL": "https://redkc-staging.iqser.cloud/auth/realms/redaction", "OAUTH_CLIENT_ID": "redaction", - "API_URL": "https://timo-redaction-dev.iqser.cloud", - "PDFTRON_LICENSE": "" + "API_URL": "https://timo-redaction-dev.iqser.cloud" } diff --git a/apps/red-ui/src/environments/environment.prod.ts b/apps/red-ui/src/environments/environment.prod.ts index 5d0833162..9e64bc18a 100644 --- a/apps/red-ui/src/environments/environment.prod.ts +++ b/apps/red-ui/src/environments/environment.prod.ts @@ -1,3 +1,4 @@ export const environment = { - production: true + production: true, + licenseKey: undefined }; diff --git a/apps/red-ui/src/environments/environment.ts b/apps/red-ui/src/environments/environment.ts index 6b323087c..4fac6eab2 100644 --- a/apps/red-ui/src/environments/environment.ts +++ b/apps/red-ui/src/environments/environment.ts @@ -3,7 +3,8 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, + licenseKey: undefined }; /* diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh index a8ed05499..2239fa4aa 100755 --- a/docker/red-ui/docker-entrypoint.sh +++ b/docker/red-ui/docker-entrypoint.sh @@ -3,12 +3,10 @@ OAUTH_CLIENT_ID="${OAUTH_CLIENT_ID:-gin-client}" OAUTH_URL="${OAUTH_URL:-https://keycloak-dev.iqser.cloud/auth/realms/dev}" API_URL="${API_URL:-}" -PDFTRON_LICENSE="${PDFTRON_LICENSE:-}" echo '{ "OAUTH_CLIENT_ID":"'"$OAUTH_CLIENT_ID"'", "OAUTH_URL":"'"$OAUTH_URL"'", - "PDFTRON_LICENSE":"'"$PDFTRON_LICENSE"'", "API_URL":"'"$API_URL"'" }' > /usr/share/nginx/html/assets/config/config.json