mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
Improved description enrichment to not bloat it outside of the CompendiumBrowser
This commit is contained in:
parent
83c3da0130
commit
e1fef44d21
7 changed files with 46 additions and 41 deletions
|
|
@ -252,7 +252,7 @@ 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) {
|
||||
item.system.enrichedDescription =
|
||||
(await item.system.getEnrichedDescription?.()) ??
|
||||
(await item.system.getEnrichedDescription?.({ inCompendiumBrowser: true })) ??
|
||||
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,14 +53,14 @@ export default class DHArmor extends AttachableItem {
|
|||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
async getDescriptionData({ inCompendiumBrowser }) {
|
||||
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, features }
|
||||
{ item: this.parent, features, inCompendiumBrowser }
|
||||
);
|
||||
|
||||
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' }
|
||||
* @returns {string}
|
||||
*/
|
||||
async getEnrichedDescription() {
|
||||
async getEnrichedDescription(options = { inCompendiumBrowser: false }) {
|
||||
if (!this.metadata.hasDescription) return '';
|
||||
|
||||
const { prefix, value, suffix } = await this.getDescriptionData();
|
||||
const { prefix, value, suffix } = await this.getDescriptionData(options);
|
||||
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
|
||||
|
||||
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ export default class DHWeapon extends AttachableItem {
|
|||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async getDescriptionData() {
|
||||
async getDescriptionData({ inCompendiumBrowser }) {
|
||||
const baseDescription = this.description;
|
||||
|
||||
const tier = game.i18n.localize(`DAGGERHEART.GENERAL.Tiers.${this.tier}`);
|
||||
|
|
@ -129,7 +129,8 @@ export default class DHWeapon extends AttachableItem {
|
|||
trait,
|
||||
range,
|
||||
damage,
|
||||
burden
|
||||
burden,
|
||||
inCompendiumBrowser
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "daggerheart",
|
||||
"title": "Daggerheart",
|
||||
"description": "An unofficial implementation of the Daggerheart system",
|
||||
"version": "1.7.3",
|
||||
"version": "1.8.0",
|
||||
"compatibility": {
|
||||
"minimum": "13.346",
|
||||
"verified": "13.351",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<div class="item-description-outer-container">
|
||||
{{#if inCompendiumBrowser}}
|
||||
<div class="two-columns">
|
||||
<div class="item-description-container">
|
||||
<h4>{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}</h4>
|
||||
|
|
@ -10,6 +11,7 @@
|
|||
<span>{{item.system.baseScore}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if features.length}}
|
||||
<div class="item-description-container">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<div class="item-description-outer-container">
|
||||
{{#if inCompendiumBrowser}}
|
||||
<div class="three-columns">
|
||||
<div class="item-description-container">
|
||||
<h4>{{localize "DAGGERHEART.GENERAL.Tiers.singular"}}</h4>
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
<span>{{burden}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if features.length}}
|
||||
<div class="item-description-container">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue