Finish getting the main item sheet completed and fully functional

This commit is contained in:
Oliver 2026-03-13 21:31:03 -06:00
parent 2518c7cf05
commit 94b3ec923b
4 changed files with 103 additions and 14 deletions

View file

@ -2,6 +2,7 @@ import { __ID__, filePath } from "../consts.mjs";
const { HandlebarsApplicationMixin } = foundry.applications.api;
const { ItemSheetV2 } = foundry.applications.sheets;
const { setProperty } = foundry.utils;
export class GenericItemSheet extends HandlebarsApplicationMixin(ItemSheetV2) {
// #region Options
@ -34,12 +35,38 @@ export class GenericItemSheet extends HandlebarsApplicationMixin(ItemSheetV2) {
// #endregion Instance Data
// #region Lifecycle
async _prepareContext(partID) {
async _prepareContext() {
return {
meta: {
idp: this.id,
editable: this.isEditable,
limited: this.isLimited
},
item: this.item,
system: this.item.system,
};
};
async _preparePartContext(partID, ctx) {
switch (partID) {
case `content`: {
await this._prepareContentContext(ctx);
break;
};
};
return ctx;
};
async _prepareContentContext(ctx) {
const TextEditor = foundry.applications.ux.TextEditor.implementation;
setProperty(
ctx,
`enriched.system.description`,
await TextEditor.enrichHTML(this.item.system.description),
);
};
// #endregion Lifecycle
// #region Actions