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 --- .../app/+accounts/account-about/account-about.component.html | 2 +- .../app/+accounts/account-about/account-about.component.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'client/src/app/+accounts') diff --git a/client/src/app/+accounts/account-about/account-about.component.html b/client/src/app/+accounts/account-about/account-about.component.html index b178f5cc8..f857e5a52 100644 --- a/client/src/app/+accounts/account-about/account-about.component.html +++ b/client/src/app/+accounts/account-about/account-about.component.html @@ -1,7 +1,7 @@
Description
-
{{ getAccountDescription() }}
+
diff --git a/client/src/app/+accounts/account-about/account-about.component.ts b/client/src/app/+accounts/account-about/account-about.component.ts index c0e793754..2acf67a59 100644 --- a/client/src/app/+accounts/account-about/account-about.component.ts +++ b/client/src/app/+accounts/account-about/account-about.component.ts @@ -4,6 +4,7 @@ import { Account } from '@app/shared/account/account.model' import { AccountService } from '@app/shared/account/account.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { Subscription } from 'rxjs' +import { MarkdownService } from '@app/videos/shared' @Component({ selector: 'my-account-about', @@ -12,19 +13,24 @@ import { Subscription } from 'rxjs' }) export class AccountAboutComponent implements OnInit, OnDestroy { account: Account + descriptionHTML = '' private accountSub: Subscription constructor ( private route: ActivatedRoute, private i18n: I18n, - private accountService: AccountService + private accountService: AccountService, + private markdownService: MarkdownService ) { } ngOnInit () { // Parent get the account for us this.accountSub = this.accountService.accountLoaded - .subscribe(account => this.account = account) + .subscribe(account => { + this.account = account + this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.account.description) + }) } ngOnDestroy () { @@ -32,7 +38,7 @@ export class AccountAboutComponent implements OnInit, OnDestroy { } getAccountDescription () { - if (this.account.description) return this.account.description + if (this.descriptionHTML) return this.descriptionHTML return this.i18n('No description') } -- cgit v1.2.3