mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-28 03:14:46 +08:00
feat(search): escape will blur and clear search
Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://review.inboxapp.com/D1374
This commit is contained in:
parent
0a7843c6e7
commit
f19f178e3c
2 changed files with 9 additions and 0 deletions
2
internal_packages/search-bar/keymaps/search-bar.cson
Normal file
2
internal_packages/search-bar/keymaps/search-bar.cson
Normal file
|
@ -0,0 +1,2 @@
|
|||
'.search-bar input':
|
||||
'escape': 'search-bar:escape-search'
|
|
@ -19,6 +19,9 @@ SearchBar = React.createClass
|
|||
@body_unsubscriber = atom.commands.add 'body', {
|
||||
'application:focus-search': @_onFocusSearch
|
||||
}
|
||||
@body_unsubscriber = atom.commands.add '.search-bar', {
|
||||
'search-bar:escape-search': @_clearAndBlur
|
||||
}
|
||||
|
||||
# It's important that every React class explicitly stops listening to
|
||||
# atom events before it unmounts. Thank you event-kit
|
||||
|
@ -118,6 +121,10 @@ SearchBar = React.createClass
|
|||
_onClearSearch: (event) ->
|
||||
Actions.searchQueryCommitted('')
|
||||
|
||||
_clearAndBlur: ->
|
||||
@_onClearSearch()
|
||||
@refs.searchInput?.getDOMNode().blur()
|
||||
|
||||
_onFocus: ->
|
||||
@setState focused: true
|
||||
|
||||
|
|
Loading…
Reference in a new issue