Adjust spacing of compendium browser tags

This commit is contained in:
Carlos Fernandez 2026-03-09 18:21:49 -04:00
parent 3b6809064d
commit 3ad79c8d30
6 changed files with 31 additions and 10 deletions

View file

@ -251,8 +251,14 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
/* If any noticeable slowdown occurs, consider replacing with enriching description on clicking to expand descriptions */
for (const item of this.items) {
if (["weapon", "armor"].includes(item.type)) {
item.system.enrichedTags = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/global/partials/item-tags.hbs',
item.system,
);
}
item.system.enrichedDescription =
(await item.system.getEnrichedDescription?.({ inCompendium: true })) ??
(await item.system.getEnrichedDescription?.()) ??
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
}

View file

@ -53,14 +53,14 @@ export default class DHArmor extends AttachableItem {
}
/**@inheritdoc */
async getDescriptionData({ inCompendium }) {
async getDescriptionData() {
const baseDescription = this.description;
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
const prefix = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
{ item: this.parent, inCompendium, features }
{ item: this.parent, features }
);
return { prefix, value: baseDescription, suffix: null };

View file

@ -138,10 +138,10 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
* @returns {string}
*/
async getEnrichedDescription(options = { inCompendium: false }) {
async getEnrichedDescription() {
if (!this.metadata.hasDescription) return '';
const { prefix, value, suffix } = await this.getDescriptionData(options);
const { prefix, value, suffix } = await this.getDescriptionData();
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {

View file

@ -109,7 +109,7 @@ export default class DHWeapon extends AttachableItem {
}
/**@inheritdoc */
async getDescriptionData({ inCompendium }) {
async getDescriptionData() {
const baseDescription = this.description;
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
@ -119,7 +119,6 @@ export default class DHWeapon extends AttachableItem {
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
{
item: this,
inCompendium,
features
}
);

View file

@ -304,7 +304,19 @@
padding: 0 0 0 50px;
display: flex;
flex-direction: column;
gap: 5px;
&:has(.item-tags) {
margin-top: -6px;
}
.item-description-outer-container:has(div, p) {
margin-top: 8px;
}
/* Some items don't include an outer container, so we attempt a catch-all */
> *:last-child {
padding-bottom: 6px;
}
h1 {
font-size: var(--font-size-32);
@ -350,6 +362,7 @@
.filter-content,
.item-desc {
display: grid;
opacity: 0;
grid-template-rows: 0fr;
transition: all 0.3s ease-in-out;
width: 100%;
@ -378,8 +391,8 @@
}
.expanded + .extensible {
opacity: 1;
grid-template-rows: 1fr;
padding-top: 10px;
}
.welcome-message {

View file

@ -10,7 +10,10 @@
</div>
</div>
<div class="item-desc extensible">
<span class="wrapper">{{{system.enrichedDescription}}}</span>
<span class="wrapper">
{{{system.enrichedTags}}}
{{{system.enrichedDescription}}}
</span>
</div>
</div>
{{/each}}