diff options
Diffstat (limited to 'client/src/app/+about')
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 @@ | |||
1 | import { ViewportScroller } from '@angular/common' | 1 | import { ViewportScroller } from '@angular/common' |
2 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' | 2 | import { AfterViewChecked, Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute } from '@angular/router' | 3 | import { ActivatedRoute } from '@angular/router' |
4 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' | 4 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' |
5 | import { Notifier } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | import { copyToClipboard } from '../../../root-helpers/utils' | 6 | import { CustomMarkupService } from '@app/shared/shared-custom-markup' |
7 | import { InstanceService } from '@app/shared/shared-instance' | 7 | import { InstanceService } from '@app/shared/shared-instance' |
8 | import { ServerConfig } from '@shared/models' | 8 | import { About, ServerConfig } from '@shared/models' |
9 | import { copyToClipboard } from '../../../root-helpers/utils' | ||
9 | import { ResolverData } from './about-instance.resolver' | 10 | import { 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 | }) |
16 | export class AboutInstanceComponent implements OnInit, AfterViewChecked { | 17 | export 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 | |||
5 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' | 5 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' |
6 | import { AboutPeertubeContributorsComponent } from '@app/+about/about-peertube/about-peertube-contributors.component' | 6 | import { AboutPeertubeContributorsComponent } from '@app/+about/about-peertube/about-peertube-contributors.component' |
7 | import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component' | 7 | import { AboutPeertubeComponent } from '@app/+about/about-peertube/about-peertube.component' |
8 | import { SharedCustomMarkupModule } from '@app/shared/shared-custom-markup' | ||
8 | import { SharedFormModule } from '@app/shared/shared-forms' | 9 | import { SharedFormModule } from '@app/shared/shared-forms' |
9 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' | 10 | import { SharedGlobalIconModule } from '@app/shared/shared-icons' |
10 | import { SharedInstanceModule } from '@app/shared/shared-instance' | 11 | import { 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: [ |