diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 5dd83010f..55f89f721 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -78,6 +78,7 @@ import { TablesService } from './services/tables.service'; import { ViewModeService } from './services/view-mode.service'; import { ALL_HOTKEYS, TextPopups } from './utils/constants'; import { RedactTextData } from './utils/dialog-types'; +import { AnnotationActionsService } from './services/annotation-actions.service'; const textActions = [TextPopups.REDACT_TEXT, TextPopups.ADD_HINT, TextPopups.ADD_FALSE_POSITIVE]; @@ -176,6 +177,7 @@ export class FilePreviewScreenComponent private readonly _dossierTemplatesService: DossierTemplatesService, private readonly _dialog: MatDialog, private readonly _tablesService: TablesService, + private readonly _annotationActionsService: AnnotationActionsService, ) { super(); effect(() => { @@ -398,6 +400,12 @@ export class FilePreviewScreenComponent if (['Escape'].includes($event.key)) { $event.preventDefault(); + if (this._annotationManager.resizingAnnotationId) { + const resizedAnnotation = this._fileDataService + .annotations() + .find(annotation => annotation.id === this._annotationManager.resizingAnnotationId); + this._annotationActionsService.cancelResize(resizedAnnotation).then(); + } this.fullScreen = false; this.closeFullScreen(); this._changeRef.markForCheck(); diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts index 593c5d132..a064347f8 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts @@ -21,6 +21,7 @@ import TextHighlightAnnotation = Core.Annotations.TextHighlightAnnotation; import DocumentViewer = Core.DocumentViewer; import Quad = Core.Math.Quad; import TextTool = Core.Tools.TextTool; +import { REDAnnotationManager } from './annotation-manager.service'; @Injectable() export class PdfViewer { @@ -69,6 +70,7 @@ export class PdfViewer { private readonly _logger: NGXLogger, private readonly _errorService: ErrorService, private readonly _userPreferenceService: UserPreferenceService, + private readonly _annotationManager: REDAnnotationManager, ) { this.totalPages = this.#totalPages.asReadonly(); this.isCompareMode = this.#isCompareMode.asReadonly(); @@ -274,7 +276,7 @@ export class PdfViewer { #listenForEsc() { this.#instance.UI.hotkeys.on('esc', e => { e.preventDefault(); - if (this.#isElementActive('searchPanel')) { + if (this.#isElementActive('searchPanel') && !this._annotationManager.resizingAnnotationId) { this.#focusViewer(); this.deactivateSearch(); }