[Fix] 1671 - Compendium Context Menues (#1677)

* Fixed

* .
This commit is contained in:
WBHarry 2026-02-26 11:42:42 +01:00 committed by GitHub
parent 4324c3abf2
commit e79ccd34e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 23 deletions

View file

@ -431,18 +431,18 @@ export default function DHApplicationMixin(Base) {
{
name: 'disableEffect',
icon: 'fa-solid fa-lightbulb',
condition: target => {
const doc = getDocFromElementSync(target);
return doc && !doc.disabled && doc.type !== 'beastform';
condition: element => {
const target = element.closest('[data-item-uuid]');
return !target.dataset.disabled && target.dataset.itemType !== 'beastform';
},
callback: async target => (await getDocFromElement(target)).update({ disabled: true })
},
{
name: 'enableEffect',
icon: 'fa-regular fa-lightbulb',
condition: target => {
const doc = getDocFromElementSync(target);
return doc && doc.disabled && doc.type !== 'beastform';
condition: element => {
const target = element.closest('[data-item-uuid]');
return target.dataset.disabled && target.dataset.itemType !== 'beastform';
},
callback: async target => (await getDocFromElement(target)).update({ disabled: false })
}
@ -536,9 +536,9 @@ export default function DHApplicationMixin(Base) {
options.push({
name: 'CONTROLS.CommonDelete',
icon: 'fa-solid fa-trash',
condition: target => {
const doc = getDocFromElementSync(target);
return doc && doc.type !== 'beastform';
condition: element => {
const target = element.closest('[data-item-uuid]');
return target.dataset.itemType !== 'beastform';
},
callback: async (target, event) => {
const doc = await getDocFromElement(target);

View file

@ -56,6 +56,7 @@ Parameters:
{{> 'daggerheart.inventory-item'
item=item
type=../type
disabledEffect=../disabledEffect
actorType=../actorType
hideControls=../hideControls
hideContextMenu=../hideContextMenu

View file

@ -17,8 +17,12 @@ Parameters:
- showActions {boolean} : If true show feature's actions.
--}}
<li class="inventory-item" data-item-id="{{item.id}}" {{#if (or (eq type 'action' ) (eq type 'attack' ))}}
data-action-id="{{item.id}}" {{/if}} data-item-uuid="{{item.uuid}}" data-type="{{type}}" data-no-compendium-edit="{{noCompendiumEdit}}">
<li class="inventory-item" data-item-id="{{item.id}}"
{{#if (or (eq type 'action' ) (eq type 'attack' ))}}data-action-id="{{item.id}}" {{/if}}
{{#if disabledEffect}}data-disabled="true"{{/if}}
data-type="{{type}}" data-item-type="{{item.type}}"
data-item-uuid="{{item.uuid}}" data-no-compendium-edit="{{noCompendiumEdit}}"
>
<div class="inventory-item-header {{#if hideContextMenu}}padded{{/if}}" {{#unless noExtensible}}data-action="toggleExtended" {{/unless}}>
{{!-- Image --}}
<div class="img-portait" data-action='{{ifThen (or (hasProperty item "use") (eq type "attack")) "useItem" (ifThen

View file

@ -13,6 +13,7 @@
{{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect'
disabledEffect=true
isGlassy=true
collection=effects.inactives
canCreate=true