aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/comment/video-comment.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-19 10:38:24 +0100
committerChocobozzz <me@florianbigard.com>2018-02-19 10:48:44 +0100
commit1263fc4e6eff9ba4bf4c706c6e37c2e556bf8eb5 (patch)
tree00c27b7e6a81dfc04a8cc86ba782df1e9d0c1db8 /client/src/app/videos/+video-watch/comment/video-comment.component.ts
parent3bb6c52645af84832212c99fdec04143e4230180 (diff)
downloadPeerTube-1263fc4e6eff9ba4bf4c706c6e37c2e556bf8eb5.tar.gz
PeerTube-1263fc4e6eff9ba4bf4c706c6e37c2e556bf8eb5.tar.zst
PeerTube-1263fc4e6eff9ba4bf4c706c6e37c2e556bf8eb5.zip
Improve comment highlighting
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.ts21
1 files changed, 15 insertions, 6 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 38e603d0d..7c664ca60 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,4 @@
1import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'
2import * as sanitizeHtml from 'sanitize-html' 2import * as sanitizeHtml from 'sanitize-html'
3import { Account as AccountInterface } from '../../../../../../shared/models/actors' 3import { Account as AccountInterface } from '../../../../../../shared/models/actors'
4import { UserRight } from '../../../../../../shared/models/users' 4import { UserRight } from '../../../../../../shared/models/users'
@@ -13,12 +13,13 @@ import { VideoComment } from './video-comment.model'
13 templateUrl: './video-comment.component.html', 13 templateUrl: './video-comment.component.html',
14 styleUrls: ['./video-comment.component.scss'] 14 styleUrls: ['./video-comment.component.scss']
15}) 15})
16export class VideoCommentComponent implements OnInit { 16export class VideoCommentComponent implements OnInit, OnChanges {
17 @Input() video: Video 17 @Input() video: Video
18 @Input() comment: VideoComment 18 @Input() comment: VideoComment
19 @Input() parentComments: VideoComment[] = [] 19 @Input() parentComments: VideoComment[] = []
20 @Input() commentTree: VideoCommentThreadTree 20 @Input() commentTree: VideoCommentThreadTree
21 @Input() inReplyToCommentId: number 21 @Input() inReplyToCommentId: number
22 @Input() highlightedComment = false
22 23
23 @Output() wantedToDelete = new EventEmitter<VideoComment>() 24 @Output() wantedToDelete = new EventEmitter<VideoComment>()
24 @Output() wantedToReply = new EventEmitter<VideoComment>() 25 @Output() wantedToReply = new EventEmitter<VideoComment>()
@@ -35,11 +36,11 @@ export class VideoCommentComponent implements OnInit {
35 } 36 }
36 37
37 ngOnInit () { 38 ngOnInit () {
38 this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { 39 this.init()
39 allowedTags: [ 'p', 'span' ] 40 }
40 })
41 41
42 this.newParentComments = this.parentComments.concat([ this.comment ]) 42 ngOnChanges () {
43 this.init()
43 } 44 }
44 45
45 onCommentReplyCreated (createdComment: VideoComment) { 46 onCommentReplyCreated (createdComment: VideoComment) {
@@ -86,4 +87,12 @@ export class VideoCommentComponent implements OnInit {
86 this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT) 87 this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT)
87 ) 88 )
88 } 89 }
90
91 private init () {
92 this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, {
93 allowedTags: [ 'p', 'span' ]
94 })
95
96 this.newParentComments = this.parentComments.concat([ this.comment ])
97 }
89} 98}