]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts
Fix peertube container in markdown preview
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / custom-markup-container.component.ts
CommitLineData
8ee25e17
C
1import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core'
2import { CustomMarkupService } from './custom-markup.service'
3
4@Component({
5 selector: 'my-custom-markup-container',
24893b52 6 templateUrl: './custom-markup-container.component.html'
8ee25e17
C
7})
8export 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}