Fix auto expand regression and detection for active effects and actions

This commit is contained in:
Carlos Fernandez 2026-06-23 21:42:52 -04:00
parent 1430deae7c
commit 8abc94a7da
6 changed files with 24 additions and 14 deletions

View file

@ -603,7 +603,7 @@ export default function DHApplicationMixin(Base) {
const doc = await fromUuid(itemUuid); const doc = await fromUuid(itemUuid);
//get inventory-item description element //get inventory-item description element
const descriptionElement = el.querySelector('.invetory-description'); const descriptionElement = el.querySelector('.inventory-description');
if (!doc || !descriptionElement) continue; if (!doc || !descriptionElement) continue;
// localize the description (idk if it's still necessary) // localize the description (idk if it's still necessary)

View file

@ -54,6 +54,10 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
return {}; return {};
} }
get hasDescription() {
return Boolean(this.description);
}
/** /**
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property. * Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
* *

View file

@ -65,6 +65,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
); );
} }
get hasDescription() {
return Boolean(this.description);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Event Handlers */ /* Event Handlers */
/* -------------------------------------------- */ /* -------------------------------------------- */

View file

@ -89,6 +89,10 @@ export default class DHItem extends foundry.documents.Item {
return !pack?.locked && this.isOwner && isValidType && hasActions; return !pack?.locked && this.isOwner && isValidType && hasActions;
} }
get hasDescription() {
return Boolean(this.system.description);
}
/** @inheritdoc */ /** @inheritdoc */
static async createDialog(data = {}, createOptions = {}, options = {}) { static async createDialog(data = {}, createOptions = {}, options = {}) {
const { folders, types, template, context = {}, ...dialogOptions } = options; const { folders, types, template, context = {}, ...dialogOptions } = options;

View file

@ -54,10 +54,8 @@
margin-left: 10px; margin-left: 10px;
display: inline-block; display: inline-block;
} }
&:has(.inventory-item-content.extensible) { .item-main {
.item-main { background: light-dark(@dark-blue-40, @golden-40);
background: light-dark(@dark-blue-40, @golden-40);
}
} }
&:has(.inventory-item-content.extended) { &:has(.inventory-item-content.extended) {
.inventory-item-header .item-label .item-name .expanded-icon { .inventory-item-header .item-label .item-name .expanded-icon {
@ -163,7 +161,7 @@
grid-template-rows: 1fr; grid-template-rows: 1fr;
padding-top: 4px; padding-top: 4px;
} }
.invetory-description { .inventory-description {
overflow: hidden; overflow: hidden;
h1 { h1 {

View file

@ -26,7 +26,7 @@ Parameters:
data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}" data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}"
> >
<div class="item-main"> <div class="item-main">
<div class="inventory-item-header{{#if hideContextMenu}} padded{{/if}}" {{#unless (or noExtensible (not item.system.description))}}data-action="toggleExtended" {{/unless}}> <div class="inventory-item-header{{#if hideContextMenu}} padded{{/if}}" {{#unless (or noExtensible (not item.hasDescription))}}data-action="toggleExtended" {{/unless}}>
{{!-- Image --}} {{!-- Image --}}
<div class="img-portait" draggable="true" <div class="img-portait" draggable="true"
{{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}} {{#unless (eq showActions false)}}data-action='{{ifThen item.usable "useItem" (ifThen (hasProperty item "toChat" ) "toChat" "editDoc" ) }}'{{/unless}}
@ -44,7 +44,7 @@ Parameters:
{{!-- Name & Tags --}} {{!-- Name & Tags --}}
<div class="item-label" draggable="true"> <div class="item-label" draggable="true">
{{!-- Item Name --}} {{!-- Item Name --}}
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span> <span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.hasDescription))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
{{!-- Tags Start --}} {{!-- Tags Start --}}
{{#if (not hideTags)}} {{#if (not hideTags)}}
@ -130,12 +130,12 @@ Parameters:
</div> </div>
{{/unless}} {{/unless}}
</div> </div>
<div class="inventory-item-content{{#unless noExtensible}} extensible{{/unless}}"> {{#unless hideDescription}}
{{!-- Description --}} <div class="inventory-item-content{{#unless (or noExtensible (not item.hasDescription))}} extensible{{/unless}}">
{{#unless hideDescription}} {{!-- Description --}}
<div class="invetory-description"></div> <div class="inventory-description"></div>
{{/unless}} </div>
</div> {{/unless}}
</div> </div>
{{!-- Dice Resource --}} {{!-- Dice Resource --}}
{{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}} {{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}}