Various fixes/update based on first tests feedback
This commit is contained in:
@@ -4,7 +4,7 @@ export default class AwEAbilitySheet extends AwEItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["ability"],
|
||||
position: { width: 620 },
|
||||
position: { width: 620, height: 560 },
|
||||
window: { contentClasses: ["ability-content"] }
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class AwEItemSheet extends HandlebarsApplicationMixin(foundry.app
|
||||
classes: ["awemmy", "item"],
|
||||
position: {
|
||||
width: 600,
|
||||
height: "auto"
|
||||
height: 480
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true
|
||||
@@ -91,6 +91,22 @@ export default class AwEItemSheet extends HandlebarsApplicationMixin(foundry.app
|
||||
const handler = this.options.actions?.[actionName]
|
||||
if (handler) handler.call(this, event, input)
|
||||
})
|
||||
// Auto-split comma-separated values on paste
|
||||
input.addEventListener("paste", async event => {
|
||||
const pasted = (event.clipboardData ?? window.clipboardData).getData("text")
|
||||
const parts = pasted.split(",").map(s => s.trim().toLowerCase()).filter(Boolean)
|
||||
if (parts.length < 2) return // single value: let default paste handle it
|
||||
event.preventDefault()
|
||||
const fieldName = input.dataset.field ?? "system.traits"
|
||||
const current = foundry.utils.getProperty(this.document, fieldName) ?? []
|
||||
const merged = [...new Set([...current, ...parts])]
|
||||
try {
|
||||
await this.document.update({ [fieldName]: merged })
|
||||
} catch (err) {
|
||||
ui.notifications.error(game.i18n.localize("AWEMMY.Error.TraitPasteFailed"))
|
||||
console.error("AwE | trait paste update failed:", err)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -293,12 +293,8 @@ export default class AwECharacterSheet extends AwEActorSheet {
|
||||
}
|
||||
|
||||
static async #onDailyReset(event, target) {
|
||||
const actor = this.document
|
||||
const dailyAbilities = actor.itemTypes.ability.filter(i => i.system.usedToday)
|
||||
if (!dailyAbilities.length) return
|
||||
const updates = dailyAbilities.map(i => ({ _id: i.id, "system.usedToday": false }))
|
||||
await actor.updateEmbeddedDocuments("Item", updates)
|
||||
ui.notifications.info(game.i18n.localize("AWEMMY.Ability.DailyResetDone"))
|
||||
const count = await this.document.resetDailyAbilities()
|
||||
if (count > 0) ui.notifications.info(game.i18n.localize("AWEMMY.Ability.DailyResetDone"))
|
||||
}
|
||||
|
||||
static async #onLongRest(event, target) {
|
||||
|
||||
Reference in New Issue
Block a user