From 53055a1124cbc2eaeeeeef21b19b0b46e96f23c5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 18 Jun 2018 11:19:10 +0200 Subject: Handle markdown in account/video channel pages --- client/src/app/videos/+video-watch/modal/video-support.component.ts | 6 +----- client/src/app/videos/+video-watch/video-watch.component.ts | 5 ----- client/src/app/videos/shared/markdown.service.ts | 6 ++++-- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/+video-watch/modal/video-support.component.ts b/client/src/app/videos/+video-watch/modal/video-support.component.ts index f805215b9..c515298a0 100644 --- a/client/src/app/videos/+video-watch/modal/video-support.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-support.component.ts @@ -23,11 +23,7 @@ export class VideoSupportComponent { show () { this.modal.show() - if (this.video.support) { - this.videoHTMLSupport = this.markdownService.enhancedMarkdownToHTML(this.video.support) - } else { - this.videoHTMLSupport = '' - } + this.videoHTMLSupport = this.markdownService.enhancedMarkdownToHTML(this.video.support) } hide () { diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 6f6bd4e5d..8adf97d48 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -290,11 +290,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } private setVideoDescriptionHTML () { - if (!this.video.description) { - this.videoHTMLDescription = '' - return - } - this.videoHTMLDescription = this.markdownService.textMarkdownToHTML(this.video.description) } diff --git a/client/src/app/videos/shared/markdown.service.ts b/client/src/app/videos/shared/markdown.service.ts index 681140087..14eeba777 100644 --- a/client/src/app/videos/shared/markdown.service.ts +++ b/client/src/app/videos/shared/markdown.service.ts @@ -23,14 +23,16 @@ export class MarkdownService { } textMarkdownToHTML (markdown: string) { - const html = this.textMarkdownIt.render(markdown) + if (!markdown) return '' + const html = this.textMarkdownIt.render(markdown) return this.avoidTruncatedLinks(html) } enhancedMarkdownToHTML (markdown: string) { - const html = this.enhancedMarkdownIt.render(markdown) + if (!markdown) return '' + const html = this.enhancedMarkdownIt.render(markdown) return this.avoidTruncatedLinks(html) } -- cgit v1.2.3