summaryrefslogtreecommitdiffstats
path: root/webapp/components/suggestion/suggestion_box.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-23 16:21:27 -0400
committerChristopher Speller <crspeller@gmail.com>2016-03-23 16:21:27 -0400
commit6285ec44bbcafe41dbd47dfe9955982df4bab362 (patch)
tree466ffc850cb5487a0a361721f0cb15d2e99d102e /webapp/components/suggestion/suggestion_box.jsx
parent826529f048cd19591ce1ad109ce05fe3a74745d5 (diff)
parentf134df04b024dcf8310a02558e58afdf2a6ed94c (diff)
downloadchat-6285ec44bbcafe41dbd47dfe9955982df4bab362.tar.gz
chat-6285ec44bbcafe41dbd47dfe9955982df4bab362.tar.bz2
chat-6285ec44bbcafe41dbd47dfe9955982df4bab362.zip
Merge pull request #2494 from hmhealey/plt2190
PLT-2190 Switched Textbox to use a TextareaAutosize and removed custom resizing code
Diffstat (limited to 'webapp/components/suggestion/suggestion_box.jsx')
-rw-r--r--webapp/components/suggestion/suggestion_box.jsx17
1 files changed, 14 insertions, 3 deletions
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx
index e3ec63194..b7f0e3a36 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) {
@@ -132,7 +141,8 @@ export default class SuggestionBox extends React.Component {
);
} else if (this.props.type === 'textarea') {
textbox = (
- <textarea
+ <TextareaAutosize
+ id={this.suggestionId}
ref='textbox'
{...newProps}
/>
@@ -163,5 +173,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,
+ onHeightChange: React.PropTypes.func
};