const { HandlebarsApplicationMixin } = foundry.applications.api export default class CelestopolItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) { /** @override */ static DEFAULT_OPTIONS = { classes: ["fvtt-celestopol", "item"], position: { width: 580, height: "auto" }, form: { submitOnChange: true }, window: { resizable: true }, actions: { editImage: CelestopolItemSheet.#onEditImage, }, } /** @override */ async _prepareContext() { return { fields: this.document.schema.fields, systemFields: this.document.system.schema.fields, item: this.document, system: this.document.system, source: this.document.toObject(), isEditable: this.isEditable, } } static async #onEditImage(event, target) { const attr = target.dataset.edit const current = foundry.utils.getProperty(this.document, attr) const fp = new FilePicker({ current, type: "image", callback: (path) => this.document.update({ [attr]: path }), top: this.position.top + 40, left: this.position.left + 10, }) return fp.browse() } }