Pull request #204: configure selection mode by env var
Merge in RED/ui from RED-1542 to master * commit '499323fe157e27778b5cb33e0b1ed6d4df42e884': configure selection mode by env var
This commit is contained in:
commit
371bf42149
@ -16,6 +16,7 @@ export enum AppConfigKey {
|
|||||||
ADMIN_CONTACT_NAME = 'ADMIN_CONTACT_NAME',
|
ADMIN_CONTACT_NAME = 'ADMIN_CONTACT_NAME',
|
||||||
ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL',
|
ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL',
|
||||||
AUTO_READ_TIME = 'AUTO_READ_TIME',
|
AUTO_READ_TIME = 'AUTO_READ_TIME',
|
||||||
|
SELECTION_MODE = 'SELECTION_MODE',
|
||||||
MAX_FILE_SIZE_MB = 'MAX_FILE_SIZE_MB',
|
MAX_FILE_SIZE_MB = 'MAX_FILE_SIZE_MB',
|
||||||
RECENT_PERIOD_IN_HOURS = 'RECENT_PERIOD_IN_HOURS',
|
RECENT_PERIOD_IN_HOURS = 'RECENT_PERIOD_IN_HOURS',
|
||||||
DELETE_RETENTION_HOURS = 'DELETE_RETENTION_HOURS',
|
DELETE_RETENTION_HOURS = 'DELETE_RETENTION_HOURS',
|
||||||
|
|||||||
@ -25,7 +25,8 @@ import { AnnotationActionsService } from '../../services/annotation-actions.serv
|
|||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { translateQuads } from '@utils/pdf-coordinates';
|
import { translateQuads } from '@utils/pdf-coordinates';
|
||||||
import { BASE_HREF } from '../../../../tokens';
|
import { BASE_HREF } from '../../../../tokens';
|
||||||
import Tool = Tools.Tool;
|
import { AppConfigKey, AppConfigService } from '../../../app-config/app-config.service';
|
||||||
|
import TextTool = Tools.TextTool;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-pdf-viewer',
|
selector: 'redaction-pdf-viewer',
|
||||||
@ -49,7 +50,6 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
@ViewChild('viewer', { static: true }) viewer: ElementRef;
|
@ViewChild('viewer', { static: true }) viewer: ElementRef;
|
||||||
instance: WebViewerInstance;
|
instance: WebViewerInstance;
|
||||||
private _selectedText = '';
|
private _selectedText = '';
|
||||||
private _defaultTool: Tool;
|
|
||||||
private readonly _allowedKeyboardShortcuts = ['+', '-', 'p', 'r', 'Escape'];
|
private readonly _allowedKeyboardShortcuts = ['+', '-', 'p', 'r', 'Escape'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -59,7 +59,8 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
private readonly _ngZone: NgZone,
|
private readonly _ngZone: NgZone,
|
||||||
private readonly _userPreferenceService: UserPreferenceService,
|
private readonly _userPreferenceService: UserPreferenceService,
|
||||||
private readonly _annotationDrawService: AnnotationDrawService,
|
private readonly _annotationDrawService: AnnotationDrawService,
|
||||||
private readonly _annotationActionsService: AnnotationActionsService
|
private readonly _annotationActionsService: AnnotationActionsService,
|
||||||
|
private readonly _appConfigService: AppConfigService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -102,18 +103,15 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
this.deselectAllAnnotations();
|
this.deselectAllAnnotations();
|
||||||
}
|
}
|
||||||
|
|
||||||
const annotationsFromViewer = annotations.map(ann =>
|
const annotationsFromViewer = annotations.map(ann => this._getAnnotationById(ann.id));
|
||||||
this.instance.annotManager.getAnnotationById(ann.id)
|
|
||||||
);
|
|
||||||
this.instance.annotManager.selectAnnotations(annotationsFromViewer);
|
this.instance.annotManager.selectAnnotations(annotationsFromViewer);
|
||||||
this.navigateToPage(annotations[0].pageNumber);
|
this.navigateToPage(annotations[0].pageNumber);
|
||||||
this.instance.annotManager.jumpToAnnotation(annotationsFromViewer[0]);
|
this.instance.annotManager.jumpToAnnotation(annotationsFromViewer[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
deselectAnnotations(annotations: AnnotationWrapper[]) {
|
deselectAnnotations(annotations: AnnotationWrapper[]) {
|
||||||
this.instance.annotManager.deselectAnnotations(
|
const ann = annotations.map(a => this._getAnnotationById(a.id));
|
||||||
annotations.map(ann => this.instance.annotManager.getAnnotationById(ann.id))
|
this.instance.annotManager.deselectAnnotations(ann);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToPage(pageNumber: number) {
|
navigateToPage(pageNumber: number) {
|
||||||
@ -133,6 +131,10 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
this.instance.docViewer.getDisplayModeManager().setDisplayMode(instanceDisplayMode);
|
this.instance.docViewer.getDisplayModeManager().setDisplayMode(instanceDisplayMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getAnnotationById(id: string): Annotations.Annotation {
|
||||||
|
return this.instance.annotManager.getAnnotationById(id);
|
||||||
|
}
|
||||||
|
|
||||||
private _loadViewer() {
|
private _loadViewer() {
|
||||||
WebViewer(
|
WebViewer(
|
||||||
{
|
{
|
||||||
@ -143,6 +145,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
this.viewer.nativeElement
|
this.viewer.nativeElement
|
||||||
).then(instance => {
|
).then(instance => {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
|
this._setSelectionMode();
|
||||||
this._disableElements();
|
this._disableElements();
|
||||||
this._disableHotkeys();
|
this._disableHotkeys();
|
||||||
this._configureTextPopup();
|
this._configureTextPopup();
|
||||||
@ -158,7 +161,6 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
this._toggleRectangleAnnotationAction(
|
this._toggleRectangleAnnotationAction(
|
||||||
annotations.length === 1 && annotations[0].ReadOnly
|
annotations.length === 1 && annotations[0].ReadOnly
|
||||||
);
|
);
|
||||||
// this.annotationSelected.emit(annotations.map((a) => a.Id));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -228,6 +230,11 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _setSelectionMode(): void {
|
||||||
|
const textTool = (<unknown>this.instance.Tools.TextTool) as TextTool;
|
||||||
|
textTool.SELECTION_MODE = this._appConfigService.getConfig(AppConfigKey.SELECTION_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
private _toggleRectangleAnnotationAction(readonly: boolean) {
|
private _toggleRectangleAnnotationAction(readonly: boolean) {
|
||||||
if (!readonly) {
|
if (!readonly) {
|
||||||
this.instance.enableElements(['add-rectangle']);
|
this.instance.enableElements(['add-rectangle']);
|
||||||
@ -537,15 +544,14 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _documentLoaded() {
|
private _documentLoaded(): void {
|
||||||
this._ngZone.run(() => {
|
this._ngZone.run(() => {
|
||||||
this._defaultTool = this.instance.getToolMode();
|
|
||||||
this.viewerReady.emit(this.instance);
|
this.viewerReady.emit(this.instance);
|
||||||
this.setInitialViewerState();
|
this.setInitialViewerState();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _disableHotkeys() {
|
private _disableHotkeys(): void {
|
||||||
this.instance.hotkeys.off('CTRL+SHIFT+EQUAL');
|
this.instance.hotkeys.off('CTRL+SHIFT+EQUAL');
|
||||||
this.instance.hotkeys.off('COMMAND+SHIFT+EQUAL');
|
this.instance.hotkeys.off('COMMAND+SHIFT+EQUAL');
|
||||||
this.instance.hotkeys.off('CTRL+SHIFT+MINUS');
|
this.instance.hotkeys.off('CTRL+SHIFT+MINUS');
|
||||||
|
|||||||
@ -225,7 +225,7 @@
|
|||||||
[canPerformActions]="canPerformAnnotationActions"
|
[canPerformActions]="canPerformAnnotationActions"
|
||||||
[fileData]="displayData"
|
[fileData]="displayData"
|
||||||
[fileStatus]="appStateService.activeFile"
|
[fileStatus]="appStateService.activeFile"
|
||||||
[multiSelectActive]="!!fileWorkloadComponent?.multiSelectActive"
|
[multiSelectActive]="multiSelectActive"
|
||||||
[shouldDeselectAnnotationsOnPageChange]="shouldDeselectAnnotationsOnPageChange"
|
[shouldDeselectAnnotationsOnPageChange]="shouldDeselectAnnotationsOnPageChange"
|
||||||
></redaction-pdf-viewer>
|
></redaction-pdf-viewer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -75,7 +75,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
|||||||
hideSkipped = false;
|
hideSkipped = false;
|
||||||
displayPDFViewer = false;
|
displayPDFViewer = false;
|
||||||
viewDocumentInfo = false;
|
viewDocumentInfo = false;
|
||||||
@ViewChild(FileWorkloadComponent) fileWorkloadComponent: FileWorkloadComponent;
|
|
||||||
private _instance: WebViewerInstance;
|
private _instance: WebViewerInstance;
|
||||||
private _lastPage: string;
|
private _lastPage: string;
|
||||||
@ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent;
|
@ViewChild('fileWorkloadComponent') private _workloadComponent: FileWorkloadComponent;
|
||||||
@ -112,13 +112,13 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get singleUsersSelectOptions() {
|
get singleUsersSelectOptions(): string[] {
|
||||||
return this.appStateService.activeFile?.isUnderApproval
|
return this.appStateService.activeFile?.isUnderApproval
|
||||||
? this.appStateService.activeDossier.approverIds
|
? this.appStateService.activeDossier.approverIds
|
||||||
: this.appStateService.activeDossier.memberIds;
|
: this.appStateService.activeDossier.memberIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
get assignTooltip() {
|
get assignTooltip(): string {
|
||||||
return this.appStateService.activeFile.isUnderApproval
|
return this.appStateService.activeFile.isUnderApproval
|
||||||
? 'dossier-overview.assign-approver'
|
? 'dossier-overview.assign-approver'
|
||||||
: 'dossier-overview.assign-reviewer';
|
: 'dossier-overview.assign-reviewer';
|
||||||
@ -172,6 +172,10 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
|||||||
return this.appStateService.activeFileId;
|
return this.appStateService.activeFileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get multiSelectActive(): boolean {
|
||||||
|
return !!this._workloadComponent?.multiSelectActive;
|
||||||
|
}
|
||||||
|
|
||||||
updateViewMode() {
|
updateViewMode() {
|
||||||
const annotations = this._getAnnotations(a => a.getCustomData('redacto-manager'));
|
const annotations = this._getAnnotations(a => a.getCustomData('redacto-manager'));
|
||||||
const redactions = annotations.filter(a => a.getCustomData('redaction'));
|
const redactions = annotations.filter(a => a.getCustomData('redaction'));
|
||||||
@ -294,9 +298,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
|||||||
|
|
||||||
handleAnnotationSelected(annotationIds: string[]) {
|
handleAnnotationSelected(annotationIds: string[]) {
|
||||||
this.selectedAnnotations = annotationIds
|
this.selectedAnnotations = annotationIds
|
||||||
.map(annotationId =>
|
.map(id => this.annotations.find(annotationWrapper => annotationWrapper.id === id))
|
||||||
this.annotations.find(annotationWrapper => annotationWrapper.id === annotationId)
|
|
||||||
)
|
|
||||||
.filter(ann => ann !== undefined);
|
.filter(ann => ann !== undefined);
|
||||||
if (this.selectedAnnotations.length > 1) {
|
if (this.selectedAnnotations.length > 1) {
|
||||||
this._workloadComponent.multiSelectActive = true;
|
this._workloadComponent.multiSelectActive = true;
|
||||||
@ -391,7 +393,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach,
|
|||||||
viewerPageChanged($event: any) {
|
viewerPageChanged($event: any) {
|
||||||
if (typeof $event === 'number') {
|
if (typeof $event === 'number') {
|
||||||
this._scrollViews();
|
this._scrollViews();
|
||||||
if (!this.fileWorkloadComponent.multiSelectActive) {
|
if (!this._workloadComponent.multiSelectActive) {
|
||||||
this.shouldDeselectAnnotationsOnPageChange = true;
|
this.shouldDeselectAnnotationsOnPageChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
"LICENSE_START": "01-01-2021",
|
"LICENSE_START": "01-01-2021",
|
||||||
"LICENSE_END": "31-12-2021",
|
"LICENSE_END": "31-12-2021",
|
||||||
"LICENSE_PAGE_COUNT": 1000000,
|
"LICENSE_PAGE_COUNT": 1000000,
|
||||||
|
"SELECTION_MODE": "structural",
|
||||||
"RECENT_PERIOD_IN_HOURS": 24,
|
"RECENT_PERIOD_IN_HOURS": 24,
|
||||||
"MAX_FILE_SIZE_MB": 100,
|
"MAX_FILE_SIZE_MB": 100,
|
||||||
"DELETE_RETENTION_HOURS": 96
|
"DELETE_RETENTION_HOURS": 96
|
||||||
|
|||||||
@ -8,6 +8,7 @@ OAUTH_IDP_HINT="${OAUTH_IDP_HINT:-}"
|
|||||||
ADMIN_CONTACT_NAME="${ADMIN_CONTACT_NAME:-}"
|
ADMIN_CONTACT_NAME="${ADMIN_CONTACT_NAME:-}"
|
||||||
ADMIN_CONTACT_URL="${ADMIN_CONTACT_URL:-}"
|
ADMIN_CONTACT_URL="${ADMIN_CONTACT_URL:-}"
|
||||||
AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}"
|
AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}"
|
||||||
|
SELECTION_MODE="${SELECTION_MODE:-structural}"
|
||||||
MAX_FILE_SIZE_MB="${MAX_FILE_SIZE_MB:-50}"
|
MAX_FILE_SIZE_MB="${MAX_FILE_SIZE_MB:-50}"
|
||||||
DELETE_RETENTION_HOURS="${DELETE_RETENTION_HOURS:-96}"
|
DELETE_RETENTION_HOURS="${DELETE_RETENTION_HOURS:-96}"
|
||||||
RECENT_PERIOD_IN_HOURS="${RECENT_PERIOD_IN_HOURS:-24}"
|
RECENT_PERIOD_IN_HOURS="${RECENT_PERIOD_IN_HOURS:-24}"
|
||||||
@ -35,6 +36,7 @@ echo '{
|
|||||||
"LICENSE_EMAIL":"'"$LICENSE_EMAIL"'",
|
"LICENSE_EMAIL":"'"$LICENSE_EMAIL"'",
|
||||||
"APP_NAME":"'"$APP_NAME"'",
|
"APP_NAME":"'"$APP_NAME"'",
|
||||||
"AUTO_READ_TIME":'"$AUTO_READ_TIME"',
|
"AUTO_READ_TIME":'"$AUTO_READ_TIME"',
|
||||||
|
"SELECTION_MODE":"'"$SELECTION_MODE"'",
|
||||||
"MAX_FILE_SIZE_MB":"'"$MAX_FILE_SIZE_MB"'",
|
"MAX_FILE_SIZE_MB":"'"$MAX_FILE_SIZE_MB"'",
|
||||||
"RECENT_PERIOD_IN_HOURS":"'"RECENT_PERIOD_IN_HOURS"'",
|
"RECENT_PERIOD_IN_HOURS":"'"RECENT_PERIOD_IN_HOURS"'",
|
||||||
"DELETE_RETENTION_HOURS":"'"$DELETE_RETENTION_HOURS"'",
|
"DELETE_RETENTION_HOURS":"'"$DELETE_RETENTION_HOURS"'",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user