Various fixes and changes based on tester feedback

This commit is contained in:
2026-03-17 13:50:32 +01:00
parent 92ba9c3501
commit 000bf348a6
29 changed files with 1450 additions and 192 deletions

View File

@@ -60,6 +60,16 @@ export default class OathHammerActorSheet extends HandlebarsApplicationMixin(fou
/** @override */
_onRender(context, options) {
this.#dragDrop.forEach((d) => d.bind(this.element))
// ProseMirror "Save" dispatches a change event before committing its .value
// to the element, so FormDataExtended may read stale HTML. Instead we
// intercept the event here, stop it from bubbling to the submitOnChange
// handler, and update the document directly with the current editor value.
for (const pm of this.element.querySelectorAll("prose-mirror[name]")) {
pm.addEventListener("change", async (event) => {
event.stopPropagation()
await this.document.update({ [pm.name]: pm.value ?? "" })
})
}
}
#createDragDropHandlers() {
@@ -89,6 +99,10 @@ export default class OathHammerActorSheet extends HandlebarsApplicationMixin(fou
_onDragStart(event) {
if ("link" in event.target.dataset) return
const li = event.target.closest("[data-item-uuid]")
if (!li) return
const dragData = { type: "Item", uuid: li.dataset.itemUuid }
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
}
_onDragOver(event) {}