From d293bc0b799a679cd27ed4ef6e818b0ca96998d9 Mon Sep 17 00:00:00 2001 From: Reed Garmsen 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/post_right.jsx | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'web/react/components/post_right.jsx') diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx index ad8b54012..10a9400f5 100644 --- a/web/react/components/post_right.jsx +++ b/web/react/components/post_right.jsx @@ -56,6 +56,7 @@ RhsHeaderPost = React.createClass({ RootPost = React.createClass({ render: function() { + var allowTextFormatting = config.AllowTextFormatting; var post = this.props.post; var message = utils.textToJsx(post.message); var isOwner = UserStore.getCurrentId() == post.user_id; @@ -76,6 +77,11 @@ RootPost = React.createClass({ channelName = (channel.type === 'D') ? "Private Message" : channel.display_name; } + var messageHolder =

{message}

; + if (allowTextFormatting) { + messageHolder =
{message}
; + } + return (
{ channelName }
@@ -101,7 +107,7 @@ RootPost = React.createClass({
-

{message}

+ {messageHolder} { post.filenames && post.filenames.length > 0 ? {message}

; + if (allowTextFormatting) { + messageHolder =
{message}
; + } + return (
@@ -160,7 +172,7 @@ CommentPost = React.createClass({
-

{message}

+ {messageHolder} { post.filenames && post.filenames.length > 0 ?
- +
{ posts_array.map(function(cpost) { - return + return })}
-- cgit v1.2.3-1-g7c22 From e02883baf2fd2a0cfc21bd557bc0ecc69afd707c Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Mon, 10 Aug 2015 16:51:59 -0700 Subject: Cosmetic refactoring of post_body.jsx --- web/react/components/post_right.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/react/components/post_right.jsx') diff --git a/web/react/components/post_right.jsx b/web/react/components/post_right.jsx index 10a9400f5..19e4cf67a 100644 --- a/web/react/components/post_right.jsx +++ b/web/react/components/post_right.jsx @@ -286,8 +286,9 @@ module.exports = React.createClass({ } var rootPostKey = root_post.id - if (root_post.lastEditDate != undefined) + if (root_post.lastEditDate) { rootPostKey += root_post.lastEditDate; + } var posts_array = []; @@ -295,8 +296,9 @@ module.exports = React.createClass({ var cpost = post_list.posts[postId]; if (cpost.root_id == root_post.id) { var cpostKey = cpost.id - if (cpost.lastEditDate != undefined) + if (cpost.lastEditDate) { cpostKey += cpost.lastEditDate; + } cpost.cpostKey = cpostKey; posts_array.push(cpost); -- cgit v1.2.3-1-g7c22