mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
fix(tree): keep moved notes always visible (#7776)
This commit is contained in:
commit
25a27c9b11
@ -176,11 +176,6 @@ async function moveNodeUpInHierarchy(node: Fancytree.FancytreeNode) {
|
|||||||
toastService.showError(resp.message);
|
toastService.showError(resp.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hoistedNoteService.isTopLevelNode(node) && node.getParent().getChildren().length <= 1) {
|
|
||||||
node.getParent().folder = false;
|
|
||||||
node.getParent().renderTitle();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterSearchBranches(branchIds: string[]) {
|
function filterSearchBranches(branchIds: string[]) {
|
||||||
|
|||||||
@ -1606,7 +1606,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
return !parentNote?.hasLabel("sorted");
|
return !parentNote?.hasLabel("sorted");
|
||||||
}
|
}
|
||||||
|
|
||||||
moveNoteUpCommand({ node }: CommandListenerData<"moveNoteUp">) {
|
async moveNoteUpCommand({ node }: CommandListenerData<"moveNoteUp">) {
|
||||||
if (!node || !this.canBeMovedUpOrDown(node)) {
|
if (!node || !this.canBeMovedUpOrDown(node)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1614,11 +1614,12 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
const beforeNode = node.getPrevSibling();
|
const beforeNode = node.getPrevSibling();
|
||||||
|
|
||||||
if (beforeNode !== null) {
|
if (beforeNode !== null) {
|
||||||
branchService.moveBeforeBranch([node.data.branchId], beforeNode.data.branchId);
|
await branchService.moveBeforeBranch([node.data.branchId], beforeNode.data.branchId);
|
||||||
|
node.makeVisible({ scrollIntoView: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
moveNoteDownCommand({ node }: CommandListenerData<"moveNoteDown">) {
|
async moveNoteDownCommand({ node }: CommandListenerData<"moveNoteDown">) {
|
||||||
if (!this.canBeMovedUpOrDown(node)) {
|
if (!this.canBeMovedUpOrDown(node)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1626,7 +1627,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
const afterNode = node.getNextSibling();
|
const afterNode = node.getNextSibling();
|
||||||
|
|
||||||
if (afterNode !== null) {
|
if (afterNode !== null) {
|
||||||
branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId);
|
await branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId);
|
||||||
|
node.makeVisible({ scrollIntoView: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user