diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-11-14 07:09:41 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-11-14 07:09:41 -0500 |
commit | 323ce8b203c570ed6a1dd57b44d6637ad8207616 (patch) | |
tree | efc3c61b905244bdb0e1ace0ce9f5ae4876644ad /webapp/components/suggestion | |
parent | d1207d34c1d99eba9ebf85c98d267ee7e955ea7d (diff) | |
parent | b55ec6148caa93d54b660afe55408c643d217108 (diff) | |
download | chat-323ce8b203c570ed6a1dd57b44d6637ad8207616.tar.gz chat-323ce8b203c570ed6a1dd57b44d6637ad8207616.tar.bz2 chat-323ce8b203c570ed6a1dd57b44d6637ad8207616.zip |
Merge branch 'release-3.5'
Diffstat (limited to 'webapp/components/suggestion')
-rw-r--r-- | webapp/components/suggestion/suggestion_box.jsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx index 464e57ef2..eeae5ba28 100644 --- a/webapp/components/suggestion/suggestion_box.jsx +++ b/webapp/components/suggestion/suggestion_box.jsx @@ -2,7 +2,6 @@ // See License.txt for license information. import $ from 'jquery'; -import ReactDOM from 'react-dom'; import Constants from 'utils/constants.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; @@ -37,6 +36,13 @@ export default class SuggestionBox extends React.Component { SuggestionStore.addPretextChangedListener(this.suggestionId, this.handlePretextChanged); } + componentWillReceiveProps(nextProps) { + // Clear any suggestions when the SuggestionBox is cleared + if (nextProps.value === '' && this.props.value !== nextProps.value) { + GlobalActions.emitClearSuggestions(this.suggestionId); + } + } + componentWillUnmount() { SuggestionStore.removeCompleteWordListener(this.suggestionId, this.handleCompleteWord); SuggestionStore.removePretextChangedListener(this.suggestionId, this.handlePretextChanged); @@ -64,7 +70,7 @@ export default class SuggestionBox extends React.Component { return; } - const container = $(ReactDOM.findDOMNode(this)); + const container = $(this.refs.container); if (!(container.is(e.target) || container.has(e.target).length > 0)) { // We can't just use blur for this because it fires and hides the children before @@ -198,7 +204,7 @@ export default class SuggestionBox extends React.Component { const SuggestionListComponent = listComponent; return ( - <div> + <div ref='container'> {textbox} <SuggestionListComponent suggestionId={this.suggestionId} @@ -239,6 +245,5 @@ SuggestionBox.propTypes = { // explicitly name any input event handlers we override and need to manually call onChange: React.PropTypes.func, - onBlur: React.PropTypes.func, onKeyDown: React.PropTypes.func }; |