mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 20:06:08 +01:00
shortcuts improvements
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'].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,13 +58,10 @@ function validateParentChild(parentNoteId, childNoteId, branchId = null) {
|
||||
};
|
||||
}
|
||||
|
||||
const parentNoteIsShortcut = becca.getNote(parentNoteId).type === 'shortcut';
|
||||
const childNoteIsShortcut = becca.getNote(childNoteId).type === 'shortcut';
|
||||
|
||||
if (parentNoteIsShortcut !== childNoteIsShortcut) {
|
||||
if (becca.getNote(parentNoteId).type === 'shortcut') {
|
||||
return {
|
||||
success: false,
|
||||
message: 'Moving/cloning is not possible between shortcuts / normal notes.'
|
||||
message: 'Shortcut note cannot have any children.'
|
||||
};
|
||||
}
|
||||
|
||||
@@ -189,6 +186,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;
|
||||
}
|
||||
|
||||
sql.execute("UPDATE branches SET notePosition = ? WHERE branchId = ?",
|
||||
[position, branch.branchId]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user