From 57e66ea0191a81587e8853a1f439d90e9165ac25 Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Mon, 15 Jul 2024 17:39:27 +0300 Subject: [PATCH] annotation dialog ui fixes --- .../annotation-dialog.component.html | 10 ++-------- .../annotation-dialog.component.ts | 16 +++++++++++++--- .../text-area-with-mentions.component.html | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html b/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html index 180c11476..f42c9324a 100644 --- a/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html +++ b/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.html @@ -91,10 +91,7 @@
- -
{{annotationItem.payload}} 
-
{{annotationItem.payload}} 
-
+
@@ -137,10 +134,7 @@
- -
{{annotationItem.payload}} 
-
{{annotationItem.payload}} 
-
+
diff --git a/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts b/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts index 8d424fb8b..e8f8d4971 100644 --- a/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts +++ b/frontend/src/app/ui/annotations/annotation-dialog-component/annotation-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, ViewChild } from '@angular/core'; +import { Component, Inject, SecurityContext, ViewChild } from '@angular/core'; import { FormBuilder, FormControl, UntypedFormArray, UntypedFormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; @@ -64,6 +64,7 @@ export class AnnotationDialogComponent extends BaseComponent { queryIncludesField: boolean = false; queryIncludesAnnotation: boolean = false; + MENTION_CLASS: string = "highlight-user-mention" @ViewChild('annotationStatus') annotationStatus: MatSelectionList; @@ -79,6 +80,7 @@ export class AnnotationDialogComponent extends BaseComponent { private statusService: StatusService, protected routerUtils: RouterUtilsService, private configurationService: ConfigurationService, + private sanitizer: DomSanitizer, ) { super(); this.entityId = data.entityId; @@ -190,8 +192,14 @@ export class AnnotationDialogComponent extends BaseComponent { this.threadReplyTextsFG[element.threadId.toString()] = this.formBuilder.group({ replyText: new FormControl(null, [Validators.required]) }); this.annotationsPerThread[element.threadId.toString()] = data.items.filter(x => x.threadId === element.threadId && x.id !== element.id).sort((a1, a2) => new Date(a1.timeStamp).getTime() - new Date(a2.timeStamp).getTime()); - let parentAnnotation: any = data.items.filter(x => x.threadId === element.threadId && x.id === element.id)[0]; - parentAnnotation.payload = this.parsePayload(parentAnnotation.payload); + const parentAnnotation: any = data.items.filter(x => x.threadId === element.threadId && x.id === element.id)[0]; + const annotationItems = this.parsePayload(parentAnnotation.payload); + + parentAnnotation.payload = annotationItems.map(item => { + if (item.isMention) return `${item.payload}` + else return item.payload; + }).join(''); + this.parentAnnotationsPerThread[element.threadId.toString()] = parentAnnotation; this.threads.add(element.threadId); @@ -382,6 +390,8 @@ export class AnnotationDialogComponent extends BaseComponent { annotationItem.payload = this.planUsers.find(u => p.includes(u.id.toString()))?.user?.name; } + annotationItem.payload = this.sanitizer.sanitize(SecurityContext.HTML, annotationItem.payload); + return annotationItem; }); diff --git a/frontend/src/app/ui/annotations/components/text-area-with-mentions.component.html b/frontend/src/app/ui/annotations/components/text-area-with-mentions.component.html index 8119f1a20..2b02fd8ad 100644 --- a/frontend/src/app/ui/annotations/components/text-area-with-mentions.component.html +++ b/frontend/src/app/ui/annotations/components/text-area-with-mentions.component.html @@ -3,7 +3,7 @@ {{'ANNOTATION-DIALOG.THREADS.NEW-THREAD' | translate}}