mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
Merge branch 'next58'
# Conflicts: # src/public/app/widgets/note_tree.js # src/services/tree.js
This commit is contained in:
@@ -30,13 +30,13 @@ function getNotes(noteIds) {
|
||||
}
|
||||
|
||||
function validateParentChild(parentNoteId, childNoteId, branchId = null) {
|
||||
if (childNoteId === 'root') {
|
||||
return { success: false, message: 'Cannot move root note.'};
|
||||
if (['root', 'hidden', 'share', 'lbRoot', 'lbAvailableLaunchers', 'lbVisibleLaunchers'].includes(childNoteId)) {
|
||||
return { success: false, message: `Cannot change this note's location.`};
|
||||
}
|
||||
|
||||
if (parentNoteId === 'none') {
|
||||
// this shouldn't happen
|
||||
return { success: false, message: 'Cannot move anything into root parent.' };
|
||||
return { success: false, message: `Cannot move anything into 'none' parent.` };
|
||||
}
|
||||
|
||||
const existing = getExistingBranch(parentNoteId, childNoteId);
|
||||
@@ -58,6 +58,13 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) {
|
||||
};
|
||||
}
|
||||
|
||||
if (parentNoteId !== 'lbBookmarks' && becca.getNote(parentNoteId).type === 'launcher') {
|
||||
return {
|
||||
success: false,
|
||||
message: 'Launcher note cannot have any children.'
|
||||
};
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@@ -180,6 +187,10 @@ function sortNotes(parentNoteId, customSortBy = 'title', reverse = false, folder
|
||||
for (const note of notes) {
|
||||
const branch = note.getParentBranches().find(b => b.parentNoteId === parentNoteId);
|
||||
|
||||
if (branch.branchId === 'hidden') {
|
||||
position = 999_999_999;
|
||||
}
|
||||
|
||||
if (branch.notePosition !== position) {
|
||||
sql.execute("UPDATE branches SET notePosition = ? WHERE branchId = ?",
|
||||
[position, branch.branchId]);
|
||||
|
||||
Reference in New Issue
Block a user