From 6d10b103189168c556456319115774b41ee5ac73 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 30 Nov 2015 16:20:42 -0500
Subject: Replaced MentionList and Mention components with AtMentionProvider

---
 web/react/components/suggestion_box.jsx | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

(limited to 'web/react/components/suggestion_box.jsx')

diff --git a/web/react/components/suggestion_box.jsx b/web/react/components/suggestion_box.jsx
index ddfcaf811..5510ba340 100644
--- a/web/react/components/suggestion_box.jsx
+++ b/web/react/components/suggestion_box.jsx
@@ -3,7 +3,6 @@
 
 import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
 import Constants from '../utils/constants.jsx';
-import SuggestionList from './suggestion_list.jsx';
 import SuggestionStore from '../stores/suggestion_store.jsx';
 import * as Utils from '../utils/utils.jsx';
 
@@ -45,6 +44,11 @@ export default class SuggestionBox extends React.Component {
         $(document).off('click', this.handleDocumentClick);
     }
 
+    getTextbox() {
+        // this is to support old code that looks at the input/textarea DOM nodes
+        return ReactDOM.findDOMNode(this.refs.textbox);
+    }
+
     handleDocumentClick(e) {
         if (!this.state.focused) {
             return;
@@ -143,26 +147,48 @@ export default class SuggestionBox extends React.Component {
     }
 
     render() {
+        const SuggestionList = this.props.listComponent;
+
         const newProps = Object.assign({}, this.props, {
             onFocus: this.handleFocus,
             onChange: this.handleChange,
             onKeyDown: this.handleKeyDown
         });
 
-        return (
-            <div>
+        let textbox = null;
+        if (this.props.type === 'input') {
+            textbox = (
                 <input
                     ref='textbox'
                     type='text'
                     {...newProps}
                 />
+            );
+        } else if (this.props.type === 'textarea') {
+            textbox = (
+                <textarea
+                    ref='textbox'
+                    {...newProps}
+                />
+            );
+        }
+
+        return (
+            <div>
+                {textbox}
                 <SuggestionList suggestionId={this.suggestionId} />
             </div>
         );
     }
 }
 
+SuggestionBox.defaultProps = {
+    type: 'input'
+};
+
 SuggestionBox.propTypes = {
+    listComponent: React.PropTypes.func.isRequired,
+    type: React.PropTypes.oneOf(['input', 'textarea']).isRequired,
     value: React.PropTypes.string.isRequired,
     onUserInput: React.PropTypes.func,
     providers: React.PropTypes.arrayOf(React.PropTypes.object),
-- 
cgit v1.2.3-1-g7c22

