Added use of ItemLinkFields

This commit is contained in:
WBHarry 2025-07-24 04:02:49 +02:00
parent 8cdad5172e
commit 569e567dfd
18 changed files with 232 additions and 288 deletions

View file

@ -341,7 +341,20 @@ export default function DHApplicationMixin(Base) {
{
name: 'CONTROLS.CommonEdit',
icon: 'fa-solid fa-pen-to-square',
callback: target => getDocFromElement(target).sheet.render({ force: true })
callback: async target => {
const doc = getDocFromElement(target);
const appId = this.element.id;
doc.apps[appId] = this;
const app = await doc.sheet.render({ force: true });
app.addEventListener(
'close',
() => {
delete doc.apps[appId];
},
{ once: true }
);
return;
}
}
];
@ -496,9 +509,21 @@ export default function DHApplicationMixin(Base) {
* Renders an embedded document.
* @type {ApplicationClickAction}
*/
static #editDoc(_event, target) {
static async #editDoc(_event, target) {
const doc = getDocFromElement(target);
if (doc) return doc.sheet.render({ force: true });
if (doc) {
const appId = this.element.id;
doc.apps[appId] = this;
const app = await doc.sheet.render({ force: true });
app.addEventListener(
'close',
() => {
delete doc.apps[appId];
},
{ once: true }
);
return;
}
// TODO: REDO this
const { actionId } = target.closest('[data-action-id]').dataset;