mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
becca should also keep correct branch order, e.g. for export, #2346
This commit is contained in:
@@ -730,6 +730,21 @@ class BNote extends AbstractBeccaEntity {
|
||||
.filter(note => !!note);
|
||||
}
|
||||
|
||||
sortChildren() {
|
||||
if (this.children.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const becca = this.becca;
|
||||
|
||||
this.children.sort((a, b) => {
|
||||
const aBranch = becca.getBranchFromChildAndParent(a.noteId, this.noteId);
|
||||
const bBranch = becca.getBranchFromChildAndParent(b.noteId, this.noteId);
|
||||
|
||||
return aBranch?.notePosition < bBranch?.notePosition ? -1 : 1;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used for:
|
||||
* - fast searching
|
||||
|
||||
Reference in New Issue
Block a user