aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+about
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-31 11:33:49 +0200
committerChocobozzz <me@florianbigard.com>2021-05-31 11:33:49 +0200
commit8ee25e17b88b970703f4df9e74cb4726bbffd837 (patch)
tree450d73715c747c82efe6c919ebeda6411c01c5e0 /client/src/app/+about
parent15f35256af15b97d2298cc44e76ffcafe73a1c88 (diff)
downloadPeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.gz
PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.zst
PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.zip
Add ability to set custom markdown in description
Diffstat (limited to 'client/src/app/+about')
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.html4
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.ts20
-rw-r--r--client/src/app/+about/about.module.ts4
3 files changed, 21 insertions, 7 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.html b/client/src/app/+about/about-instance/about-instance.component.html
index 1f372090e..29dfd89fb 100644
--- a/client/src/app/+about/about-instance/about-instance.component.html
+++ b/client/src/app/+about/about-instance/about-instance.component.html
@@ -91,7 +91,7 @@
91 91
92 <div class="anchor" id="information"></div> 92 <div class="anchor" id="information"></div>
93 <a 93 <a
94 *ngIf="html.description" 94 *ngIf="descriptionContent"
95 class="anchor-link" 95 class="anchor-link"
96 routerLink="/about/instance" 96 routerLink="/about/instance"
97 fragment="information" 97 fragment="information"
@@ -113,7 +113,7 @@
113 <h3 i18n class="section-title">Description</h3> 113 <h3 i18n class="section-title">Description</h3>
114 </a> 114 </a>
115 115
116 <div [innerHTML]="html.description"></div> 116 <my-custom-markup-container [content]="descriptionContent"></my-custom-markup-container>
117 </div> 117 </div>
118 118
119 <div class="anchor" id="moderation"></div> 119 <div class="anchor" id="moderation"></div>
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts
index 7eb382a46..2e0996429 100644
--- a/client/src/app/+about/about-instance/about-instance.component.ts
+++ b/client/src/app/+about/about-instance/about-instance.component.ts
@@ -1,11 +1,12 @@
1import { ViewportScroller } from '@angular/common' 1import { ViewportScroller } from '@angular/common'
2import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' 2import { AfterViewChecked, Component, ElementRef, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute } from '@angular/router' 3import { ActivatedRoute } from '@angular/router'
4import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' 4import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
5import { Notifier } from '@app/core' 5import { Notifier } from '@app/core'
6import { copyToClipboard } from '../../../root-helpers/utils' 6import { CustomMarkupService } from '@app/shared/shared-custom-markup'
7import { InstanceService } from '@app/shared/shared-instance' 7import { InstanceService } from '@app/shared/shared-instance'
8import { ServerConfig } from '@shared/models' 8import { About, ServerConfig } from '@shared/models'
9import { copyToClipboard } from '../../../root-helpers/utils'
9import { ResolverData } from './about-instance.resolver' 10import { ResolverData } from './about-instance.resolver'
10 11
11@Component({ 12@Component({
@@ -14,12 +15,13 @@ import { ResolverData } from './about-instance.resolver'
14 styleUrls: [ './about-instance.component.scss' ] 15 styleUrls: [ './about-instance.component.scss' ]
15}) 16})
16export class AboutInstanceComponent implements OnInit, AfterViewChecked { 17export class AboutInstanceComponent implements OnInit, AfterViewChecked {
18 @ViewChild('descriptionWrapper') descriptionWrapper: ElementRef<HTMLInputElement>
17 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent 19 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent
18 20
19 shortDescription = '' 21 shortDescription = ''
22 descriptionContent: string
20 23
21 html = { 24 html = {
22 description: '',
23 terms: '', 25 terms: '',
24 codeOfConduct: '', 26 codeOfConduct: '',
25 moderationInformation: '', 27 moderationInformation: '',
@@ -40,6 +42,7 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
40 private lastScrollHash: string 42 private lastScrollHash: string
41 43
42 constructor ( 44 constructor (
45 private customMarkupService: CustomMarkupService,
43 private viewportScroller: ViewportScroller, 46 private viewportScroller: ViewportScroller,
44 private route: ActivatedRoute, 47 private route: ActivatedRoute,
45 private notifier: Notifier, 48 private notifier: Notifier,
@@ -67,9 +70,12 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
67 this.categories = categories 70 this.categories = categories
68 71
69 this.shortDescription = about.instance.shortDescription 72 this.shortDescription = about.instance.shortDescription
73 this.descriptionContent = about.instance.description
70 74
71 this.html = await this.instanceService.buildHtml(about) 75 this.html = await this.instanceService.buildHtml(about)
72 76
77 await this.injectDescription(about)
78
73 this.initialized = true 79 this.initialized = true
74 } 80 }
75 81
@@ -90,4 +96,10 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
90 copyToClipboard(link) 96 copyToClipboard(link)
91 this.notifier.success(link, $localize `Link copied`) 97 this.notifier.success(link, $localize `Link copied`)
92 } 98 }
99
100 private async injectDescription (about: About) {
101 const element = await this.customMarkupService.buildElement(about.instance.description)
102
103 this.descriptionWrapper.nativeElement.appendChild(element)
104 }
93} 105}
diff --git a/client/src/app/+about/about.module.ts b/client/src/app/+about/about.module.ts
index 1aca14033..dfea52fb8 100644
--- a/client/src/app/+about/about.module.ts
+++ b/client/src/app/+about/about.module.ts
@@ -5,6 +5,7 @@ import { AboutInstanceResolver } from '@app/+about/about-instance/about-instance
5import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' 5import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
6import { AboutPeertubeContributorsComponent } from '@app/+about/about-peertube/about-peertube-contributors.component' 6import { AboutPeertubeContributorsComponent } from '@app/+about/about-peertube/about-peertube-contributors.component'
7import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component' 7import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component'
8import { SharedCustomMarkupModule } from '@app/shared/shared-custom-markup'
8import { SharedFormModule } from '@app/shared/shared-forms' 9import { SharedFormModule } from '@app/shared/shared-forms'
9import { SharedGlobalIconModule } from '@app/shared/shared-icons' 10import { SharedGlobalIconModule } from '@app/shared/shared-icons'
10import { SharedInstanceModule } from '@app/shared/shared-instance' 11import { SharedInstanceModule } from '@app/shared/shared-instance'
@@ -19,7 +20,8 @@ import { AboutComponent } from './about.component'
19 SharedMainModule, 20 SharedMainModule,
20 SharedFormModule, 21 SharedFormModule,
21 SharedInstanceModule, 22 SharedInstanceModule,
22 SharedGlobalIconModule 23 SharedGlobalIconModule,
24 SharedCustomMarkupModule
23 ], 25 ],
24 26
25 declarations: [ 27 declarations: [