mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
fix notePosition assignment for new children of root
This commit is contained in:
@@ -26,11 +26,13 @@ const fs = require("fs");
|
||||
function getNewNotePosition(parentNote) {
|
||||
if (parentNote.isLabelTruthy('newNotesOnTop')) {
|
||||
const minNotePos = parentNote.getChildBranches()
|
||||
.filter(branch => branch.noteId !== '_hidden') // has "always last" note position
|
||||
.reduce((min, note) => Math.min(min, note.notePosition), 0);
|
||||
|
||||
return minNotePos - 10;
|
||||
} else {
|
||||
const maxNotePos = parentNote.getChildBranches()
|
||||
.filter(branch => branch.noteId !== '_hidden') // has "always last" note position
|
||||
.reduce((max, note) => Math.max(max, note.notePosition), 0);
|
||||
|
||||
return maxNotePos + 10;
|
||||
|
||||
Reference in New Issue
Block a user