diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-04 17:50:30 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-04 17:50:30 +0100 |
commit | 2890b615f31ab7d519d8be66b49ff8712df90c51 (patch) | |
tree | 4ad6bf366416a1cbc4d39bc8b7747f6d985b4d19 /client/src/app/videos/+video-watch/comment/video-comment.component.ts | |
parent | c3badc81fe3d78601fb278a7f28eeed63060d300 (diff) | |
download | PeerTube-2890b615f31ab7d519d8be66b49ff8712df90c51.tar.gz PeerTube-2890b615f31ab7d519d8be66b49ff8712df90c51.tar.zst PeerTube-2890b615f31ab7d519d8be66b49ff8712df90c51.zip |
Handle HTML is comments
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comment.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment.component.ts | 13 |
1 files changed, 11 insertions, 2 deletions
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 9bc9c8844..2ecc8a143 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 | |||
@@ -1,4 +1,5 @@ | |||
1 | import { Component, EventEmitter, Input, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
2 | import * as sanitizeHtml from 'sanitize-html' | ||
2 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 3 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' |
3 | import { UserRight } from '../../../../../../shared/models/users' | 4 | import { UserRight } from '../../../../../../shared/models/users' |
4 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | 5 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' |
@@ -12,7 +13,7 @@ import { VideoComment } from './video-comment.model' | |||
12 | templateUrl: './video-comment.component.html', | 13 | templateUrl: './video-comment.component.html', |
13 | styleUrls: ['./video-comment.component.scss'] | 14 | styleUrls: ['./video-comment.component.scss'] |
14 | }) | 15 | }) |
15 | export class VideoCommentComponent { | 16 | export class VideoCommentComponent implements OnInit { |
16 | @Input() video: Video | 17 | @Input() video: Video |
17 | @Input() comment: VideoComment | 18 | @Input() comment: VideoComment |
18 | @Input() commentTree: VideoCommentThreadTree | 19 | @Input() commentTree: VideoCommentThreadTree |
@@ -23,12 +24,20 @@ export class VideoCommentComponent { | |||
23 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() | 24 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() |
24 | @Output() resetReply = new EventEmitter() | 25 | @Output() resetReply = new EventEmitter() |
25 | 26 | ||
27 | sanitizedCommentHTML = '' | ||
28 | |||
26 | constructor (private authService: AuthService) {} | 29 | constructor (private authService: AuthService) {} |
27 | 30 | ||
28 | get user () { | 31 | get user () { |
29 | return this.authService.getUser() | 32 | return this.authService.getUser() |
30 | } | 33 | } |
31 | 34 | ||
35 | ngOnInit () { | ||
36 | this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { | ||
37 | allowedTags: [ 'p', 'span' ] | ||
38 | }) | ||
39 | } | ||
40 | |||
32 | onCommentReplyCreated (createdComment: VideoComment) { | 41 | onCommentReplyCreated (createdComment: VideoComment) { |
33 | if (!this.commentTree) { | 42 | if (!this.commentTree) { |
34 | this.commentTree = { | 43 | this.commentTree = { |