]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts
Create peertube-container html tag
[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',
f7894f09
C
6 templateUrl: './custom-markup-container.component.html',
7 styleUrls: [ './custom-markup-container.component.scss' ]
8ee25e17
C
8})
9export 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}