From 220e9743aa7df799e5d41a410ec4b3867adb3a8b Mon Sep 17 00:00:00 2001 From: "Wendel Henrique (SouOWendel)" Date: Thu, 21 Nov 2024 18:47:33 -0300 Subject: [PATCH] feat(item sheet): enrichment of item descriptions this is useful for catch roll data and general references of documents in item description --- module/sheets/item-sheet.mjs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module/sheets/item-sheet.mjs b/module/sheets/item-sheet.mjs index 68aa18f..7dd0b82 100644 --- a/module/sheets/item-sheet.mjs +++ b/module/sheets/item-sheet.mjs @@ -51,7 +51,6 @@ export class OrdemItemSheet extends ItemSheet { rollData: this.item.getRollData(), flags: itemData.flags, effects: prepareActiveEffectCategories(this.item.effects), - // Armament's Dropdowns optionWeaponType: CONFIG.op.dropdownWeaponType, optionWeaponSubType: CONFIG.op.dropdownWeaponSubType, @@ -68,19 +67,26 @@ export class OrdemItemSheet extends ItemSheet { optionResistance: CONFIG.op.dropdownResistance, optionSkillResis: CONFIG.op.dropdownSkillResis, optionElement: CONFIG.op.dropdownElement, - // Attack and Damage Dropdown attributes: CONFIG.op.attributes, attackSkills: CONFIG.op.attackSkills, - // Ritual's Dropdowns optionExecution: CONFIG.op.dropdownExecution, - // Item's Radiobox categories: CONFIG.op.categories, degree: CONFIG.op.ritualDegree, }); + const enrichmentOptions = { + secrets: this.item.isOwner, + relativeTo: this.item, + rollData: context.rollData + }; + + context.enriched = { + description: await TextEditor.enrichHTML(context.system.description ?? '', enrichmentOptions) + }; + // https://foundryvtt.com/api/classes/foundry.abstract.Document.html#updateDocuments // https://foundryvtt.com/api/classes/foundry.abstract.Document.html#deleteDocuments