1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Mobile: Fixes #10589: Fix selected note changes on moving to a different folder (#10630)

This commit is contained in:
Henry Heino
2024-06-18 01:59:08 -07:00
committed by GitHub
parent 573ea6051c
commit ed31d8202b
8 changed files with 78 additions and 24 deletions

View File

@@ -1005,7 +1005,11 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
draft.notes = newNotes;
if (noteFolderHasChanged) {
// Ensure that the selected note is still in the current folder.
// For example, if the user drags the current note to a different folder,
// a new note should be selected.
// In some cases, however, the selection needs to be preserved (e.g. the mobile app).
if (noteFolderHasChanged && !action.preserveSelection) {
let newIndex = movedNotePreviousIndex;
if (newIndex >= newNotes.length) newIndex = newNotes.length - 1;
if (!newNotes.length) newIndex = -1;