FEAT: add description enrichement for items sheet

This commit is contained in:
Joaquin Pereyra 2025-06-25 18:47:10 -03:00
parent f63e94b4cc
commit c879dbd1d2
3 changed files with 29 additions and 5 deletions

View file

@ -35,6 +35,30 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
}
};
/* -------------------------------------------- */
/* Prepare Context */
/* -------------------------------------------- */
/**@inheritdoc */
async _preparePartContext(partId, context) {
await super._preparePartContext(partId, context);
const { TextEditor } = foundry.applications.ux;
switch (partId) {
case 'description':
const value = foundry.utils.getProperty(this.document, "system.description") ?? "";
context.enrichedDescription = await TextEditor.enrichHTML(value, {
relativeTo: this.item,
rollData: this.item.getRollData(),
secrets: this.item.isOwner
})
break;
}
return context;
}
/* -------------------------------------------- */
/* Application Clicks Actions */
/* -------------------------------------------- */
@ -46,9 +70,9 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
*/
static async selectActionType() {
const content = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/views/actionType.hbs',
{ types: SYSTEM.ACTIONS.actionTypes }
),
'systems/daggerheart/templates/views/actionType.hbs',
{ types: SYSTEM.ACTIONS.actionTypes }
),
title = 'Select Action Type', //useless var
type = 'form',
data = {}; //useless var

View file

@ -31,7 +31,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
/**@inheritdoc */
async _preparePartContext(partId, context) {
super._preparePartContext(partId, context);
await super._preparePartContext(partId, context);
switch (partId) {
case 'settings':

View file

@ -5,6 +5,6 @@
>
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Feature.Description"}}</legend>
{{formInput systemFields.description value=source.system.description enriched=source.system.description localize=true toggled=true}}
{{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}}
</fieldset>
</section>