From 110d463fece85e87a26aca48a6048ae0017a27b3 Mon Sep 17 00:00:00 2001 From: kimsible Date: Fri, 6 Nov 2020 22:37:01 +0100 Subject: Restore line feed for markdown lists support in comments --- .../src/app/+videos/+video-watch/comment/video-comment.component.ts | 4 +++- .../src/app/+videos/+video-watch/comment/video-comments.component.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'client/src/app/+videos') diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts index ac2a71aa6..3b3a5cc81 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts @@ -153,7 +153,9 @@ export class VideoCommentComponent implements OnInit, OnChanges { } private async init () { - const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true, true) + // Before HTML rendering restore line feed for markdown list compatibility + const commentText = this.comment.text.replace(//g, '\r\n') + const html = await this.markdownService.textMarkdownToHTML(commentText, true, true) this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html) this.newParentComments = this.parentComments.concat([ this.comment ]) diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts index 602bd8050..a4c651da5 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts @@ -199,7 +199,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { if (confirm) { this.inReplyToCommentId = commentToRedraft.inReplyToCommentId - // Display
tag as a break line for editing + // Restore line feed for editing const commentToRedraftText = commentToRedraft.text.replace(//g, '\r\n') if (commentToRedraft.threadId === commentToRedraft.id) { -- cgit v1.2.3