From fe7c272137c2806fc4bdf4b19ee1b99a86b8a5d6 Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 2 Dec 2020 15:25:41 +0200 Subject: [PATCH] made admin pages work for admin, fixed some bugs --- .../manual-annotation-dialog.component.html | 14 +++----------- .../dictionary-overview-screen.component.html | 12 +++++++++--- .../dictionary-overview-screen.component.scss | 4 ++++ .../dictionary-overview-screen.component.ts | 3 ++- .../file/pdf-viewer/pdf-viewer.component.ts | 14 ++++++++------ apps/red-ui/src/app/state/app-state.guard.ts | 5 ++--- 6 files changed, 28 insertions(+), 24 deletions(-) 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 8f96614f6..c92cd7956 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 @@ -39,17 +39,9 @@ - - - {{ dictionary.label }} - - - - - - {{ dictionary.label }} - - + + {{ dictionary.label }} + diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html index cad56b291..997b8debc 100644 --- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html +++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html @@ -40,7 +40,13 @@
- +
@@ -50,8 +56,8 @@
{{ currentMatch + '/' + searchPositions.length }}
- - + +
diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss index dcf9b1926..7e7d258be 100644 --- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss +++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss @@ -74,6 +74,10 @@ ace-editor { input { padding-right: 32px; + + &.with-matches { + padding-right: 108px; + } } .input-icons { diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts index ac015f6c1..673f7d11c 100644 --- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts @@ -173,6 +173,7 @@ export class DictionaryOverviewScreenComponent { } nextSearchMatch() { + // length = 3 if (this.searchPositions.length > 0) { this.currentMatch = this.currentMatch < this.searchPositions.length ? this.currentMatch + 1 : 1; this._gotoLine(); @@ -181,7 +182,7 @@ export class DictionaryOverviewScreenComponent { previousSearchMatch() { if (this.searchPositions.length > 0) { - this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length - 1; + this.currentMatch = this.currentMatch > 1 ? this.currentMatch - 1 : this.searchPositions.length; this._gotoLine(); } } 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 82374e513..1675aa77b 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 @@ -109,12 +109,14 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { instance.docViewer.on('keyUp', ($event) => { // arrows and full-screen - if ($event.key.startsWith('Arrow') || $event.key === 'f') { - this._ngZone.run(() => { - this.keyUp.emit($event); - }); - $event.preventDefault(); - $event.stopPropagation(); + if ($event.target?.tagName?.toLowerCase() !== 'input') { + if ($event.key.startsWith('Arrow') || $event.key === 'f') { + this._ngZone.run(() => { + this.keyUp.emit($event); + }); + $event.preventDefault(); + $event.stopPropagation(); + } } if (this._allowedKeyboardShortcuts.indexOf($event.key) < 0) { diff --git a/apps/red-ui/src/app/state/app-state.guard.ts b/apps/red-ui/src/app/state/app-state.guard.ts index c9238cbed..4e506655b 100644 --- a/apps/red-ui/src/app/state/app-state.guard.ts +++ b/apps/red-ui/src/app/state/app-state.guard.ts @@ -11,14 +11,13 @@ export class AppStateGuard implements CanActivate { async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise { await this._userService.loadAllUsersIfNecessary(); + await this._appStateService.loadDictionaryDataIfNecessary(); + await this._appStateService.updateDictionaryVersion(); if (this._userService.isUser()) { await this._appStateService.loadAllProjectsIfNecessary(); } - await this._appStateService.loadDictionaryDataIfNecessary(); - await this._appStateService.updateDictionaryVersion(); - return true; } }