mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-04 06:18:24 +08:00
fix(search): Execute search for subject, autoselect first item
Fixes T5899, but we may want to iterate on it more later.
This commit is contained in:
parent
0c93cb856f
commit
b9954b764d
2 changed files with 8 additions and 10 deletions
|
@ -116,8 +116,7 @@ class SearchBar extends React.Component
|
|||
|
||||
_onSelectSuggestion: (item) =>
|
||||
if item.thread?
|
||||
Actions.searchQueryCommitted(null)
|
||||
Actions.setFocus({collection: 'thread', item: item.thread})
|
||||
Actions.searchQueryCommitted([{all: "\"#{item.thread.subject}\""}])
|
||||
else
|
||||
Actions.searchQueryCommitted(item.value)
|
||||
|
||||
|
|
|
@ -50,6 +50,13 @@ class ThreadListStore extends NylasStore
|
|||
@trigger(@)
|
||||
,@
|
||||
|
||||
# Set up a one-time listener to focus an item in the new view
|
||||
if WorkspaceStore.layoutMode() is 'split'
|
||||
unlisten = view.listen ->
|
||||
if view.loaded()
|
||||
Actions.setFocus(collection: 'thread', item: view.get(0))
|
||||
unlisten()
|
||||
|
||||
@trigger(@)
|
||||
|
||||
createView: ->
|
||||
|
@ -75,14 +82,6 @@ class ThreadListStore extends NylasStore
|
|||
for message in messages
|
||||
messagesByThread[message.threadId].push message
|
||||
messagesByThread
|
||||
|
||||
if WorkspaceStore.layoutMode() is 'split'
|
||||
# Set up a one-time listener to focus an item in the new view
|
||||
unlisten = view.listen ->
|
||||
if view.loaded()
|
||||
Actions.setFocus(collection: 'thread', item: view.get(0))
|
||||
unlisten()
|
||||
|
||||
@setView(view)
|
||||
|
||||
Actions.setFocus(collection: 'thread', item: null)
|
||||
|
|
Loading…
Reference in a new issue