diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-16 16:21:42 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-12-17 09:45:02 +0100 |
commit | b29bf61dbd518e5cef0b2f564ddc8f8a0657d089 (patch) | |
tree | 86d41fb765ea529095d757e292213156cef7d899 /client/src/app/videos/+video-watch/comment/video-comment.component.ts | |
parent | d68ebf0b4a40f88e53a78de6b3109a41466fa7c6 (diff) | |
download | PeerTube-b29bf61dbd518e5cef0b2f564ddc8f8a0657d089.tar.gz PeerTube-b29bf61dbd518e5cef0b2f564ddc8f8a0657d089.tar.zst PeerTube-b29bf61dbd518e5cef0b2f564ddc8f8a0657d089.zip |
Provide native links for description timestamps, and re-clickability for these
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 | 14 |
1 files changed, 9 insertions, 5 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 d5e3ecc17..b2bf3ee1b 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, MarkdownService } 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', |
@@ -23,12 +23,12 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
23 | @Output() wantedToReply = new EventEmitter<VideoComment>() | 23 | @Output() wantedToReply = new EventEmitter<VideoComment>() |
24 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() | 24 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() |
25 | @Output() resetReply = new EventEmitter() | 25 | @Output() resetReply = new EventEmitter() |
26 | @Output() timestampClicked = new EventEmitter<number>() | ||
26 | 27 | ||
27 | sanitizedCommentHTML = '' | 28 | sanitizedCommentHTML = '' |
28 | newParentComments: VideoComment[] = [] | 29 | newParentComments: VideoComment[] = [] |
29 | 30 | ||
30 | constructor ( | 31 | constructor ( |
31 | private htmlRenderer: HtmlRendererService, | ||
32 | private markdownService: MarkdownService, | 32 | private markdownService: MarkdownService, |
33 | private authService: AuthService | 33 | private authService: AuthService |
34 | ) {} | 34 | ) {} |
@@ -78,8 +78,12 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
78 | this.resetReply.emit() | 78 | this.resetReply.emit() |
79 | } | 79 | } |
80 | 80 | ||
81 | handleTimestampClicked (timestamp: number) { | ||
82 | this.timestampClicked.emit(timestamp) | ||
83 | } | ||
84 | |||
81 | isRemovableByUser () { | 85 | isRemovableByUser () { |
82 | return this.isUserLoggedIn() && | 86 | return this.comment.account && this.isUserLoggedIn() && |
83 | ( | 87 | ( |
84 | this.user.account.id === this.comment.account.id || | 88 | this.user.account.id === this.comment.account.id || |
85 | this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT) | 89 | this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT) |
@@ -87,8 +91,8 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
87 | } | 91 | } |
88 | 92 | ||
89 | private async init () { | 93 | private async init () { |
90 | const safeHTML = await this.htmlRenderer.toSafeHtml(this.comment.text) | 94 | const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true) |
91 | this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(safeHTML) | 95 | this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html) |
92 | this.newParentComments = this.parentComments.concat([ this.comment ]) | 96 | this.newParentComments = this.parentComments.concat([ this.comment ]) |
93 | } | 97 | } |
94 | } | 98 | } |