From 70e57cf738a16d8d566c58aa98b14a61fc1d5537 Mon Sep 17 00:00:00 2001 From: David Dreher Date: Thu, 21 Mar 2019 17:46:48 +0100 Subject: [PATCH] jumpNoteByHashHandler will now try to find the location for the note that will be selected --- browser/main/NoteList/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index e1816015..60e11a79 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -259,13 +259,23 @@ class NoteList extends React.Component { } jumpNoteByHashHandler (event, noteHash) { + const { data } = this.props + // first argument event isn't used. if (this.notes === null || this.notes.length === 0) { return } const selectedNoteKeys = [noteHash] - this.focusNote(selectedNoteKeys, noteHash, '/home') + + let locationToSelect = '/home' + const notesByHash = data.noteMap.map((note) => note).filter((note) => note.key === noteHash) + if (notesByHash.length > 0) { + const note = notesByHash[0] + locationToSelect = '/storages/' + note.storage + '/folders/' + note.folder + } + + this.focusNote(selectedNoteKeys, noteHash, locationToSelect) ee.emit('list:moved') }