diff --git a/src/apps/actor/base-sheet.js b/src/apps/actor/base-sheet.js index b24e4f53..20d39719 100644 --- a/src/apps/actor/base-sheet.js +++ b/src/apps/actor/base-sheet.js @@ -43,7 +43,7 @@ export class DS4ActorSheet extends foundry.applications.api.HandlebarsApplicatio editeffect: DS4ActorSheet.prototype._onEditEffect, deleteeffect: DS4ActorSheet.prototype._onDeleteEffect, createeffect: DS4ActorSheet.prototype._onCreateEffect, - editImage: DS4ActorSheet.prototype._onEditImage, + editImage: DS4ActorSheet._onEditImage, }, }; @@ -615,17 +615,14 @@ export class DS4ActorSheet extends foundry.applications.api.HandlebarsApplicatio * @param {Event} event - The triggering event * @param {HTMLElement} target - The target element */ - - async _onEditImage(_event, _target) { - const attr = "img"; - const current = this.document.img; + static async _onEditImage(event, target) { + const field = target.dataset.field || "img"; + const current = foundry.utils.getProperty(this.document, field); const fp = new foundry.applications.apps.FilePicker({ type: "image", current: current, - callback: (path) => { - this.document.update({ [attr]: path }); - } + callback: (path) => this.document.update({ [field]: path }) }); return fp.browse();