From bb7f4c42adc9a265dd9f5b3bd2fa00b5336ce364 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 3 Dec 2022 01:21:30 +0100 Subject: [PATCH] =?UTF-8?q?Feuilles=20Ingr=C3=A9dient&Herbe=20extends=20Rd?= =?UTF-8?q?DItemSheet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pour bénéficier de certains comportements (description...) --- module/item-herbe-sheet.js | 20 +++++++++++--------- module/item-ingredient-sheet.js | 6 ++++-- module/item-sheet.js | 5 ++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/module/item-herbe-sheet.js b/module/item-herbe-sheet.js index 2ba7d546..616025a9 100644 --- a/module/item-herbe-sheet.js +++ b/module/item-herbe-sheet.js @@ -1,10 +1,11 @@ import { SYSTEM_RDD } from "./constants.js"; -import { EnvironmentSheetHelper as EnvironmentItemSheet } from "./environnement.js"; +import { EnvironmentSheetHelper } from "./environnement.js"; +import { RdDItemSheet } from "./item-sheet.js"; import { Misc } from "./misc.js"; const ITEM_TYPE = 'herbe'; -export class RdDHerbeItemSheet extends ItemSheet { +export class RdDHerbeItemSheet extends RdDItemSheet { static register() { Items.registerSheet(SYSTEM_RDD, RdDHerbeItemSheet, { @@ -15,31 +16,32 @@ export class RdDHerbeItemSheet extends ItemSheet { } static get defaultOptions() { - return EnvironmentItemSheet.defaultOptions(super.defaultOptions, ITEM_TYPE); + return EnvironmentSheetHelper.defaultOptions(super.defaultOptions, ITEM_TYPE); } _getHeaderButtons() { - return EnvironmentItemSheet.getHeaderButtons(this, super._getHeaderButtons()); + return EnvironmentSheetHelper.getHeaderButtons(this, super._getHeaderButtons()); } setPosition(options = {}) { - return EnvironmentItemSheet.setPosition(this, super.setPosition(options)); + return EnvironmentSheetHelper.setPosition(this, super.setPosition(options)); } async getData() { - return await EnvironmentItemSheet.getData(this); + const formData = await super.getData(); + return await EnvironmentSheetHelper.getData(this, formData); } activateListeners(html) { super.activateListeners(html); - EnvironmentItemSheet.activateListeners(this, html); + EnvironmentSheetHelper.activateListeners(this, html); } get template() { - return EnvironmentItemSheet.template(this.item.type); + return EnvironmentSheetHelper.template(this.item.type); } get title() { - return EnvironmentItemSheet.title(this.item); + return EnvironmentSheetHelper.title(this.item); } } diff --git a/module/item-ingredient-sheet.js b/module/item-ingredient-sheet.js index b5b0d322..6f5cd5f6 100644 --- a/module/item-ingredient-sheet.js +++ b/module/item-ingredient-sheet.js @@ -1,9 +1,10 @@ import { SYSTEM_RDD } from "./constants.js"; import { EnvironmentSheetHelper } from "./environnement.js"; +import { RdDItemSheet } from "./item-sheet.js"; import { Misc } from "./misc.js"; const ITEM_TYPE = 'ingredient'; -export class RdDIngredientItemSheet extends ItemSheet { +export class RdDIngredientItemSheet extends RdDItemSheet { static register() { Items.registerSheet(SYSTEM_RDD, RdDIngredientItemSheet, { @@ -26,7 +27,8 @@ export class RdDIngredientItemSheet extends ItemSheet { } async getData() { - return await EnvironmentSheetHelper.getData(this); + const formData = await super.getData(); + return await EnvironmentSheetHelper.getData(this, formData); } activateListeners(html) { diff --git a/module/item-sheet.js b/module/item-sheet.js index da1d316d..3ce65a19 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -73,9 +73,8 @@ export class RdDItemSheet extends ItemSheet { editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", isSoins: false, - description: await TextEditor.enrichHTML(this.object.system.description, {async: true}), - descriptionmj: await TextEditor.enrichHTML(this.object.system.descriptionmj, {async: true}) - + description: await TextEditor.enrichHTML(this.item.system.description, {async: true}), + descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, {async: true}) } if (this.actor) { formData.isOwned = true;