Merge branch 'fix-dragging-from-compendium-to-actor-sheet' into 'master'
fix dragging items from compendium to actor sheet See merge request dungeonslayers/ds4!63
This commit is contained in:
commit
4d09c86997
2 changed files with 15 additions and 20 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -2718,7 +2718,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"foundry-pc-types": {
|
"foundry-pc-types": {
|
||||||
"version": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#5fcca4e4327b558d5eeeb962f05470c994a394be",
|
"version": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#ac45653fdec5fb935bf7db72889cb40cd6b80b20",
|
||||||
"from": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes",
|
"from": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
|
@ -208,13 +208,9 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @override */
|
||||||
* @override
|
async _onDropItem(event: DragEvent, data: Parameters<typeof DS4Item.fromDropData>[0]): Promise<unknown> {
|
||||||
*/
|
const item = await Item.fromDropData(data);
|
||||||
async _onDrop(event: DragEvent): Promise<boolean | unknown> {
|
|
||||||
const data = JSON.parse(event.dataTransfer?.getData("text/plain")) as { type?: string };
|
|
||||||
if (data.type === "Item") {
|
|
||||||
const item = await Item.fromDropData(data as Parameters<typeof DS4Item.fromDropData>[0]);
|
|
||||||
if (item && !this.actor.canOwnItemType(item.data.type as ItemType)) {
|
if (item && !this.actor.canOwnItemType(item.data.type as ItemType)) {
|
||||||
ui.notifications.warn(
|
ui.notifications.warn(
|
||||||
game.i18n.format("DS4.WarningActorCannotOwnItem", {
|
game.i18n.format("DS4.WarningActorCannotOwnItem", {
|
||||||
|
@ -226,7 +222,6 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
return super._onDropItem(event, data);
|
||||||
return super._onDrop(event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue