Various fixes/update based on first tests feedback

This commit is contained in:
2026-04-10 14:47:21 +02:00
parent 63da2ef664
commit 999b78c6fc
21 changed files with 151 additions and 75 deletions
+17 -1
View File
@@ -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)
}
})
})
}