mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
FEAT: add description enrichement for items sheet
This commit is contained in:
parent
f63e94b4cc
commit
c879dbd1d2
3 changed files with 29 additions and 5 deletions
|
|
@ -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 */
|
/* Application Clicks Actions */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -46,9 +70,9 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
*/
|
*/
|
||||||
static async selectActionType() {
|
static async selectActionType() {
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(
|
const content = await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/views/actionType.hbs',
|
'systems/daggerheart/templates/views/actionType.hbs',
|
||||||
{ types: SYSTEM.ACTIONS.actionTypes }
|
{ types: SYSTEM.ACTIONS.actionTypes }
|
||||||
),
|
),
|
||||||
title = 'Select Action Type', //useless var
|
title = 'Select Action Type', //useless var
|
||||||
type = 'form',
|
type = 'form',
|
||||||
data = {}; //useless var
|
data = {}; //useless var
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async _preparePartContext(partId, context) {
|
async _preparePartContext(partId, context) {
|
||||||
super._preparePartContext(partId, context);
|
await super._preparePartContext(partId, context);
|
||||||
|
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
case 'settings':
|
case 'settings':
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
>
|
>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{localize "DAGGERHEART.Sheets.Feature.Description"}}</legend>
|
<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>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue