Add an item sheet for editing Traits
This commit is contained in:
parent
4d0f29d7f0
commit
7de3f1ca87
6 changed files with 119 additions and 2 deletions
53
module/Apps/ItemSheets/TraitSheet.mjs
Normal file
53
module/Apps/ItemSheets/TraitSheet.mjs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import { filePath } from "../../consts.mjs";
|
||||
import { GenericAppMixin } from "../GenericApp.mjs";
|
||||
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
|
||||
export class TraitSheet extends GenericAppMixin(HandlebarsApplicationMixin(ItemSheetV2)) {
|
||||
// #region Options
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: [
|
||||
`ripcrypt--item`,
|
||||
`TraitSheet`,
|
||||
],
|
||||
position: {
|
||||
width: `auto`,
|
||||
height: `auto`,
|
||||
},
|
||||
window: {
|
||||
resizable: true,
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false,
|
||||
},
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
content: {
|
||||
template: filePath(`templates/Apps/TraitSheet/content.hbs`),
|
||||
root: true,
|
||||
},
|
||||
};
|
||||
// #endregion Options
|
||||
|
||||
// #region Data Prep
|
||||
async _prepareContext() {
|
||||
const TextEditor = foundry.applications.ux.TextEditor.implementation;
|
||||
const ctx = {
|
||||
meta: {
|
||||
idp: this.id,
|
||||
},
|
||||
item: this.document,
|
||||
enriched: {
|
||||
system: {
|
||||
description: await TextEditor.enrichHTML(this.document.system.description),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return ctx;
|
||||
};
|
||||
// #endregion Data Prep
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue