Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	src/services/note_cache/entities/note.js
This commit is contained in:
zadam
2021-01-23 21:09:47 +01:00
3 changed files with 51 additions and 4 deletions

View File

@@ -1245,7 +1245,25 @@ export default class NoteTreeWidget extends TabAwareWidget {
this.clearSelectedNodes();
}
canBeMovedUpOrDown(node) {
if (node.data.noteId === 'root') {
return false;
}
const parentNote = treeCache.getNoteFromCache(node.getParent().data.noteId);
if (parentNote && parentNote.hasLabel('sorted')) {
return false;
}
return true;
}
moveNoteUpCommand({node}) {
if (!this.canBeMovedUpOrDown(node)) {
return;
}
const beforeNode = node.getPrevSibling();
if (beforeNode !== null) {
@@ -1254,7 +1272,12 @@ export default class NoteTreeWidget extends TabAwareWidget {
}
moveNoteDownCommand({node}) {
if (!this.canBeMovedUpOrDown(node)) {
return;
}
const afterNode = node.getNextSibling();
if (afterNode !== null) {
branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId);
}