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-20 11:04:21 +0100
committerChocobozzz <me@florianbigard.com>2018-02-20 11:04:21 +0100
commit3d9eaae318670986fedab257b8be344c9b43d8d5 (patch)
tree6aaa8ff8d5fd7d162e05147eb02f3175ab8c933c /client/src/app/videos/+video-watch/comment/video-comment.component.ts
parent5de8a55abce53108bc1024f1194457c6528bd11e (diff)
downloadPeerTube-3d9eaae318670986fedab257b8be344c9b43d8d5.tar.gz
PeerTube-3d9eaae318670986fedab257b8be344c9b43d8d5.tar.zst
PeerTube-3d9eaae318670986fedab257b8be344c9b43d8d5.zip
Add links support in 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.ts12
1 files changed, 10 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 9176de80f..0224132ac 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 @@
1import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'
2import { MarkdownService } from '@app/videos/shared'
2import * as sanitizeHtml from 'sanitize-html' 3import * as sanitizeHtml from 'sanitize-html'
3import { Account as AccountInterface } from '../../../../../../shared/models/actors' 4import { Account as AccountInterface } from '../../../../../../shared/models/actors'
4import { UserRight } from '../../../../../../shared/models/users' 5import { UserRight } from '../../../../../../shared/models/users'
@@ -29,7 +30,10 @@ export class VideoCommentComponent implements OnInit, OnChanges {
29 sanitizedCommentHTML = '' 30 sanitizedCommentHTML = ''
30 newParentComments = [] 31 newParentComments = []
31 32
32 constructor (private authService: AuthService) {} 33 constructor (
34 private authService: AuthService,
35 private markdownService: MarkdownService
36 ) {}
33 37
34 get user () { 38 get user () {
35 return this.authService.getUser() 39 return this.authService.getUser()
@@ -90,9 +94,13 @@ export class VideoCommentComponent implements OnInit, OnChanges {
90 94
91 private init () { 95 private init () {
92 this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { 96 this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, {
93 allowedTags: [ 'p', 'span', 'br' ] 97 allowedTags: [ 'a', 'p', 'span', 'br' ],
98 allowedSchemes: [ 'http', 'https' ]
94 }) 99 })
95 100
101 // Convert possible markdown to html
102 this.sanitizedCommentHTML = this.markdownService.linkify(this.comment.text)
103
96 this.newParentComments = this.parentComments.concat([ this.comment ]) 104 this.newParentComments = this.parentComments.concat([ this.comment ])
97 } 105 }
98} 106}