Nouvelles corrections sur la fiche

This commit is contained in:
2026-03-06 13:34:18 +01:00
parent b9db8eb2fc
commit 4f15f0cc4c
15 changed files with 204 additions and 55 deletions
+1 -30
View File
@@ -5,11 +5,7 @@ export default class AwEFieldSheet extends AwEItemSheet {
static DEFAULT_OPTIONS = {
classes: ["field"],
position: { width: 620 },
window: { contentClasses: ["field-content"] },
actions: {
addSpecialization: AwEFieldSheet.#onAddSpecialization,
removeSpecialization: AwEFieldSheet.#onRemoveSpecialization
}
window: { contentClasses: ["field-content"] }
}
/** @override */
@@ -18,29 +14,4 @@ export default class AwEFieldSheet extends AwEItemSheet {
template: "systems/fvtt-adventures-with-emmy/templates/field.hbs"
}
}
/**
* Handle adding a specialization.
* @param {PointerEvent} event - The initiating event.
* @param {HTMLElement} target - The input element.
*/
static async #onAddSpecialization(event, target) {
const value = target.value.trim()
if (!value) return
const current = this.document.system.specializations ?? []
await this.document.update({ "system.specializations": [...current, value] })
target.value = ""
}
/**
* Handle removing a specialization.
* @param {PointerEvent} event - The initiating click event.
* @param {HTMLElement} target - The remove button.
*/
static async #onRemoveSpecialization(event, target) {
const index = Number(target.dataset.index)
const current = [...(this.document.system.specializations ?? [])]
current.splice(index, 1)
await this.document.update({ "system.specializations": current })
}
}