Add a context menu to the photo slot (closes #146)

This commit is contained in:
Oliver-Akins 2024-03-30 22:52:45 -06:00
parent e54857023b
commit 3a5a3ecc38
2 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import { GenericContextMenu } from "../../utils/GenericContextMenu.mjs";
import { GenericItemSheet } from "./GenericItemSheet.mjs";
export class UntypedItemSheet extends GenericItemSheet {
@ -22,6 +23,28 @@ export class UntypedItemSheet extends GenericItemSheet {
return opts;
};
activateListeners(html) {
super.activateListeners(html);
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`);
new GenericContextMenu(html, `.photo.panel`, [
{
name: `View Larger`,
callback: (html) => {
console.log(`.dungeon | View Larger`);
},
},
{
name: `Change Photo`,
callback: (html) => {
console.log(`.dungeon | Change Photo`);
},
},
]);
};
async getData() {
const ctx = await super.getData();