Fix increase/decrease EW button

This commit is contained in:
Byroks 2024-03-04 10:34:51 +01:00
parent e465bac5ef
commit b83c57b5c8
1 changed files with 4 additions and 14 deletions

View File

@ -195,13 +195,8 @@ export default class M5CharacterSheet extends ActorSheet {
}); });
html.find(".fw-increase").on("click", async (event) => { html.find(".fw-increase").on("click", async (event) => {
let row = event.target.parentElement; let target = event.target.closest("[data-item-id]") as HTMLElement;
let itemId = row.dataset["item"]; let itemId = target ? target.dataset.itemId : null;
while (!itemId) {
row = row.parentElement;
if (!row) return;
itemId = row.dataset["item"];
}
const context = this.actor as any; const context = this.actor as any;
const item = context.items.get(itemId); const item = context.items.get(itemId);
@ -219,13 +214,8 @@ export default class M5CharacterSheet extends ActorSheet {
}); });
html.find(".fw-decrease").on("click", async (event) => { html.find(".fw-decrease").on("click", async (event) => {
let row = event.target.parentElement; let target = event.target.closest("[data-item-id]") as HTMLElement;
let itemId = row.dataset["item"]; let itemId = target ? target.dataset.itemId : null;
while (!itemId) {
row = row.parentElement;
if (!row) return;
itemId = row.dataset["item"];
}
const context = this.actor as any; const context = this.actor as any;
const item = context.items.get(itemId); const item = context.items.get(itemId);