Compendium browser per type (#1103)

* Compendium Browser per type

* Sort number column

* Re-add subclass config

* Sidebar buttons

* Add Characters folder

* Css

* Done
This commit is contained in:
Dapoulp 2025-08-28 03:29:40 +02:00 committed by GitHub
parent 1eb3ff11c0
commit 9dd773001d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 542 additions and 300 deletions

View file

@ -1,6 +1,5 @@
import { abilities, subclassFeatureLabels } from '../../config/actorConfig.mjs';
import { getDeleteKeys, tagifyElement } from '../../helpers/utils.mjs';
import { ItemBrowser } from '../ui/itemBrowser.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -12,8 +11,6 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
this._dragDrop = this._createDragDropHandlers();
this.tabGroups.primary = 'advancements';
this.itemBrowser = null;
}
get title() {
@ -539,8 +536,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
static async viewCompendium(event, target) {
const type = target.dataset.compendium ?? target.dataset.type;
const presets = {
compendium: 'daggerheart',
const presets = {
folder: type,
render: {
noFolder: true
@ -559,7 +555,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
};
}
return (this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true }));
ui.compendiumBrowser.open(presets);
}
static async selectPreview(_, button) {
@ -662,7 +658,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
}, {});
await this.actor.levelUp(levelupData);
if (this.itemBrowser) this.itemBrowser.close();
if (ui.compendiumBrowser) ui.compendiumBrowser.close();
this.close();
}
}