Add the context menu for items in the player sheet
This commit is contained in:
parent
441930a5e5
commit
4c05171e04
3 changed files with 59 additions and 1 deletions
|
|
@ -3,6 +3,32 @@ This file contains utility methods used by Applications in order to be
|
|||
DRYer
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Event} _event The click event
|
||||
* @param {HTMLElement} target The element to operate on
|
||||
*/
|
||||
export async function editItemFromElement(_event, target) {
|
||||
const itemEl = target.closest(`[data-item-uuid]`);
|
||||
if (!itemEl) { return };
|
||||
const uuid = itemEl.dataset.itemUuid;
|
||||
if (!uuid) { return };
|
||||
const item = await fromUuid(uuid);
|
||||
item.sheet.render({ force: true, orBringToFront: true });
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Event} _event The click event
|
||||
* @param {HTMLElement} target The element to operate on
|
||||
*/
|
||||
export async function deleteItemFromElement(_event, target) {
|
||||
const itemEl = target.closest(`[data-item-uuid]`);
|
||||
if (!itemEl) { return };
|
||||
const uuid = itemEl.dataset.itemUuid;
|
||||
if (!uuid) { return };
|
||||
const item = await fromUuid(uuid);
|
||||
item.deleteDialog();
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates a document using the UUID, this is most useful for editing
|
||||
* documents from a sheet of another document (e.g. an Item embedded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue