From 4e39c5d0dcb732dc80a325b90941d0dd83dabf7c Mon Sep 17 00:00:00 2001
From: LeRatierBretonnien <sylvain@lahiette.com>
Date: Tue, 7 Jan 2025 17:44:30 +0100
Subject: [PATCH] Fix #15: Notes/Description for protagonist sheet

---
 module/applications/sheets/protagonist-sheet.mjs | 3 +++
 templates/protagonist-biography.hbs              | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/module/applications/sheets/protagonist-sheet.mjs b/module/applications/sheets/protagonist-sheet.mjs
index 350e9ba..530c3a2 100644
--- a/module/applications/sheets/protagonist-sheet.mjs
+++ b/module/applications/sheets/protagonist-sheet.mjs
@@ -73,6 +73,9 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
     const context = await super._prepareContext()
     context.tabs = this.#getTabs()
 
+    context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
+    context.enrichedNotes = await TextEditor.enrichHTML(this.document.system.notes, { async: true })
+    
     context.tooltipsCharacteristic = {
       str: game.i18n.localize("CTHULHUETERNAL.Characteristic.Str"),
       dex: game.i18n.localize("CTHULHUETERNAL.Characteristic.Dex"),
diff --git a/templates/protagonist-biography.hbs b/templates/protagonist-biography.hbs
index 1fdb9c7..c80ff85 100644
--- a/templates/protagonist-biography.hbs
+++ b/templates/protagonist-biography.hbs
@@ -17,11 +17,11 @@
 
   <fieldset>
     <legend>{{localize "CTHULHUETERNAL.Label.description"}}</legend>
-    {{formInput systemFields.description enriched=description value=system.description name="system.description" toggled=true}}
+    {{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
   </fieldset>
   
   <fieldset>
     <legend>{{localize "CTHULHUETERNAL.Label.notes"}}</legend>
-    {{formInput systemFields.notes enriched=notes value=system.notes name="system.notes" toggled=true}}
+    {{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
   </fieldset>
 </section>
\ No newline at end of file