mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge pull request #628 from BoostIO/feature-improve-search-textbox-ux
improve searchTextBox UX
This commit is contained in:
@@ -203,6 +203,7 @@ class NoteList extends React.Component {
|
|||||||
|
|
||||||
getNotes () {
|
getNotes () {
|
||||||
let { data, params, location } = this.props
|
let { data, params, location } = this.props
|
||||||
|
let { router } = this.context
|
||||||
|
|
||||||
if (location.pathname.match(/\/home/)) {
|
if (location.pathname.match(/\/home/)) {
|
||||||
return data.noteMap.map((note) => note)
|
return data.noteMap.map((note) => note)
|
||||||
@@ -214,7 +215,11 @@ class NoteList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (location.pathname.match(/\/searched/)) {
|
if (location.pathname.match(/\/searched/)) {
|
||||||
return searchFromNotes(this.props.data, document.getElementsByClassName('searchInput')[0].value)
|
const searchInputText = document.getElementsByClassName('searchInput')[0].value
|
||||||
|
if (searchInputText === '') {
|
||||||
|
router.push('/home')
|
||||||
|
}
|
||||||
|
return searchFromNotes(this.props.data, searchInputText)
|
||||||
}
|
}
|
||||||
|
|
||||||
let storageKey = params.storageKey
|
let storageKey = params.storageKey
|
||||||
|
|||||||
Reference in New Issue
Block a user