mirror of https://github.com/Chocobozzz/PeerTube
Support basic markdown in comments
parent
fe9d05310b
commit
1aa7543403
|
@ -16,7 +16,7 @@ export class HtmlRendererService {
|
|||
const html = this.linkifier.linkify(text)
|
||||
|
||||
return sanitizeHtml(html, {
|
||||
allowedTags: [ 'a', 'p', 'span', 'br' ],
|
||||
allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
|
||||
allowedSchemes: [ 'http', 'https' ],
|
||||
allowedAttributes: {
|
||||
'a': [ 'href', 'class', 'target' ]
|
||||
|
|
|
@ -4,7 +4,7 @@ import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/v
|
|||
import { AuthService } from '../../../core/auth'
|
||||
import { Video } from '../../../shared/video/video.model'
|
||||
import { VideoComment } from './video-comment.model'
|
||||
import { HtmlRendererService } from '@app/shared/renderer'
|
||||
import { MarkdownService } from '@app/shared/renderer'
|
||||
|
||||
@Component({
|
||||
selector: 'my-video-comment',
|
||||
|
@ -28,7 +28,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
|
|||
newParentComments: VideoComment[] = []
|
||||
|
||||
constructor (
|
||||
private htmlRenderer: HtmlRendererService,
|
||||
private markdownService: MarkdownService,
|
||||
private authService: AuthService
|
||||
) {}
|
||||
|
||||
|
@ -86,7 +86,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
|
|||
}
|
||||
|
||||
private async init () {
|
||||
this.sanitizedCommentHTML = await this.htmlRenderer.toSafeHtml(this.comment.text)
|
||||
this.sanitizedCommentHTML = await this.markdownService.textMarkdownToHTML(this.comment.text, true)
|
||||
|
||||
this.newParentComments = this.parentComments.concat([ this.comment ])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue