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:
Evan Morikawa 2015-03-30 16:43:38 -07:00
parent 0a7843c6e7
commit f19f178e3c
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,2 @@
'.search-bar input':
'escape': 'search-bar:escape-search'

View file

@ -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