diff options
author | enahum <nahumhbl@gmail.com> | 2016-12-08 12:20:03 -0300 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-12-08 10:20:03 -0500 |
commit | b57c9fec89f736de8622218d6dc779012a266a91 (patch) | |
tree | f56ba6e73f7b6e7b2177231a7532cc40d7422e30 /webapp/components/suggestion/suggestion_box.jsx | |
parent | c4974374d9840caa6ec496c138a6220dd40afa54 (diff) | |
download | chat-b57c9fec89f736de8622218d6dc779012a266a91.tar.gz chat-b57c9fec89f736de8622218d6dc779012a266a91.tar.bz2 chat-b57c9fec89f736de8622218d6dc779012a266a91.zip |
PLT-4894 channel switcher (CTRL+K) to match message autocomplete (#4733)
* PLT-4894 Change name display of direct messages in channel switcher (CTRL+K) to match message autocomplete
* Addressing feedback
Diffstat (limited to 'webapp/components/suggestion/suggestion_box.jsx')
-rw-r--r-- | webapp/components/suggestion/suggestion_box.jsx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx index 7f8bbf309..67a29fec3 100644 --- a/webapp/components/suggestion/suggestion_box.jsx +++ b/webapp/components/suggestion/suggestion_box.jsx @@ -152,6 +152,17 @@ export default class SuggestionBox extends React.Component { this.props.onChange(e); } + if (this.props.onItemSelected) { + const items = SuggestionStore.getItems(this.suggestionId); + const selection = SuggestionStore.getSelection(this.suggestionId); + for (const i of items) { + if (i.name === selection) { + this.props.onItemSelected(i); + break; + } + } + } + textbox.focus(); // set the caret position after the next rendering @@ -199,6 +210,7 @@ export default class SuggestionBox extends React.Component { // Don't pass props used by SuggestionBox Reflect.deleteProperty(props, 'providers'); + Reflect.deleteProperty(props, 'onItemSelected'); const childProps = { ref: 'textbox', @@ -280,5 +292,6 @@ SuggestionBox.propTypes = { // explicitly name any input event handlers we override and need to manually call onChange: React.PropTypes.func, - onKeyDown: React.PropTypes.func + onKeyDown: React.PropTypes.func, + onItemSelected: React.PropTypes.func }; |