From 372a2f718c1370ae2b4191fd1a57c008ad342cab Mon Sep 17 00:00:00 2001 From: Alexander Minges Date: Sun, 13 Jul 2025 13:54:57 +0200 Subject: [PATCH] fix: update TextEditor references to use V13+ namespaced API --- src/apps/actor/character-sheet.js | 2 +- src/apps/actor/creature-sheet.js | 2 +- src/apps/item-sheet.js | 15 ++++++++++++--- templates/sheets/item/tabs/description.hbs | 13 ++++++++++++- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/apps/actor/character-sheet.js b/src/apps/actor/character-sheet.js index d8b993a1..0f4b8d61 100644 --- a/src/apps/actor/character-sheet.js +++ b/src/apps/actor/character-sheet.js @@ -19,7 +19,7 @@ export class DS4CharacterActorSheet extends DS4ActorSheet { // Enrich biography HTML content if (context.data.system.profile.biography) { - context.data.system.profile.biography = await TextEditor.enrichHTML( + context.data.system.profile.biography = await foundry.applications.ux.TextEditor.implementation.enrichHTML( context.data.system.profile.biography, { async: true, diff --git a/src/apps/actor/creature-sheet.js b/src/apps/actor/creature-sheet.js index 6849b8e6..43019955 100644 --- a/src/apps/actor/creature-sheet.js +++ b/src/apps/actor/creature-sheet.js @@ -19,7 +19,7 @@ export class DS4CreatureActorSheet extends DS4ActorSheet { // Enrich description HTML content if (context.data.system.baseInfo.description) { - context.data.system.baseInfo.description = await TextEditor.enrichHTML( + context.data.system.baseInfo.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML( context.data.system.baseInfo.description, { async: true, diff --git a/src/apps/item-sheet.js b/src/apps/item-sheet.js index 0cd3bb4a..bbab931d 100644 --- a/src/apps/item-sheet.js +++ b/src/apps/item-sheet.js @@ -97,9 +97,18 @@ export class DS4ItemSheet extends foundry.applications.sheets.ItemSheetV2 { } } - // Provide raw description content to editor (let editor handle enrichment) - // Don't pre-enrich the HTML as it interferes with editor activation - // The editor will handle enrichment internally + // Enrich description content for display + if (this.item.system.description) { + context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( + this.item.system.description, + { + secrets: this.item.isOwner, + relativeTo: this.item + } + ); + } else { + context.enrichedDescription = ""; + } console.log("DS4ItemSheet: _prepareContext completed for item:", this.item.name); return context; diff --git a/templates/sheets/item/tabs/description.hbs b/templates/sheets/item/tabs/description.hbs index 42b4928d..47be58cf 100644 --- a/templates/sheets/item/tabs/description.hbs +++ b/templates/sheets/item/tabs/description.hbs @@ -5,5 +5,16 @@ SPDX-License-Identifier: MIT --}}
- + {{#if editable}} + + {{{enrichedDescription}}} + + {{else}} + {{{enrichedDescription}}} + {{/if}}