diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-07-08 11:34:34 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-08-12 11:19:42 -0700 |
commit | d293bc0b799a679cd27ed4ef6e818b0ca96998d9 (patch) | |
tree | 6b12bb2d447cbe9cf24f0ea66ec096e6233c87d7 /web/react/components/create_comment.jsx | |
parent | 95e6626f9f59b876479d8267b6c95105345e661d (diff) | |
download | chat-d293bc0b799a679cd27ed4ef6e818b0ca96998d9.tar.gz chat-d293bc0b799a679cd27ed4ef6e818b0ca96998d9.tar.bz2 chat-d293bc0b799a679cd27ed4ef6e818b0ca96998d9.zip |
Implemented basic text formatting package using a modfied version of the marked js library. Supports *bold*, _italics_, and `code`
Diffstat (limited to 'web/react/components/create_comment.jsx')
-rw-r--r-- | web/react/components/create_comment.jsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx index 78e06c532..a0a018025 100644 --- a/web/react/components/create_comment.jsx +++ b/web/react/components/create_comment.jsx @@ -184,6 +184,7 @@ module.exports = React.createClass({ </div> ); } + var allowTextFormatting = config.AllowTextFormatting; var postError = null; if (this.state.postError) { @@ -204,6 +205,10 @@ module.exports = React.createClass({ if (postError) { postFooterClassName += ' has-error'; } + var extraInfo = <MsgTyping channelId={this.props.channelId} parentId={this.props.rootId} />; + if (this.state.messageText.split(' ').length > 1 && allowTextFormatting) { + extraInfo = <span className='msg-format-help'>_<em>italics</em>_ *<strong>bold</strong>* `<code className='code-info'>code</code>`</span>; + } return ( <form onSubmit={this.handleSubmit}> @@ -224,7 +229,7 @@ module.exports = React.createClass({ onFileUpload={this.handleFileUploadComplete} onUploadError={this.handleUploadError} /> </div> - <MsgTyping channelId={this.props.channelId} parentId={this.props.rootId} /> + {extraInfo} <div className={postFooterClassName}> <input type='button' className='btn btn-primary comment-btn pull-right' value='Add Comment' onClick={this.handleSubmit} /> {postError} |