]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-watch/modal/video-support.component.ts
Add to playlist dropdown
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / modal / video-support.component.ts
index f805215b98ab9e22e6ff01f31520752ebed26d60..5e7afa012b4f6a2285c8bc6d1b4a115d42a0cb77 100644 (file)
@@ -1,8 +1,7 @@
 import { Component, Input, ViewChild } from '@angular/core'
-import { MarkdownService } from '@app/videos/shared'
-
-import { ModalDirective } from 'ngx-bootstrap/modal'
 import { VideoDetails } from '../../../shared/video/video-details.model'
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
+import { MarkdownService } from '@app/shared/renderer'
 
 @Component({
   selector: 'my-video-support',
@@ -12,25 +11,19 @@ import { VideoDetails } from '../../../shared/video/video-details.model'
 export class VideoSupportComponent {
   @Input() video: VideoDetails = null
 
-  @ViewChild('modal') modal: ModalDirective
+  @ViewChild('modal') modal: NgbModal
 
   videoHTMLSupport = ''
 
-  constructor (private markdownService: MarkdownService) {
-    // empty
-  }
+  constructor (
+    private markdownService: MarkdownService,
+    private modalService: NgbModal
+  ) { }
 
   show () {
-    this.modal.show()
-
-    if (this.video.support) {
-      this.videoHTMLSupport = this.markdownService.enhancedMarkdownToHTML(this.video.support)
-    } else {
-      this.videoHTMLSupport = ''
-    }
-  }
+    this.modalService.open(this.modal)
 
-  hide () {
-    this.modal.hide()
+    this.markdownService.enhancedMarkdownToHTML(this.video.support)
+      .then(r => this.videoHTMLSupport = r)
   }
 }