Show actor sheet when clicking actors in item browser

This commit is contained in:
Carlos Fernandez 2026-05-25 18:24:53 -04:00
parent 0e8c3dc74a
commit 53b8df1a76
3 changed files with 20 additions and 10 deletions

View file

@ -1,3 +1,4 @@
import { getDocFromElement } from '../../helpers/utils.mjs';
import { RefreshType, socketEvent } from '../../systemRegistration/socket.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -47,7 +48,8 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
expandContent: this.expandContent,
resetFilters: this.resetFilters,
sortList: this.sortList,
openSettings: this.openSettings
openSettings: this.openSettings,
viewSheet: this.#onViewSheet
},
position: {
left: 100,
@ -306,7 +308,8 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
{
items: this.items,
menu: this.selectedMenu,
formatLabel: this.formatLabel
formatLabel: this.formatLabel,
viewSheet: this.items[0] instanceof Actor
}
);
@ -568,6 +571,11 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
}
}
static async #onViewSheet(_, target) {
const document = await getDocFromElement(target);
document?.sheet?.render(true);
}
_createDragProcess() {
new foundry.applications.ux.DragDrop.implementation({
dragSelector: '.item-container',

View file

@ -245,7 +245,7 @@
}
.item-list-header,
.item-list [data-action='expandContent'] {
.item-list .item-info[data-action] {
display: flex;
> * {

View file

@ -1,7 +1,7 @@
{{#each items}}
<div class="item-container" data-item-uuid="{{uuid}}" draggable="true">
<div class="item-header">
<div class="item-info" data-action="expandContent">
<div class="item-info" {{#if @root.viewSheet}}data-action="viewSheet"{{else}}data-action="expandContent"{{/if}}>
<img src="{{img}}" data-item-key="img" class="item-list-img">
<span data-item-key="name" class="item-list-name">{{name}}</span>
{{#each ../menu.data.columns}}
@ -9,11 +9,13 @@
{{/each}}
</div>
</div>
{{#unless viewSheet}}
<div class="item-desc extensible">
<span class="wrapper">
{{{system.enrichedTags}}}
{{{system.enrichedDescription}}}
</span>
</div>
{{/unless}}
</div>
{{/each}}