Files
DeltaGreen/module/item/item-sheet.js
T

57 lines
1.5 KiB
JavaScript

/**
* Extend the basic ItemSheet with some very simple modifications
* @extends {ItemSheet}
*/
export class DeltaGreenItemSheet extends ItemSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["deltagreen", "sheet", "item"],
width: 520,
height: 600,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "attributes" }]
});
}
/** @override */
get template() {
const path = "systems/deltagreen/templates/item";
// unique item sheet by type, like `weapon-sheet.html`.
return `${path}/item-${this.item.type}-sheet.html`;
}
/* -------------------------------------------- */
/** @override */
async getData() {
const data = super.getData();
data.enrichedDescription = await TextEditor.enrichHTML(this.object.system.description, {async: true});
return data;
}
/* -------------------------------------------- */
/** @override */
setPosition(options = {}) {
const position = super.setPosition(options);
const sheetBody = this.element.find(".sheet-body");
const bodyHeight = position.height - 192;
sheetBody.css("height", bodyHeight);
return position;
}
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
// Roll handlers, click handlers, etc. would go here.
}
}