mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
Use noteContextReorder event instead
This commit is contained in:
@@ -451,16 +451,15 @@ export default class TabManager extends Component {
|
||||
this.tabsUpdate.scheduleUpdate();
|
||||
}
|
||||
|
||||
noteContextReorderEvent({ntxIdsInOrder}) {
|
||||
const order = {};
|
||||
let i = 0;
|
||||
|
||||
for (const ntxId of ntxIdsInOrder) {
|
||||
order[ntxId] = i++;
|
||||
}
|
||||
noteContextReorderEvent({ntxIdsInOrder, mainNtxIdsInOrder}) {
|
||||
const order = Object.fromEntries(ntxIdsInOrder.map((v, i) => [v, i]));
|
||||
|
||||
this.children.sort((a, b) => order[a.ntxId] < order[b.ntxId] ? -1 : 1);
|
||||
|
||||
if (!!mainNtxIdsInOrder && mainNtxIdsInOrder.length === this.children.length) {
|
||||
this.children.forEach((c, i) => c.mainNtxId = mainNtxIdsInOrder[i]);
|
||||
}
|
||||
|
||||
this.tabsUpdate.scheduleUpdate();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user