Merge branch 'RED-7296' into 'master'
RED-7296: implemented rectangle deletion by pressing esc. See merge request redactmanager/red-ui!289
This commit is contained in:
commit
7656cd6000
@ -11,6 +11,7 @@ import { JustificationsService } from '@services/entity-services/justifications.
|
|||||||
import { Roles } from '@users/roles';
|
import { Roles } from '@users/roles';
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
import { ManualRedactionService } from '../../services/manual-redaction.service';
|
import { ManualRedactionService } from '../../services/manual-redaction.service';
|
||||||
|
import { REDAnnotationManager } from '../../../pdf-viewer/services/annotation-manager.service';
|
||||||
|
|
||||||
export interface LegalBasisOption {
|
export interface LegalBasisOption {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -40,6 +41,7 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
activeDossiersService: ActiveDossiersService,
|
activeDossiersService: ActiveDossiersService,
|
||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
protected readonly _dialogRef: MatDialogRef<ManualAnnotationDialogComponent>,
|
protected readonly _dialogRef: MatDialogRef<ManualAnnotationDialogComponent>,
|
||||||
|
private readonly _annotationManager: REDAnnotationManager,
|
||||||
@Inject(MAT_DIALOG_DATA) readonly data: { manualRedactionEntryWrapper: ManualRedactionEntryWrapper; dossierId: string; file: File },
|
@Inject(MAT_DIALOG_DATA) readonly data: { manualRedactionEntryWrapper: ManualRedactionEntryWrapper; dossierId: string; file: File },
|
||||||
) {
|
) {
|
||||||
super(_dialogRef);
|
super(_dialogRef);
|
||||||
@ -111,6 +113,13 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
super.close();
|
||||||
|
if (this.isRectangle) {
|
||||||
|
this._annotationManager.delete(this._annotationManager.selected[0].Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#getRectangles() {
|
#getRectangles() {
|
||||||
const quads = this.data.manualRedactionEntryWrapper.manualRedactionEntry.positions.find(a => !!a);
|
const quads = this.data.manualRedactionEntryWrapper.manualRedactionEntry.positions.find(a => !!a);
|
||||||
const value: string = this.form.get('multiplePages').value.replace(/[^0-9-,]/g, '');
|
const value: string = this.form.get('multiplePages').value.replace(/[^0-9-,]/g, '');
|
||||||
|
|||||||
@ -294,11 +294,13 @@ export class FilePreviewScreenComponent
|
|||||||
this._viewerHeaderService.enableLoadAllAnnotations(); // Reset the button state (since the viewer is reused between files)
|
this._viewerHeaderService.enableLoadAllAnnotations(); // Reset the button state (since the viewer is reused between files)
|
||||||
super.ngOnDetach();
|
super.ngOnDetach();
|
||||||
document.documentElement.removeEventListener('fullscreenchange', this.fullscreenListener);
|
document.documentElement.removeEventListener('fullscreenchange', this.fullscreenListener);
|
||||||
|
this.pdf.instance.UI.hotkeys.off('esc');
|
||||||
this._changeRef.markForCheck();
|
this._changeRef.markForCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
document.documentElement.removeEventListener('fullscreenchange', this.fullscreenListener);
|
document.documentElement.removeEventListener('fullscreenchange', this.fullscreenListener);
|
||||||
|
this.pdf.instance.UI.hotkeys.off('esc');
|
||||||
super.ngOnDestroy();
|
super.ngOnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,6 +311,19 @@ export class FilePreviewScreenComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bind()
|
||||||
|
handleDeleteRectangleOnEsc($event: KeyboardEvent) {
|
||||||
|
$event.preventDefault();
|
||||||
|
if (!!this._annotationManager.selected[0]) {
|
||||||
|
const doesHaveWrapper = this._fileDataService.find(this._annotationManager.selected[0]?.Id);
|
||||||
|
if (!doesHaveWrapper) {
|
||||||
|
this._annotationManager.delete(this._annotationManager.selected[0]?.Id);
|
||||||
|
} else {
|
||||||
|
this._annotationManager.deselect(this._annotationManager.selected[0]?.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnAttach(previousRoute: ActivatedRouteSnapshot) {
|
async ngOnAttach(previousRoute: ActivatedRouteSnapshot) {
|
||||||
if (!this.state.file().canBeOpened) {
|
if (!this.state.file().canBeOpened) {
|
||||||
return this.#navigateToDossier();
|
return this.#navigateToDossier();
|
||||||
@ -341,7 +356,7 @@ export class FilePreviewScreenComponent
|
|||||||
this.pdfProxyService.configureElements();
|
this.pdfProxyService.configureElements();
|
||||||
this.#restoreOldFilters();
|
this.#restoreOldFilters();
|
||||||
document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener);
|
document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener);
|
||||||
|
this.pdf.instance.UI.hotkeys.on('esc', this.handleDeleteRectangleOnEsc);
|
||||||
this.#openComponentLogDialogIfDefault();
|
this.#openComponentLogDialogIfDefault();
|
||||||
this._viewerHeaderService.resetLayers();
|
this._viewerHeaderService.resetLayers();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -266,12 +266,18 @@ export class PdfViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#listenForEsc() {
|
#listenForEsc() {
|
||||||
this.#instance.UI.hotkeys.on('esc', e => {
|
this.#instance.UI.hotkeys.on('esc', {
|
||||||
|
keydown: e => {
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
keyup: e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) {
|
if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) {
|
||||||
this.#focusViewer();
|
this.#focusViewer();
|
||||||
this.deactivateSearch();
|
this.deactivateSearch();
|
||||||
}
|
}
|
||||||
|
this.#clickSelectToolButton();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,4 +388,9 @@ export class PdfViewer {
|
|||||||
this.instance.UI.iframeWindow.document.getElementById('SearchPanel__input').blur();
|
this.instance.UI.iframeWindow.document.getElementById('SearchPanel__input').blur();
|
||||||
this.instance.UI.iframeWindow.focus();
|
this.instance.UI.iframeWindow.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#clickSelectToolButton() {
|
||||||
|
const selectButton = this.instance.UI.iframeWindow.document.querySelector('[data-element="selectToolButton"]') as HTMLElement;
|
||||||
|
selectButton.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,6 +65,7 @@ export const DISABLED_HOTKEYS = [
|
|||||||
'SPACE',
|
'SPACE',
|
||||||
'UP',
|
'UP',
|
||||||
'DOWN',
|
'DOWN',
|
||||||
|
'ESCAPE',
|
||||||
'R',
|
'R',
|
||||||
'P',
|
'P',
|
||||||
'A',
|
'A',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user