1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

jumpNoteByHashHandler will now try to find the location for the note that will be selected

This commit is contained in:
David Dreher
2019-03-21 17:46:48 +01:00
committed by Junyoung Choi
parent 2f00cec52b
commit 70e57cf738

View File

@@ -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')
}