From 6333fae425ca0d4803d96ccf4e4c9d9d823573c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20BEYRAND?= Date: Mon, 19 Aug 2024 15:20:23 +0200 Subject: [PATCH 1/4] fix: ampersand symbol in pdf --- src/app/modules/pia/export/export.component.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/modules/pia/export/export.component.ts b/src/app/modules/pia/export/export.component.ts index 2223369d9..09b283d13 100644 --- a/src/app/modules/pia/export/export.component.ts +++ b/src/app/modules/pia/export/export.component.ts @@ -710,6 +710,8 @@ export class ExportComponent implements OnInit { const htmlRegexStrong2 = /<\/strong>/g; string = string.replace(htmlRegexStrong, ' **'); string = string.replace(htmlRegexStrong2, '**'); + const htmlRegexAnd = /&/g; + string = string.replace(htmlRegexAnd, '&'); const htmlRegexLi = /
  • /g; string = string.replace(htmlRegexLi, '- '); const htmlRegexBr = /
    /g; From d41b5f8849b85452a4ff50ea544c983eda92fc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20BEYRAND?= Date: Tue, 20 Aug 2024 17:26:17 +0200 Subject: [PATCH 2/4] fix: encoding for pdf --- src/app/modules/pia/content/measures/measures.component.ts | 3 ++- src/app/modules/pia/content/questions/questions.component.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/modules/pia/content/measures/measures.component.ts b/src/app/modules/pia/content/measures/measures.component.ts index 2694ce9d6..e08331458 100644 --- a/src/app/modules/pia/content/measures/measures.component.ts +++ b/src/app/modules/pia/content/measures/measures.component.ts @@ -352,6 +352,7 @@ export class MeasuresComponent implements OnInit, OnDestroy { tinymce.init({ branding: false, menubar: false, + entity_encoding: 'raw', statusbar: false, plugins: 'autoresize lists', forced_root_block: false, @@ -366,7 +367,7 @@ export class MeasuresComponent implements OnInit, OnDestroy { this.editor = editor; editor.on('focusout', async () => { this.measureForm.controls['measureContent'].patchValue( - editor.getContent() + editor.getContent({ format: 'text' }) ); await this.measureContentFocusOut(); tinymce.remove(this.editor); diff --git a/src/app/modules/pia/content/questions/questions.component.ts b/src/app/modules/pia/content/questions/questions.component.ts index 02caf1226..31182ed42 100644 --- a/src/app/modules/pia/content/questions/questions.component.ts +++ b/src/app/modules/pia/content/questions/questions.component.ts @@ -499,6 +499,7 @@ export class QuestionsComponent implements OnInit, OnDestroy { tinymce.init({ branding: false, menubar: false, + entity_encoding: 'raw', statusbar: false, plugins: 'autoresize lists', forced_root_block: false, @@ -515,7 +516,9 @@ export class QuestionsComponent implements OnInit, OnDestroy { }); editor.on('focusout', () => { // Save content - this.questionForm.controls['text'].patchValue(editor.getContent()); + this.questionForm.controls['text'].patchValue( + editor.getContent({ format: 'text' }) + ); this.questionContentFocusOut().then(() => { this.editor = null; tinymce.remove(this.editor); // Warning: take more time then a new initiation From 090f177902a1093550a5b49eb0bf03061467ee3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20BEYRAND?= Date: Wed, 21 Aug 2024 09:36:00 +0200 Subject: [PATCH 3/4] fix: tinymc config --- src/app/modules/pia/content/measures/measures.component.ts | 2 +- src/app/modules/pia/content/questions/questions.component.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/modules/pia/content/measures/measures.component.ts b/src/app/modules/pia/content/measures/measures.component.ts index e08331458..2e21af318 100644 --- a/src/app/modules/pia/content/measures/measures.component.ts +++ b/src/app/modules/pia/content/measures/measures.component.ts @@ -367,7 +367,7 @@ export class MeasuresComponent implements OnInit, OnDestroy { this.editor = editor; editor.on('focusout', async () => { this.measureForm.controls['measureContent'].patchValue( - editor.getContent({ format: 'text' }) + editor.getContent() ); await this.measureContentFocusOut(); tinymce.remove(this.editor); diff --git a/src/app/modules/pia/content/questions/questions.component.ts b/src/app/modules/pia/content/questions/questions.component.ts index 31182ed42..6f713fefd 100644 --- a/src/app/modules/pia/content/questions/questions.component.ts +++ b/src/app/modules/pia/content/questions/questions.component.ts @@ -516,9 +516,7 @@ export class QuestionsComponent implements OnInit, OnDestroy { }); editor.on('focusout', () => { // Save content - this.questionForm.controls['text'].patchValue( - editor.getContent({ format: 'text' }) - ); + this.questionForm.controls['text'].patchValue(editor.getContent()); this.questionContentFocusOut().then(() => { this.editor = null; tinymce.remove(this.editor); // Warning: take more time then a new initiation From 1d996c043b9e5ca6d08e27ffb8e2c3c0e814c5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20BEYRAND?= Date: Thu, 5 Sep 2024 18:22:52 +0200 Subject: [PATCH 4/4] fix: displaying of adequate PIA data on the preview page --- .../modules/pia/preview/preview.component.ts | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/app/modules/pia/preview/preview.component.ts b/src/app/modules/pia/preview/preview.component.ts index 84b3b7662..046889a64 100644 --- a/src/app/modules/pia/preview/preview.component.ts +++ b/src/app/modules/pia/preview/preview.component.ts @@ -6,6 +6,7 @@ import { Output, EventEmitter } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import { PiaService } from 'src/app/services/pia.service'; import { AppDataService } from 'src/app/services/app-data.service'; import { TranslateService } from '@ngx-translate/core'; @@ -43,6 +44,7 @@ export class PreviewComponent implements OnInit, AfterViewChecked { public download = false; constructor( + private route: ActivatedRoute, public authService: AuthService, public actionPlanService: ActionPlanService, private translateService: TranslateService, @@ -59,22 +61,29 @@ export class PreviewComponent implements OnInit, AfterViewChecked { this.content = []; this.dataNav = this.appDataService.dataNav; - this.showPia(); + this.piaService + .find(parseInt(this.route.snapshot.params.id)) + .then(async (pia: Pia) => { + this.pia = pia; + this.actionPlanService.data = this.dataNav; + this.actionPlanService.pia = this.pia; + this.showPia(); - if (this.pia.is_archive === 1) { - this.fromArchives = true; - } + if (this.pia.is_archive === 1) { + this.fromArchives = true; + } - // Load PIA's revisions - const revision = new Revision(); - this.revisionService.findAllByPia(this.pia.id).then(resp => { - this.revisions = resp; - }); + // Load PIA's revisions + const revision = new Revision(); + this.revisionService.findAllByPia(this.pia.id).then(resp => { + this.revisions = resp; + }); - if (this.pia.structure_data) { - this.appDataService.dataNav = this.pia.structure_data; - } - this.data = this.appDataService.dataNav; + if (this.pia.structure_data) { + this.appDataService.dataNav = this.pia.structure_data; + } + this.data = this.appDataService.dataNav; + }); } ngAfterViewChecked(): void { @@ -121,8 +130,6 @@ export class PreviewComponent implements OnInit, AfterViewChecked { */ async showPia(): Promise { this.prepareDpoData(); - this.actionPlanService.data = this.dataNav; - this.actionPlanService.pia = this.pia; this.actionPlanService.listActionPlan(); this.getJsonInfo(); }