From c14aeab8efcc431f4dda9184a7c07a8f3bdcd047 Mon Sep 17 00:00:00 2001 From: Jason <84899178+jasonhenriquez@users.noreply.github.com> Date: Mon, 20 Sep 2021 09:25:50 +0000 Subject: [PATCH] Fixes new lines not being displayed in comments (#1719) --- .../watch-video-comments/watch-video-comments.css | 1 + .../components/watch-video-comments/watch-video-comments.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.css b/src/renderer/components/watch-video-comments/watch-video-comments.css index 3005ff80..73ce59bd 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.css +++ b/src/renderer/components/watch-video-comments/watch-video-comments.css @@ -50,6 +50,7 @@ } .commentText { + white-space: pre-wrap; font-size: 14px; margin-top: -10px; margin-left: 70px; diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.js b/src/renderer/components/watch-video-comments/watch-video-comments.js index 04ccd2ea..b1d85968 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -264,7 +264,7 @@ export default Vue.extend({ if (this.hideCommentLikes) { comment.likes = null } - comment.text = autolinker.link(comment.text.replace(/(<([^>]+)>)/ig, '')) + comment.text = autolinker.link(comment.text.replace(/(<(?!br>)([^>]+)>)/ig, '')) return comment }) @@ -296,7 +296,7 @@ export default Vue.extend({ } else { comment.likes = comment.likeCount } - comment.text = autolinker.link(comment.content.replace(/(<([^>]+)>)/ig, '')) + comment.text = autolinker.link(comment.content.replace(/(<(?!br>)([^>]+)>)/ig, '')) comment.dataType = 'invidious' if (typeof (comment.replies) !== 'undefined' && typeof (comment.replies.replyCount) !== 'undefined') { @@ -362,7 +362,7 @@ export default Vue.extend({ } else { comment.likes = comment.likeCount } - comment.text = autolinker.link(comment.content.replace(/(<([^>]+)>)/ig, '')) + comment.text = autolinker.link(comment.content.replace(/(<(?!br>)([^>]+)>)/ig, '')) comment.time = comment.publishedText comment.dataType = 'invidious' comment.numReplies = 0