mirror of https://github.com/Chocobozzz/PeerTube
Correct break line display for re-draft comments
parent
61379e4311
commit
6a9498e37c
|
@ -183,7 +183,11 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
|
||||||
this.textareaElement.nativeElement.focus()
|
this.textareaElement.nativeElement.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scroll to textarea
|
||||||
this.textareaElement.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' })
|
this.textareaElement.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' })
|
||||||
|
|
||||||
|
// Use the native textarea autosize according to the text's break lines
|
||||||
|
this.textareaElement.nativeElement.dispatchEvent(new Event('input'))
|
||||||
})
|
})
|
||||||
|
|
||||||
this.form.patchValue({ text })
|
this.form.patchValue({ text })
|
||||||
|
|
|
@ -199,10 +199,13 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
this.inReplyToCommentId = commentToRedraft.inReplyToCommentId
|
this.inReplyToCommentId = commentToRedraft.inReplyToCommentId
|
||||||
|
|
||||||
|
// Display <br /> tag as a break line for editing
|
||||||
|
const commentToRedraftText = commentToRedraft.text.replace(/<br.?\/?>/g, '\r\n')
|
||||||
|
|
||||||
if (commentToRedraft.threadId === commentToRedraft.id) {
|
if (commentToRedraft.threadId === commentToRedraft.id) {
|
||||||
this.commentThreadRedraftValue = commentToRedraft.text
|
this.commentThreadRedraftValue = commentToRedraftText
|
||||||
} else {
|
} else {
|
||||||
this.commentReplyRedraftValue = commentToRedraft.text
|
this.commentReplyRedraftValue = commentToRedraftText
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue