diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-18 11:19:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-18 11:19:10 +0200 |
commit | 53055a1124cbc2eaeeeeef21b19b0b46e96f23c5 (patch) | |
tree | d761c9928d2568937fad9a2316f7ad2b8b223f07 /client/src/app/+accounts | |
parent | 4d089429fe91ab7793b9b05010acb483d61345de (diff) | |
download | PeerTube-53055a1124cbc2eaeeeeef21b19b0b46e96f23c5.tar.gz PeerTube-53055a1124cbc2eaeeeeef21b19b0b46e96f23c5.tar.zst PeerTube-53055a1124cbc2eaeeeeef21b19b0b46e96f23c5.zip |
Handle markdown in account/video channel pages
Diffstat (limited to 'client/src/app/+accounts')
-rw-r--r-- | client/src/app/+accounts/account-about/account-about.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+accounts/account-about/account-about.component.ts | 12 |
2 files changed, 10 insertions, 4 deletions
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 @@ | |||
1 | <div *ngIf="account" class="row"> | 1 | <div *ngIf="account" class="row"> |
2 | <div class="block col-md-6 col-sm-12"> | 2 | <div class="block col-md-6 col-sm-12"> |
3 | <div i18n class="small-title">Description</div> | 3 | <div i18n class="small-title">Description</div> |
4 | <div class="content">{{ getAccountDescription() }}</div> | 4 | <div class="content" [innerHtml]="getAccountDescription()"></div> |
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <div class="block col-md-6 col-sm-12"> | 7 | <div class="block col-md-6 col-sm-12"> |
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' | |||
4 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { AccountService } from '@app/shared/account/account.service' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { Subscription } from 'rxjs' | 6 | import { Subscription } from 'rxjs' |
7 | import { MarkdownService } from '@app/videos/shared' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-account-about', | 10 | selector: 'my-account-about', |
@@ -12,19 +13,24 @@ import { Subscription } from 'rxjs' | |||
12 | }) | 13 | }) |
13 | export class AccountAboutComponent implements OnInit, OnDestroy { | 14 | export class AccountAboutComponent implements OnInit, OnDestroy { |
14 | account: Account | 15 | account: Account |
16 | descriptionHTML = '' | ||
15 | 17 | ||
16 | private accountSub: Subscription | 18 | private accountSub: Subscription |
17 | 19 | ||
18 | constructor ( | 20 | constructor ( |
19 | private route: ActivatedRoute, | 21 | private route: ActivatedRoute, |
20 | private i18n: I18n, | 22 | private i18n: I18n, |
21 | private accountService: AccountService | 23 | private accountService: AccountService, |
24 | private markdownService: MarkdownService | ||
22 | ) { } | 25 | ) { } |
23 | 26 | ||
24 | ngOnInit () { | 27 | ngOnInit () { |
25 | // Parent get the account for us | 28 | // Parent get the account for us |
26 | this.accountSub = this.accountService.accountLoaded | 29 | this.accountSub = this.accountService.accountLoaded |
27 | .subscribe(account => this.account = account) | 30 | .subscribe(account => { |
31 | this.account = account | ||
32 | this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.account.description) | ||
33 | }) | ||
28 | } | 34 | } |
29 | 35 | ||
30 | ngOnDestroy () { | 36 | ngOnDestroy () { |
@@ -32,7 +38,7 @@ export class AccountAboutComponent implements OnInit, OnDestroy { | |||
32 | } | 38 | } |
33 | 39 | ||
34 | getAccountDescription () { | 40 | getAccountDescription () { |
35 | if (this.account.description) return this.account.description | 41 | if (this.descriptionHTML) return this.descriptionHTML |
36 | 42 | ||
37 | return this.i18n('No description') | 43 | return this.i18n('No description') |
38 | } | 44 | } |