Feuilles Ingrédient&Herbe extends RdDItemSheet

Pour bénéficier de certains comportements (description...)
This commit is contained in:
Vincent Vandemeulebrouck 2022-12-03 01:21:30 +01:00
parent ac15a022df
commit bb7f4c42ad
3 changed files with 17 additions and 14 deletions

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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;