]> Untitled Git - lemmy.git/commitdiff
Use pre tags for view source to preserve newlines.
authorDessalines <tyhou13@gmx.com>
Wed, 16 Oct 2019 23:09:52 +0000 (16:09 -0700)
committerDessalines <tyhou13@gmx.com>
Wed, 16 Oct 2019 23:09:52 +0000 (16:09 -0700)
- Fixes #299

ui/src/components/comment-node.tsx
ui/src/components/post-listing.tsx

index 2cb556023ef815f25414ab40beea82ff900a9c0c..ce4bb51085a2b35df59084e294eb2e9b65ec6c65 100644 (file)
@@ -112,7 +112,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
           {this.state.showEdit && <CommentForm node={node} edit onReplyCancel={this.handleReplyCancel} disabled={this.props.locked} />}
           {!this.state.showEdit && !this.state.collapsed &&
             <div>
-              {this.state.viewSource ? <div>{this.commentUnlessRemoved}</div> : 
+              {this.state.viewSource ? <pre>{this.commentUnlessRemoved}</pre> : 
               <div className="md-div" dangerouslySetInnerHTML={mdToHtml(this.commentUnlessRemoved)} />
               }
               <ul class="list-inline mb-1 text-muted small font-weight-bold">
index 9db7cf4b68b95005dea95b00213c40dcb3c14a14..4468d188eef532220d6e6eaae21456dc0621cb22 100644 (file)
@@ -309,7 +309,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
           }
             {this.props.showBody && post.body &&
               <>
-                {this.state.viewSource ? <div>{post.body}</div> : 
+                {this.state.viewSource ? <pre>{post.body}</pre> : 
                 <div className="md-div" dangerouslySetInnerHTML={mdToHtml(post.body)} />
                 }
               </>