Skip to content

Commit 25a27c9

Browse files
authored
fix(tree): keep moved notes always visible (#7776)
2 parents 456d59f + 9226b16 commit 25a27c9

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

apps/client/src/services/branches.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@ async function moveNodeUpInHierarchy(node: Fancytree.FancytreeNode) {
176176
toastService.showError(resp.message);
177177
return;
178178
}
179-
180-
if (!hoistedNoteService.isTopLevelNode(node) && node.getParent().getChildren().length <= 1) {
181-
node.getParent().folder = false;
182-
node.getParent().renderTitle();
183-
}
184179
}
185180

186181
function filterSearchBranches(branchIds: string[]) {

apps/client/src/widgets/note_tree.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,27 +1606,29 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
16061606
return !parentNote?.hasLabel("sorted");
16071607
}
16081608

1609-
moveNoteUpCommand({ node }: CommandListenerData<"moveNoteUp">) {
1609+
async moveNoteUpCommand({ node }: CommandListenerData<"moveNoteUp">) {
16101610
if (!node || !this.canBeMovedUpOrDown(node)) {
16111611
return;
16121612
}
16131613

16141614
const beforeNode = node.getPrevSibling();
16151615

16161616
if (beforeNode !== null) {
1617-
branchService.moveBeforeBranch([node.data.branchId], beforeNode.data.branchId);
1617+
await branchService.moveBeforeBranch([node.data.branchId], beforeNode.data.branchId);
1618+
node.makeVisible({ scrollIntoView: true });
16181619
}
16191620
}
16201621

1621-
moveNoteDownCommand({ node }: CommandListenerData<"moveNoteDown">) {
1622+
async moveNoteDownCommand({ node }: CommandListenerData<"moveNoteDown">) {
16221623
if (!this.canBeMovedUpOrDown(node)) {
16231624
return;
16241625
}
16251626

16261627
const afterNode = node.getNextSibling();
16271628

16281629
if (afterNode !== null) {
1629-
branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId);
1630+
await branchService.moveAfterBranch([node.data.branchId], afterNode.data.branchId);
1631+
node.makeVisible({ scrollIntoView: true });
16301632
}
16311633
}
16321634

0 commit comments

Comments
 (0)