diff options
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 | } | ||