From a5e222c3dae4327029eb04c0f335479c41a89374 Mon Sep 17 00:00:00 2001
From: Marlene Simondant <msimondant@grandlyon.com>
Date: Tue, 18 Mar 2025 15:42:09 +0100
Subject: [PATCH] Fix accents converted by sanitize

---
 .../orientation-details/orientation-details.component.ts | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/app/profile/dashboard/orientation-details/orientation-details.component.ts b/src/app/profile/dashboard/orientation-details/orientation-details.component.ts
index d467a4877..bf8a9e20a 100644
--- a/src/app/profile/dashboard/orientation-details/orientation-details.component.ts
+++ b/src/app/profile/dashboard/orientation-details/orientation-details.component.ts
@@ -64,7 +64,8 @@ export class OrientationDetailsComponent implements OnInit {
   public closeOrientation(event, isClosed): void {
     if (event) {
       const comment = this.commentTextarea?.value || '';
-      const sanitizedComment = this.sanitizer.sanitize(SecurityContext.HTML, comment);
+      const sanitizedHtml = this.sanitizer.sanitize(SecurityContext.HTML, comment);
+      const sanitizedComment = this.extractPlainText(sanitizedHtml || '');
       this.patchOrientation({
         status: this.selectedStatus,
         action: null,
@@ -76,6 +77,12 @@ export class OrientationDetailsComponent implements OnInit {
     this.isModalOpenned = false;
   }
 
+  private extractPlainText(html: string): string {
+    const tempElement = document.createElement('div');
+    tempElement.innerHTML = html;
+    return tempElement.textContent || '';
+  }
+
   public acknowledgeNewOrientation(): void {
     if (this.orientation.status === 'new') {
       this.patchOrientation({ status: 'waiting', action: 'defineAppointment', modifiedBy: this.userProfile._id });
-- 
GitLab