mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix bugs
Auto scroll method should not be called when selecting note out of list. SearchInput bug
This commit is contained in:
@@ -84,6 +84,7 @@ class NoteList extends React.Component {
|
|||||||
if (targetIndex > -1) {
|
if (targetIndex > -1) {
|
||||||
let list = this.refs.root
|
let list = this.refs.root
|
||||||
let item = list.childNodes[targetIndex]
|
let item = list.childNodes[targetIndex]
|
||||||
|
if (item == null) return false
|
||||||
|
|
||||||
let overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
|
let overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
|
||||||
if (overflowBelow) {
|
if (overflowBelow) {
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class TopBar extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getOptions () {
|
getOptions () {
|
||||||
let { notes } = this.props
|
let { data } = this.props
|
||||||
let { search } = this.state
|
let { search } = this.state
|
||||||
|
let notes = data.noteMap.map((note) => note)
|
||||||
if (search.trim().length === 0) return []
|
if (search.trim().length === 0) return []
|
||||||
let searchBlocks = search.split(' ')
|
let searchBlocks = search.split(' ')
|
||||||
searchBlocks.forEach((block) => {
|
searchBlocks.forEach((block) => {
|
||||||
@@ -135,14 +136,14 @@ class TopBar extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { config, style, storages } = this.props
|
let { config, style, data } = this.props
|
||||||
let searchOptionList = this.getOptions()
|
let searchOptionList = this.getOptions()
|
||||||
.map((note) => {
|
.map((note) => {
|
||||||
let storage = _.find(storages, {key: note.storage})
|
let storage = data.storageMap.get(note.storage)
|
||||||
let folder = _.find(storage.folders, {key: note.folder})
|
let folder = _.find(storage.folders, {key: note.folder})
|
||||||
return <div styleName='control-search-optionList-item'
|
return <div styleName='control-search-optionList-item'
|
||||||
key={note.uniqueKey}
|
key={note.storage + '-' + note.key}
|
||||||
onClick={(e) => this.handleOptionClick(note.uniqueKey)(e)}
|
onClick={(e) => this.handleOptionClick(note.storage + '-' + note.key)(e)}
|
||||||
>
|
>
|
||||||
<div styleName='control-search-optionList-item-folder'
|
<div styleName='control-search-optionList-item-folder'
|
||||||
style={{borderColor: folder.color}}>
|
style={{borderColor: folder.color}}>
|
||||||
|
|||||||
Reference in New Issue
Block a user