aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKimsible <2324615-kimsible@users.noreply.gitlab.com>2020-11-06 17:40:40 +0100
committerRigel Kent <par@rigelk.eu>2020-11-06 18:14:15 +0100
commit6a9498e37cbda01414b8accf3fdcac410f893500 (patch)
tree24fcef83cec2da4acb03002164418ef55d60c7f9
parent61379e431115ab9d7c200852afcccf6ab94064d5 (diff)
downloadPeerTube-6a9498e37cbda01414b8accf3fdcac410f893500.tar.gz
PeerTube-6a9498e37cbda01414b8accf3fdcac410f893500.tar.zst
PeerTube-6a9498e37cbda01414b8accf3fdcac410f893500.zip
Correct break line display for re-draft comments
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts4
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comments.component.ts7
2 files changed, 9 insertions, 2 deletions
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
index c1d0032cc..d746a614b 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts
@@ -183,7 +183,11 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
183 this.textareaElement.nativeElement.focus() 183 this.textareaElement.nativeElement.focus()
184 } 184 }
185 185
186 // Scroll to textarea
186 this.textareaElement.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' }) 187 this.textareaElement.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' })
188
189 // Use the native textarea autosize according to the text's break lines
190 this.textareaElement.nativeElement.dispatchEvent(new Event('input'))
187 }) 191 })
188 192
189 this.form.patchValue({ text }) 193 this.form.patchValue({ text })
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 79627b1af..602bd8050 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,10 +199,13 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
199 if (confirm) { 199 if (confirm) {
200 this.inReplyToCommentId = commentToRedraft.inReplyToCommentId 200 this.inReplyToCommentId = commentToRedraft.inReplyToCommentId
201 201
202 // Display <br /> tag as a break line for editing
203 const commentToRedraftText = commentToRedraft.text.replace(/<br.?\/?>/g, '\r\n')
204
202 if (commentToRedraft.threadId === commentToRedraft.id) { 205 if (commentToRedraft.threadId === commentToRedraft.id) {
203 this.commentThreadRedraftValue = commentToRedraft.text 206 this.commentThreadRedraftValue = commentToRedraftText
204 } else { 207 } else {
205 this.commentReplyRedraftValue = commentToRedraft.text 208 this.commentReplyRedraftValue = commentToRedraftText
206 } 209 }
207 210
208 } 211 }