Appv2 + DataModel migration completed
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||
|
||||
export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||
/**
|
||||
* Different sheet modes.
|
||||
* @enum {number}
|
||||
*/
|
||||
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
this.#dragDrop = this.#createDragDropHandlers()
|
||||
@@ -19,7 +13,7 @@ export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
classes: ["fvtt-hawkmoon-cyd", "item"],
|
||||
position: {
|
||||
width: 620,
|
||||
height: "auto",
|
||||
height: 600,
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
@@ -36,7 +30,6 @@ export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
],
|
||||
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||
actions: {
|
||||
toggleSheet: HawkmoonItemSheet.#onToggleSheet,
|
||||
editImage: HawkmoonItemSheet.#onEditImage,
|
||||
postItem: HawkmoonItemSheet.#onPostItem,
|
||||
addPredilection: HawkmoonItemSheet.#onAddPredilection,
|
||||
@@ -46,12 +39,6 @@ export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* The current sheet mode.
|
||||
* @type {number}
|
||||
*/
|
||||
_sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||
|
||||
/**
|
||||
* Tab groups state
|
||||
* @type {object}
|
||||
@@ -62,18 +49,6 @@ export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
* Is the sheet currently in 'Play' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isPlayMode() {
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Edit' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isEditMode() {
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = {
|
||||
@@ -83,8 +58,7 @@ export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
system: this.document.system,
|
||||
source: this.document.toObject(),
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description, { async: true }),
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isEditMode: true,
|
||||
isEditable: this.isEditable,
|
||||
isGM: game.user.isGM,
|
||||
config: CONFIG.HAWKMOON,
|
||||
@@ -198,17 +172,6 @@ export default class HawkmoonItemSheet extends HandlebarsApplicationMixin(foundr
|
||||
// #endregion
|
||||
|
||||
// #region Action Handlers
|
||||
/**
|
||||
* Toggle between Edit and Play mode
|
||||
* @param {Event} event The triggering event
|
||||
* @param {HTMLElement} target The target element
|
||||
* @private
|
||||
*/
|
||||
static #onToggleSheet(event, target) {
|
||||
this._sheetMode = this.isEditMode ? this.constructor.SHEET_MODES.PLAY : this.constructor.SHEET_MODES.EDIT
|
||||
this.render()
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the item image
|
||||
* @param {Event} event The triggering event
|
||||
|
||||
Reference in New Issue
Block a user