From ebf98a6ae59c9e217843261826c34ee78d2ef1fc Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Sun, 23 Nov 2025 15:12:25 +0100 Subject: [PATCH] Added a confirmation window when deleting a feature (#1324) --- module/applications/sheets/api/base-item.mjs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index e46522c0..42ed9426 100644 --- a/module/applications/sheets/api/base-item.mjs +++ b/module/applications/sheets/api/base-item.mjs @@ -199,18 +199,32 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { static async #deleteFeature(_, element) { const target = element.closest('[data-item-uuid]'); const feature = await getDocFromElement(target); + if (!feature) { await this.document.update({ 'system.features': this.document.system.features .filter(x => x.item) .map(x => ({ ...x, item: x.item.uuid })) }); - } else + } else { + const confirmed = await foundry.applications.api.DialogV2.confirm({ + window: { + title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', { + type: game.i18n.localize('TYPES.Item.feature'), + name: feature.name + }) + }, + content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: feature.name }) + }); + + if (!confirmed) return; + await this.document.update({ 'system.features': this.document.system.features .filter(x => target.dataset.type !== x.type || x.item.uuid !== feature.uuid) .map(x => ({ ...x, item: x.item.uuid })) }); + } } /**