Fixes
This commit is contained in:
parent
203cc2cd43
commit
21b59d9a71
@ -1,5 +1,4 @@
|
||||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
@ -70,9 +69,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
private readonly _annotationActionsService: AnnotationActionsService,
|
||||
private readonly _appConfigService: AppConfigService,
|
||||
private readonly _loadingService: LoadingService
|
||||
) {
|
||||
console.log(1);
|
||||
}
|
||||
) {}
|
||||
|
||||
private _viewMode: ViewMode = 'STANDARD';
|
||||
|
||||
@ -86,14 +83,12 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
console.log(2);
|
||||
this._documentLoaded = this._documentLoaded.bind(this);
|
||||
await this._loadViewer();
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this.instance) {
|
||||
console.log('instance');
|
||||
if (changes.fileData) {
|
||||
this._loadDocument();
|
||||
}
|
||||
@ -101,11 +96,9 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
this._handleCustomActions();
|
||||
}
|
||||
if (changes.multiSelectActive) {
|
||||
console.log(this.utils);
|
||||
this.utils.multiSelectActive = this.multiSelectActive;
|
||||
}
|
||||
}
|
||||
console.log(3);
|
||||
}
|
||||
|
||||
setInitialViewerState() {
|
||||
@ -144,8 +137,8 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
const compareDocumentPageCount = await compareDocument.getPageCount();
|
||||
|
||||
const loadCompareDocument = async () => {
|
||||
console.log('loadingservice');
|
||||
this._loadingService.start();
|
||||
this.utils.ready = false;
|
||||
await loadCompareDocumentWrapper(
|
||||
currentDocumentPageCount,
|
||||
compareDocumentPageCount,
|
||||
@ -204,27 +197,23 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
this.utils.navigateToPage(1);
|
||||
}
|
||||
|
||||
private _convertPath(path: string): string {
|
||||
return this._baseHref + path;
|
||||
}
|
||||
|
||||
private async _loadViewer() {
|
||||
console.log('loadingviewer');
|
||||
this.instance = await WebViewer(
|
||||
{
|
||||
licenseKey: environment.licenseKey ? atob(environment.licenseKey) : null,
|
||||
fullAPI: true,
|
||||
path: '/assets/wv-resources',
|
||||
css: '/assets/pdftron/stylesheet.css',
|
||||
path: this._convertPath('/assets/wv-resources'),
|
||||
css: this._convertPath('/assets/pdftron/stylesheet.css'),
|
||||
backendType: 'ems'
|
||||
},
|
||||
this.viewer.nativeElement
|
||||
);
|
||||
|
||||
this.utils = new PdfViewerUtils(
|
||||
this.instance,
|
||||
this.viewMode,
|
||||
this.multiSelectActive,
|
||||
this._baseHref
|
||||
);
|
||||
|
||||
console.log(this.utils);
|
||||
this.utils = new PdfViewerUtils(this.instance, this.viewMode, this.multiSelectActive);
|
||||
|
||||
this._setSelectionMode();
|
||||
this._disableElements();
|
||||
@ -357,7 +346,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
type: 'toolGroupButton',
|
||||
toolGroup: 'rectangleTools',
|
||||
dataElement: 'shapeToolGroupButton',
|
||||
img: this.utils.convertPath('/assets/icons/general/rectangle.svg'),
|
||||
img: this._convertPath('/assets/icons/general/rectangle.svg'),
|
||||
title: 'annotation.rectangle'
|
||||
});
|
||||
if (this._userPreferenceService.areDevFeaturesEnabled) {
|
||||
@ -365,7 +354,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
type: 'actionButton',
|
||||
element: 'compare',
|
||||
dataElement: 'compareButton',
|
||||
img: this.utils.convertPath('/assets/icons/general/pdftron-action-compare.svg'),
|
||||
img: this._convertPath('/assets/icons/general/pdftron-action-compare.svg'),
|
||||
title: 'Compare',
|
||||
onClick: () => {
|
||||
this.compareFileInput.nativeElement.click();
|
||||
@ -375,7 +364,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
type: 'actionButton',
|
||||
element: 'closeCompare',
|
||||
dataElement: 'closeCompareButton',
|
||||
img: this.utils.convertPath(
|
||||
img: this._convertPath(
|
||||
'/assets/icons/general/pdftron-action-close-compare.svg'
|
||||
),
|
||||
title: 'Leave Compare Mode',
|
||||
@ -430,8 +419,8 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
{
|
||||
type: 'actionButton',
|
||||
img: allAreVisible
|
||||
? this.utils.convertPath('/assets/icons/general/visibility-off.svg')
|
||||
: this.utils.convertPath('/assets/icons/general/visibility.svg'),
|
||||
? this._convertPath('/assets/icons/general/visibility-off.svg')
|
||||
: this._convertPath('/assets/icons/general/visibility.svg'),
|
||||
title: this._translateService.instant('annotation-actions.hide'),
|
||||
onClick: () => {
|
||||
this._ngZone.run(() => {
|
||||
@ -459,7 +448,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
this.instance.annotationPopup.add(<any>{
|
||||
type: 'actionButton',
|
||||
dataElement: 'add-rectangle',
|
||||
img: this.utils.convertPath('/assets/icons/general/pdftron-action-add-redaction.svg'),
|
||||
img: this._convertPath('/assets/icons/general/pdftron-action-add-redaction.svg'),
|
||||
title: this._translateService.instant(
|
||||
this._manualAnnotationService.getTitle('REDACTION')
|
||||
),
|
||||
@ -495,7 +484,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
private _configureTextPopup() {
|
||||
this.instance.textPopup.add(<any>{
|
||||
type: 'actionButton',
|
||||
img: this.utils.convertPath('/assets/icons/general/pdftron-action-search.svg'),
|
||||
img: this._convertPath('/assets/icons/general/pdftron-action-search.svg'),
|
||||
title: this._translateService.instant('pdf-viewer.text-popup.actions.search'),
|
||||
onClick: () => {
|
||||
const text = this.instance.docViewer.getSelectedText();
|
||||
@ -519,9 +508,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
this.instance.textPopup.add(<any>{
|
||||
type: 'actionButton',
|
||||
dataElement: 'add-false-positive',
|
||||
img: this.utils.convertPath(
|
||||
'/assets/icons/general/pdftron-action-false-positive.svg'
|
||||
),
|
||||
img: this._convertPath('/assets/icons/general/pdftron-action-false-positive.svg'),
|
||||
title: this._translateService.instant(
|
||||
this._manualAnnotationService.getTitle('FALSE_POSITIVE')
|
||||
),
|
||||
@ -543,7 +530,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
this.instance.textPopup.add(<any>{
|
||||
type: 'actionButton',
|
||||
dataElement: 'add-dictionary',
|
||||
img: this.utils.convertPath('/assets/icons/general/pdftron-action-add-dict.svg'),
|
||||
img: this._convertPath('/assets/icons/general/pdftron-action-add-dict.svg'),
|
||||
title: this._translateService.instant(
|
||||
this._manualAnnotationService.getTitle('DICTIONARY')
|
||||
),
|
||||
@ -564,7 +551,7 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
this.instance.textPopup.add(<any>{
|
||||
type: 'actionButton',
|
||||
dataElement: 'add-redaction',
|
||||
img: this.utils.convertPath('/assets/icons/general/pdftron-action-add-redaction.svg'),
|
||||
img: this._convertPath('/assets/icons/general/pdftron-action-add-redaction.svg'),
|
||||
title: this._translateService.instant(
|
||||
this._manualAnnotationService.getTitle('REDACTION')
|
||||
),
|
||||
@ -644,8 +631,8 @@ export class PdfViewerComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
private _documentLoaded(): void {
|
||||
console.log('document loaded');
|
||||
this._ngZone.run(() => {
|
||||
this.utils.ready = true;
|
||||
this.viewerReady.emit(this.instance);
|
||||
this.setInitialViewerState();
|
||||
});
|
||||
|
||||
@ -270,7 +270,9 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
await this._userPreferenceControllerService
|
||||
.savePreferences([this.fileId], key)
|
||||
.toPromise();
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
this._subscribeToFileUpdates();
|
||||
this.viewReady = true;
|
||||
@ -289,7 +291,9 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
||||
imported: true,
|
||||
force: true
|
||||
});
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
console.log(
|
||||
'[REDACTION] Delete previous annotations time: ' +
|
||||
|
||||
@ -40,18 +40,12 @@ const DISABLED_HOTKEYS = [
|
||||
export class PdfViewerUtils {
|
||||
instance: WebViewerInstance;
|
||||
viewMode: ViewMode;
|
||||
ready = false;
|
||||
multiSelectActive: boolean;
|
||||
private readonly _baseHref: string;
|
||||
|
||||
constructor(
|
||||
instance: WebViewerInstance,
|
||||
viewMode: ViewMode,
|
||||
multiSelectActive: boolean,
|
||||
baseHref: string
|
||||
) {
|
||||
constructor(instance: WebViewerInstance, viewMode: ViewMode, multiSelectActive: boolean) {
|
||||
this.instance = instance;
|
||||
this.viewMode = viewMode;
|
||||
this._baseHref = baseHref;
|
||||
this.multiSelectActive = multiSelectActive;
|
||||
}
|
||||
|
||||
@ -69,16 +63,22 @@ export class PdfViewerUtils {
|
||||
? Math.ceil(this.instance?.docViewer?.getCurrentPage() / 2)
|
||||
: this.instance?.docViewer?.getCurrentPage();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
get totalPages() {
|
||||
if (!this.ready) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return this.isCompareMode
|
||||
? Math.ceil(this.instance?.docViewer?.getPageCount() / 2)
|
||||
: this.instance?.docViewer?.getPageCount();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -178,10 +178,6 @@ export class PdfViewerUtils {
|
||||
this.instance.annotManager.deselectAnnotations(ann);
|
||||
}
|
||||
|
||||
convertPath(path: string): string {
|
||||
return this._baseHref + path;
|
||||
}
|
||||
|
||||
private _getAnnotationById(id: string): Annotations.Annotation {
|
||||
return this.instance.annotManager.getAnnotationById(id);
|
||||
}
|
||||
|
||||
@ -215,7 +215,9 @@ export class FileUploadService {
|
||||
if (subscription) {
|
||||
try {
|
||||
subscription.unsubscribe();
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
this._activeUploads.splice(index, 1);
|
||||
this.activeUploads--;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction",
|
||||
"API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1",
|
||||
"OAUTH_URL": "https://dev-06.iqser.cloud/auth/realms/redaction",
|
||||
"API_URL": "https://dev-06.iqser.cloud/redaction-gateway-v1",
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
"FRONTEND_APP_VERSION": "1.1",
|
||||
|
||||
@ -301,6 +301,7 @@ section.settings {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 50px;
|
||||
}
|
||||
|
||||
.app-name {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user