mirror of
https://github.com/zadam/trilium.git
synced 2025-11-09 06:45:49 +01:00
Use noteContextReorder event instead
This commit is contained in:
@@ -609,6 +609,22 @@ export default class TabRowWidget extends BasicWidget {
|
||||
this.updateTabById(noteContext.mainNtxId || noteContext.ntxId);
|
||||
}
|
||||
|
||||
noteContextReorderEvent({ntxIdsInOrder, oldNtxIdsInOrder, mainNtxIdsInOrder}) {
|
||||
if (!oldNtxIdsInOrder || !mainNtxIdsInOrder
|
||||
|| ntxIdsInOrder.length !== oldNtxIdsInOrder.length
|
||||
|| ntxIdsInOrder.length !== mainNtxIdsInOrder.length
|
||||
)
|
||||
return;
|
||||
|
||||
ntxIdsInOrder.forEach((id, i) => {
|
||||
// update main context that is not a tab
|
||||
if (!mainNtxIdsInOrder[i] && this.getTabById(id).length === 0) {
|
||||
this.getTabById(oldNtxIdsInOrder[i]).attr("data-ntx-id", id);
|
||||
this.updateTabById(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateTabById(ntxId) {
|
||||
const $tab = this.getTabById(ntxId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user