summaryrefslogtreecommitdiffstats
path: root/webapp/components/suggestion
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/suggestion')
-rw-r--r--webapp/components/suggestion/suggestion_box.jsx27
1 files changed, 23 insertions, 4 deletions
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx
index e3ec63194..dbec024ac 100644
--- a/webapp/components/suggestion/suggestion_box.jsx
+++ b/webapp/components/suggestion/suggestion_box.jsx
@@ -3,11 +3,14 @@
import $ from 'jquery';
import ReactDOM from 'react-dom';
+
import Constants from 'utils/constants.jsx';
import * as GlobalActions from 'action_creators/global_actions.jsx';
import SuggestionStore from 'stores/suggestion_store.jsx';
import * as Utils from 'utils/utils.jsx';
+import TextareaAutosize from 'react-textarea-autosize';
+
const KeyCodes = Constants.KeyCodes;
import React from 'react';
@@ -44,7 +47,13 @@ export default class SuggestionBox extends React.Component {
getTextbox() {
// this is to support old code that looks at the input/textarea DOM nodes
- return ReactDOM.findDOMNode(this.refs.textbox);
+ let textbox = this.refs.textbox;
+
+ if (!(textbox instanceof HTMLElement)) {
+ textbox = ReactDOM.findDOMNode(textbox);
+ }
+
+ return textbox;
}
handleDocumentClick(e) {
@@ -130,9 +139,18 @@ export default class SuggestionBox extends React.Component {
{...newProps}
/>
);
+ } else if (this.props.type === 'search') {
+ textbox = (
+ <input
+ ref='textbox'
+ type='search'
+ {...newProps}
+ />
+ );
} else if (this.props.type === 'textarea') {
textbox = (
- <textarea
+ <TextareaAutosize
+ id={this.suggestionId}
ref='textbox'
{...newProps}
/>
@@ -156,12 +174,13 @@ SuggestionBox.defaultProps = {
SuggestionBox.propTypes = {
listComponent: React.PropTypes.func.isRequired,
- type: React.PropTypes.oneOf(['input', 'textarea']).isRequired,
+ type: React.PropTypes.oneOf(['input', 'textarea', 'search']).isRequired,
value: React.PropTypes.string.isRequired,
onUserInput: React.PropTypes.func,
providers: React.PropTypes.arrayOf(React.PropTypes.object),
// 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,
+ onHeightChange: React.PropTypes.func
};