mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-08 05:34:23 +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', {
|
@body_unsubscriber = atom.commands.add 'body', {
|
||||||
'application:focus-search': @_onFocusSearch
|
'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
|
# It's important that every React class explicitly stops listening to
|
||||||
# atom events before it unmounts. Thank you event-kit
|
# atom events before it unmounts. Thank you event-kit
|
||||||
|
@ -118,6 +121,10 @@ SearchBar = React.createClass
|
||||||
_onClearSearch: (event) ->
|
_onClearSearch: (event) ->
|
||||||
Actions.searchQueryCommitted('')
|
Actions.searchQueryCommitted('')
|
||||||
|
|
||||||
|
_clearAndBlur: ->
|
||||||
|
@_onClearSearch()
|
||||||
|
@refs.searchInput?.getDOMNode().blur()
|
||||||
|
|
||||||
_onFocus: ->
|
_onFocus: ->
|
||||||
@setState focused: true
|
@setState focused: true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue