diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-31 11:33:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-31 11:33:49 +0200 |
commit | 8ee25e17b88b970703f4df9e74cb4726bbffd837 (patch) | |
tree | 450d73715c747c82efe6c919ebeda6411c01c5e0 /client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts | |
parent | 15f35256af15b97d2298cc44e76ffcafe73a1c88 (diff) | |
download | PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.gz PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.zst PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.zip |
Add ability to set custom markdown in description
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts new file mode 100644 index 000000000..3d49c6768 --- /dev/null +++ b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts | |||
@@ -0,0 +1,26 @@ | |||
1 | import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core' | ||
2 | import { CustomMarkupService } from './custom-markup.service' | ||
3 | |||
4 | @Component({ | ||
5 | selector: 'my-custom-markup-container', | ||
6 | templateUrl: './custom-markup-container.component.html' | ||
7 | }) | ||
8 | export class CustomMarkupContainerComponent implements OnChanges { | ||
9 | @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement> | ||
10 | |||
11 | @Input() content: string | ||
12 | |||
13 | constructor ( | ||
14 | private customMarkupService: CustomMarkupService | ||
15 | ) { } | ||
16 | |||
17 | async ngOnChanges () { | ||
18 | await this.buildElement() | ||
19 | } | ||
20 | |||
21 | private async buildElement () { | ||
22 | const element = await this.customMarkupService.buildElement(this.content) | ||
23 | this.contentWrapper.nativeElement.appendChild(element) | ||
24 | } | ||
25 | |||
26 | } | ||