]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts
Only display homepage when components are loaded
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / custom-markup-container.component.ts
index 3d49c676875cd2048990fc21ca1bea8624325528..4e802b14dd0f20795294922dd20fc25d2645a460 100644 (file)
@@ -10,6 +10,8 @@ export class CustomMarkupContainerComponent implements OnChanges {
 
   @Input() content: string
 
+  displayed = false
+
   constructor (
     private customMarkupService: CustomMarkupService
   ) { }
@@ -19,8 +21,13 @@ export class CustomMarkupContainerComponent implements OnChanges {
   }
 
   private async buildElement () {
-    const element = await this.customMarkupService.buildElement(this.content)
-    this.contentWrapper.nativeElement.appendChild(element)
-  }
+    if (!this.content) return
+
+    const { rootElement, componentsLoaded } = await this.customMarkupService.buildElement(this.content)
+    this.contentWrapper.nativeElement.appendChild(rootElement)
 
+    await componentsLoaded
+
+    this.displayed = true
+  }
 }