Added confirm dialogs to delete

This commit is contained in:
WBHarry 2025-07-08 17:00:49 +02:00
parent 5aa9ba661a
commit b3c9ee87b0
7 changed files with 100 additions and 9 deletions

View file

@ -249,7 +249,23 @@ export default class CharacterSheet extends DHBaseActorSheet {
{
name: 'DAGGERHEART.Sheets.PC.ContextMenu.Delete',
icon: '<i class="fa-solid fa-trash"></i>',
callback: el => getItem(el).delete()
callback: async el => {
const item = getItem(el);
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
type: game.i18n.localize(`TYPES.${item.documentName}.${item.type}`),
name: item.name
})
},
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', {
name: item.name
})
});
if (!confirmed) return;
item.delete();
}
}
];
}
@ -372,7 +388,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
li.hidden = !(menu.has(item.id) && matchesSearch);
}
}
/* -------------------------------------------- */
/* Filter Menus */
/* -------------------------------------------- */