diff --git a/module/apps/GenericItemSheet.mjs b/module/apps/GenericItemSheet.mjs index a5f9ac8..5b37eac 100644 --- a/module/apps/GenericItemSheet.mjs +++ b/module/apps/GenericItemSheet.mjs @@ -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 diff --git a/styles/Apps/GenericItemSheet.css b/styles/Apps/GenericItemSheet.css index 4d11f47..b03cb30 100644 --- a/styles/Apps/GenericItemSheet.css +++ b/styles/Apps/GenericItemSheet.css @@ -15,4 +15,38 @@ border-radius: 4px; } } + + .content { + display: contents; + } + + .property { + display: grid; + grid-template-columns: 1fr 100px; + align-items: center; + gap: 8px; + + input[type="checkbox"] { + justify-self: end; + } + } + + .description { + flex-grow: 1; + overflow: hidden; + --table-row-color-odd: var(--table-header-bg-color); + + &:not(:has(> prose-mirror)) { + padding: 0.5rem; + } + } + + prose-mirror { + height: 100%; + + menu { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + } } diff --git a/templates/GenericItemSheet/content.hbs b/templates/GenericItemSheet/content.hbs index 0018b47..818c483 100644 --- a/templates/GenericItemSheet/content.hbs +++ b/templates/GenericItemSheet/content.hbs @@ -1,13 +1,38 @@ -