From a6586c9d1cfad1002ae47092f3266642491e76d6 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Tue, 18 Nov 2025 15:33:32 +0800 Subject: [PATCH] fix(tree): keep moved notes always visible --- apps/client/src/widgets/note_tree.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts index 1fd373559..49eb4dcac 100644 --- a/apps/client/src/widgets/note_tree.ts +++ b/apps/client/src/widgets/note_tree.ts @@ -1606,7 +1606,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { return !parentNote?.hasLabel("sorted"); } - moveNoteUpCommand({ node }: CommandListenerData<"moveNoteUp">) { + async moveNoteUpCommand({ node }: CommandListenerData<"moveNoteUp">) { if (!node || !this.canBeMovedUpOrDown(node)) { return; } @@ -1614,11 +1614,12 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { const beforeNode = node.getPrevSibling(); 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)) { return; } @@ -1626,7 +1627,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { const afterNode = node.getNextSibling(); if (afterNode !== null) { - branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId); + await branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId); + node.makeVisible({ scrollIntoView: true }); } }