]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts
2ecdc0243dbe5833e11f3f55ab0f969722956a0a
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / custom-markup-container.component.ts
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 styleUrls: [ './custom-markup-container.component.scss' ]
8 })
9 export class CustomMarkupContainerComponent implements OnChanges {
10 @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>
11
12 @Input() content: string
13
14 constructor (
15 private customMarkupService: CustomMarkupService
16 ) { }
17
18 async ngOnChanges () {
19 await this.buildElement()
20 }
21
22 private async buildElement () {
23 const element = await this.customMarkupService.buildElement(this.content)
24 this.contentWrapper.nativeElement.appendChild(element)
25 }
26
27 }