diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-19 14:52:27 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-19 14:52:27 +0100 |
commit | 789ba349318e7ff012590491e76087a1204cccd4 (patch) | |
tree | 69837d320c77260a188b9ee8f59505e540ad505e /client/src/app/shared/shared-custom-markup | |
parent | a4927884b224e3d4d78ff5db88cbb77bbdf8ee0b (diff) | |
download | PeerTube-789ba349318e7ff012590491e76087a1204cccd4.tar.gz PeerTube-789ba349318e7ff012590491e76087a1204cccd4.tar.zst PeerTube-789ba349318e7ff012590491e76087a1204cccd4.zip |
Support mailto links for custom markup
Diffstat (limited to 'client/src/app/shared/shared-custom-markup')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts | 20 |
1 files changed, 13 insertions, 7 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 index 4e802b14d..b2ee2d8f2 100644 --- 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 | |||
@@ -6,9 +6,9 @@ import { CustomMarkupService } from './custom-markup.service' | |||
6 | templateUrl: './custom-markup-container.component.html' | 6 | templateUrl: './custom-markup-container.component.html' |
7 | }) | 7 | }) |
8 | export class CustomMarkupContainerComponent implements OnChanges { | 8 | export class CustomMarkupContainerComponent implements OnChanges { |
9 | @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement> | 9 | @ViewChild('contentWrapper', { static: true }) contentWrapper: ElementRef<HTMLInputElement> |
10 | 10 | ||
11 | @Input() content: string | 11 | @Input() content: string | HTMLDivElement |
12 | 12 | ||
13 | displayed = false | 13 | displayed = false |
14 | 14 | ||
@@ -17,17 +17,23 @@ export class CustomMarkupContainerComponent implements OnChanges { | |||
17 | ) { } | 17 | ) { } |
18 | 18 | ||
19 | async ngOnChanges () { | 19 | async ngOnChanges () { |
20 | await this.buildElement() | 20 | await this.rebuild() |
21 | } | 21 | } |
22 | 22 | ||
23 | private async buildElement () { | 23 | private async rebuild () { |
24 | if (!this.content) return | 24 | if (this.content instanceof HTMLDivElement) { |
25 | return this.loadElement(this.content) | ||
26 | } | ||
25 | 27 | ||
26 | const { rootElement, componentsLoaded } = await this.customMarkupService.buildElement(this.content) | 28 | const { rootElement, componentsLoaded } = await this.customMarkupService.buildElement(this.content) |
27 | this.contentWrapper.nativeElement.appendChild(rootElement) | ||
28 | |||
29 | await componentsLoaded | 29 | await componentsLoaded |
30 | 30 | ||
31 | return this.loadElement(rootElement) | ||
32 | } | ||
33 | |||
34 | private loadElement (el: HTMLDivElement) { | ||
35 | this.contentWrapper.nativeElement.appendChild(el) | ||
36 | |||
31 | this.displayed = true | 37 | this.displayed = true |
32 | } | 38 | } |
33 | } | 39 | } |