From 6fc421810feed633123439baf3e73eddd62aa62e Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Thu, 8 Sep 2016 22:01:27 +0900 Subject: [PATCH] fix bugs Auto scroll method should not be called when selecting note out of list. SearchInput bug --- browser/main/NoteList/index.js | 1 + browser/main/TopBar/index.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 70e54aef..90114c0e 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -84,6 +84,7 @@ class NoteList extends React.Component { if (targetIndex > -1) { let list = this.refs.root let item = list.childNodes[targetIndex] + if (item == null) return false let overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0 if (overflowBelow) { diff --git a/browser/main/TopBar/index.js b/browser/main/TopBar/index.js index 6cf478ad..f6433581 100644 --- a/browser/main/TopBar/index.js +++ b/browser/main/TopBar/index.js @@ -63,8 +63,9 @@ class TopBar extends React.Component { } getOptions () { - let { notes } = this.props + let { data } = this.props let { search } = this.state + let notes = data.noteMap.map((note) => note) if (search.trim().length === 0) return [] let searchBlocks = search.split(' ') searchBlocks.forEach((block) => { @@ -135,14 +136,14 @@ class TopBar extends React.Component { } render () { - let { config, style, storages } = this.props + let { config, style, data } = this.props let searchOptionList = this.getOptions() .map((note) => { - let storage = _.find(storages, {key: note.storage}) + let storage = data.storageMap.get(note.storage) let folder = _.find(storage.folders, {key: note.folder}) return
this.handleOptionClick(note.uniqueKey)(e)} + key={note.storage + '-' + note.key} + onClick={(e) => this.handleOptionClick(note.storage + '-' + note.key)(e)} >