mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Adjust spacing of compendium browser tags (#1720)
This commit is contained in:
parent
3b6809064d
commit
26ac2c5380
6 changed files with 27 additions and 10 deletions
|
|
@ -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 */
|
/* If any noticeable slowdown occurs, consider replacing with enriching description on clicking to expand descriptions */
|
||||||
for (const item of this.items) {
|
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 =
|
item.system.enrichedDescription =
|
||||||
(await item.system.getEnrichedDescription?.({ inCompendium: true })) ??
|
(await item.system.getEnrichedDescription?.()) ??
|
||||||
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
|
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,14 +53,14 @@ export default class DHArmor extends AttachableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData({ inCompendium }) {
|
async getDescriptionData() {
|
||||||
const baseDescription = this.description;
|
const baseDescription = this.description;
|
||||||
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
||||||
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
|
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
|
||||||
|
|
||||||
const prefix = await foundry.applications.handlebars.renderTemplate(
|
const prefix = await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
||||||
{ item: this.parent, inCompendium, features }
|
{ item: this.parent, features }
|
||||||
);
|
);
|
||||||
|
|
||||||
return { prefix, value: baseDescription, suffix: null };
|
return { prefix, value: baseDescription, suffix: null };
|
||||||
|
|
|
||||||
|
|
@ -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' }
|
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
async getEnrichedDescription(options = { inCompendium: false }) {
|
async getEnrichedDescription() {
|
||||||
if (!this.metadata.hasDescription) return '';
|
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');
|
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
|
||||||
|
|
||||||
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {
|
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export default class DHWeapon extends AttachableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData({ inCompendium }) {
|
async getDescriptionData() {
|
||||||
const baseDescription = this.description;
|
const baseDescription = this.description;
|
||||||
|
|
||||||
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
||||||
|
|
@ -119,7 +119,6 @@ export default class DHWeapon extends AttachableItem {
|
||||||
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
||||||
{
|
{
|
||||||
item: this,
|
item: this,
|
||||||
inCompendium,
|
|
||||||
features
|
features
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,15 @@
|
||||||
padding: 0 0 0 50px;
|
padding: 0 0 0 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 5px;
|
|
||||||
|
.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 {
|
h1 {
|
||||||
font-size: var(--font-size-32);
|
font-size: var(--font-size-32);
|
||||||
|
|
@ -350,6 +358,7 @@
|
||||||
.filter-content,
|
.filter-content,
|
||||||
.item-desc {
|
.item-desc {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
opacity: 0;
|
||||||
grid-template-rows: 0fr;
|
grid-template-rows: 0fr;
|
||||||
transition: all 0.3s ease-in-out;
|
transition: all 0.3s ease-in-out;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -378,8 +387,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.expanded + .extensible {
|
.expanded + .extensible {
|
||||||
|
opacity: 1;
|
||||||
grid-template-rows: 1fr;
|
grid-template-rows: 1fr;
|
||||||
padding-top: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-message {
|
.welcome-message {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-desc extensible">
|
<div class="item-desc extensible">
|
||||||
<span class="wrapper">{{{system.enrichedDescription}}}</span>
|
<span class="wrapper">
|
||||||
|
{{{system.enrichedTags}}}
|
||||||
|
{{{system.enrichedDescription}}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue