Implemented basic text formatting package using a modfied version of the marked js library. Supports *bold*, _italics_, and code

Этот коммит содержится в:
Reed Garmsen
2015-07-08 11:34:34 -07:00
родитель 95e6626f9f
Коммит d293bc0b79
21 изменённых файлов: 2387 добавлений и 42 удалений

Просмотреть файл

@@ -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}