From d293bc0b799a679cd27ed4ef6e818b0ca96998d9 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Wed, 8 Jul 2015 11:34:34 -0700
Subject: Implemented basic text formatting package using a modfied version of
 the marked js library.  Supports *bold*, _italics_, and `code`

---
 web/react/components/create_post.jsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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

diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index 9ca1d5388..3e1faba7d 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -224,6 +224,7 @@ module.exports = React.createClass({
                 </div>
             );
         }
+        var allowTextFormatting = config.AllowTextFormatting;
 
         var postError = null;
         if (this.state.postError) {
@@ -244,6 +245,10 @@ module.exports = React.createClass({
         if (postError) {
             postFooterClassName += ' has-error';
         }
+        var extraInfo = <MsgTyping channelId={this.state.channel_id} parentId='' />;
+        if (this.state.messageText.split(' ').length > 1 && allowTextFormatting) {
+            extraInfo = <span className='msg-typing'>_<em>italics</em>_ *<strong>bold</strong>* `<code className='code-info'>code</code>`</span>;
+        }
 
         return (
             <form id='create_post' ref='topDiv' role='form' onSubmit={this.handleSubmit}>
@@ -268,7 +273,7 @@ module.exports = React.createClass({
                         {postError}
                         {serverError}
                         {preview}
-                        <MsgTyping channelId={this.state.channelId} parentId=''/>
+                        {extraInfo}
                     </div>
                 </div>
             </form>
-- 
cgit v1.2.3-1-g7c22

