From 1aa7543403f278ad88d64e368e77bcb3efa58dd7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 9 Dec 2019 11:21:39 +0100 Subject: Support basic markdown in comments --- client/src/app/shared/renderer/html-renderer.service.ts | 2 +- .../src/app/videos/+video-watch/comment/video-comment.component.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'client') 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 { const html = this.linkifier.linkify(text) return sanitizeHtml(html, { - allowedTags: [ 'a', 'p', 'span', 'br' ], + allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], allowedSchemes: [ 'http', 'https' ], allowedAttributes: { '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 import { AuthService } from '../../../core/auth' import { Video } from '../../../shared/video/video.model' import { VideoComment } from './video-comment.model' -import { HtmlRendererService } from '@app/shared/renderer' +import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-video-comment', @@ -28,7 +28,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { newParentComments: VideoComment[] = [] constructor ( - private htmlRenderer: HtmlRendererService, + private markdownService: MarkdownService, private authService: AuthService ) {} @@ -86,7 +86,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { } private async init () { - this.sanitizedCommentHTML = await this.htmlRenderer.toSafeHtml(this.comment.text) + this.sanitizedCommentHTML = await this.markdownService.textMarkdownToHTML(this.comment.text, true) this.newParentComments = this.parentComments.concat([ this.comment ]) } -- cgit v1.2.3