Various fixes and changes based on tester feedback
This commit is contained in:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user