mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
Compendium Browser (#821)
This commit is contained in:
parent
b68d2e9ec2
commit
f9774f130e
6 changed files with 74 additions and 20 deletions
|
|
@ -121,6 +121,16 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
}
|
||||
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
htmlElement
|
||||
.querySelectorAll('[data-action="selectFolder"]')
|
||||
.forEach(element => element.addEventListener("contextmenu", (event) => {
|
||||
event.target.classList.toggle('expanded');
|
||||
}))
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Rendering */
|
||||
/* -------------------------------------------- */
|
||||
|
|
@ -179,9 +189,20 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
this.items = ItemBrowser.sortBy(items, 'name');
|
||||
|
||||
if(target) {
|
||||
target.closest('.compendium-sidebar').querySelectorAll('[data-action="selectFolder"]').forEach(element => element.classList.remove("is-selected"))
|
||||
target.classList.add('is-selected');
|
||||
}
|
||||
|
||||
this.render({ force: true });
|
||||
}
|
||||
|
||||
_replaceHTML(result, content, options) {
|
||||
if(!options.isFirstRender) delete result.sidebar;
|
||||
super._replaceHTML(result, content, options);
|
||||
}
|
||||
|
||||
static expandContent(_, target) {
|
||||
const parent = target.parentElement;
|
||||
parent.classList.toggle('expanded');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue