]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+accounts/account-about/account-about.component.ts
Handle markdown in account/video channel pages
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-about / account-about.component.ts
index c0e79375468b766c48ac8598226d9cd56b3d7743..2acf67a59ae85909159fd0fb80e46afafea181c4 100644 (file)
@@ -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')
   }