diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-09 11:21:39 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-09 11:21:39 +0100 |
commit | 1aa7543403f278ad88d64e368e77bcb3efa58dd7 (patch) | |
tree | 4ff1c2fe27380d6afa3614193547c3f90b277796 /client/src/app | |
parent | fe9d05310bda71480a6d2bfbccc4ac80939754c0 (diff) | |
download | PeerTube-1aa7543403f278ad88d64e368e77bcb3efa58dd7.tar.gz PeerTube-1aa7543403f278ad88d64e368e77bcb3efa58dd7.tar.zst PeerTube-1aa7543403f278ad88d64e368e77bcb3efa58dd7.zip |
Support basic markdown in comments
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/shared/renderer/html-renderer.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment.component.ts | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/client/src/app/shared/renderer/html-renderer.service.ts b/client/src/app/shared/renderer/html-renderer.service.ts index 28ef51e72..94a8aa4c6 100644 --- a/client/src/app/shared/renderer/html-renderer.service.ts +++ b/client/src/app/shared/renderer/html-renderer.service.ts | |||
@@ -16,7 +16,7 @@ export class HtmlRendererService { | |||
16 | const html = this.linkifier.linkify(text) | 16 | const html = this.linkifier.linkify(text) |
17 | 17 | ||
18 | return sanitizeHtml(html, { | 18 | return sanitizeHtml(html, { |
19 | allowedTags: [ 'a', 'p', 'span', 'br' ], | 19 | allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], |
20 | allowedSchemes: [ 'http', 'https' ], | 20 | allowedSchemes: [ 'http', 'https' ], |
21 | allowedAttributes: { | 21 | allowedAttributes: { |
22 | 'a': [ 'href', 'class', 'target' ] | 22 | 'a': [ 'href', 'class', 'target' ] |
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 4d3c049a1..23ff20aad 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 | |||
@@ -4,7 +4,7 @@ import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/v | |||
4 | import { AuthService } from '../../../core/auth' | 4 | import { AuthService } from '../../../core/auth' |
5 | import { Video } from '../../../shared/video/video.model' | 5 | import { Video } from '../../../shared/video/video.model' |
6 | import { VideoComment } from './video-comment.model' | 6 | import { VideoComment } from './video-comment.model' |
7 | import { HtmlRendererService } from '@app/shared/renderer' | 7 | import { MarkdownService } from '@app/shared/renderer' |
8 | 8 | ||
9 | @Component({ | 9 | @Component({ |
10 | selector: 'my-video-comment', | 10 | selector: 'my-video-comment', |
@@ -28,7 +28,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
28 | newParentComments: VideoComment[] = [] | 28 | newParentComments: VideoComment[] = [] |
29 | 29 | ||
30 | constructor ( | 30 | constructor ( |
31 | private htmlRenderer: HtmlRendererService, | 31 | private markdownService: MarkdownService, |
32 | private authService: AuthService | 32 | private authService: AuthService |
33 | ) {} | 33 | ) {} |
34 | 34 | ||
@@ -86,7 +86,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
86 | } | 86 | } |
87 | 87 | ||
88 | private async init () { | 88 | private async init () { |
89 | this.sanitizedCommentHTML = await this.htmlRenderer.toSafeHtml(this.comment.text) | 89 | this.sanitizedCommentHTML = await this.markdownService.textMarkdownToHTML(this.comment.text, true) |
90 | 90 | ||
91 | this.newParentComments = this.parentComments.concat([ this.comment ]) | 91 | this.newParentComments = this.parentComments.concat([ this.comment ]) |
92 | } | 92 | } |