mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Reverted sorting
This commit is contained in:
parent
201d3c3f3c
commit
7614001bdd
4 changed files with 31 additions and 87 deletions
|
|
@ -548,9 +548,7 @@ export default function DHApplicationMixin(Base) {
|
|||
callback: async (target, _event) => {
|
||||
const doc = await getDocFromElement(target);
|
||||
this.document.update({
|
||||
'system.sidebarFavorites': this.document.system.sidebarFavorites
|
||||
.filter(x => x.item.id !== doc.id)
|
||||
.map(x => ({ ...x, item: x.item.uuid }))
|
||||
'system.sidebarFavorites': this.document.system.sidebarFavorites.filter(x => x.id !== doc.id)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -568,15 +566,8 @@ export default function DHApplicationMixin(Base) {
|
|||
},
|
||||
callback: async (target, _event) => {
|
||||
const doc = await getDocFromElement(target);
|
||||
const nextSort = this.document.system.sidebarFavorites.length
|
||||
? this.document.system.sidebarFavorites.reduce((acc, curr) => Math.max(curr.sort, acc), 0) +
|
||||
100000
|
||||
: 0;
|
||||
this.document.update({
|
||||
'system.sidebarFavorites': [
|
||||
...this.document.system.sidebarFavorites.map(x => ({ ...x, item: x.item.uuid })),
|
||||
{ sort: nextSort, item: doc.uuid }
|
||||
]
|
||||
'system.sidebarFavorites': [...this.document.system.sidebarFavorites, doc]
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue