mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-11 15:34:27 +08:00
fix(search): Allow typing in the middle of the search text
This commit is contained in:
parent
f59de7262d
commit
dc538930a7
2 changed files with 7 additions and 9 deletions
|
@ -105,10 +105,11 @@ class SearchBar extends React.Component
|
|||
str += val
|
||||
else
|
||||
str += val
|
||||
str
|
||||
|
||||
_stringToQuery: (str) =>
|
||||
return [] unless str
|
||||
return [all: str]
|
||||
return [{all: str}]
|
||||
|
||||
_onValueChange: (event) =>
|
||||
Actions.searchQueryChanged(@_stringToQuery(event.target.value))
|
||||
|
|
|
@ -24,29 +24,26 @@ SearchSuggestionStore = Reflux.createStore
|
|||
|
||||
onSearchQueryChanged: (query) ->
|
||||
@_query = query
|
||||
@_rebuildResults()
|
||||
@trigger()
|
||||
_.defer => @_rebuildResults()
|
||||
|
||||
onSearchQueryCommitted: (query) ->
|
||||
@_query = query
|
||||
@_committedQuery = query
|
||||
@_clearResults()
|
||||
@trigger()
|
||||
|
||||
onSearchBlurred: ->
|
||||
@_clearResults()
|
||||
@trigger()
|
||||
|
||||
_clearResults: ->
|
||||
@_threadResults = null
|
||||
@_contactResults = null
|
||||
@_suggestions = []
|
||||
@trigger()
|
||||
|
||||
_rebuildResults: ->
|
||||
{key, val} = @queryKeyAndVal()
|
||||
unless key and val
|
||||
@_clearResults()
|
||||
@trigger(@)
|
||||
return
|
||||
return @_clearResults() unless key and val
|
||||
|
||||
ContactStore.searchContacts(val, limit:10).then (results) =>
|
||||
@_contactResults = results
|
||||
|
@ -98,7 +95,7 @@ SearchSuggestionStore = Reflux.createStore
|
|||
contact: contact
|
||||
value: [{"all": contact.email}]
|
||||
|
||||
@trigger(@)
|
||||
@trigger()
|
||||
|
||||
# Exposed Data
|
||||
|
||||
|
|
Loading…
Reference in a new issue