Support basic markdown in comments

pull/2324/head
Chocobozzz 2019-12-09 11:21:39 +01:00
parent fe9d05310b
commit 1aa7543403
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 4 additions and 4 deletions

View File

@ -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' ]

View File

@ -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 ])
}