]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
Enable video upload and edit
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / shared / video-caption-add-modal.component.ts
index 07c33030aa7087fa904a88601a2b8b5f54ea4a6d..1413e7262b6d01f5bc012d864c2c3dd6071d91f2 100644 (file)
@@ -5,6 +5,7 @@ import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validator
 import { ServerService } from '@app/core'
 import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
 import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
+import { VideoConstant } from '../../../../../../shared'
 
 @Component({
   selector: 'my-video-caption-add-modal',
@@ -19,7 +20,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
 
   @ViewChild('modal') modal: ElementRef
 
-  videoCaptionLanguages = []
+  videoCaptionLanguages: VideoConstant<string>[] = []
 
   private openedModal: NgbModalRef
   private closingModal = false
@@ -59,6 +60,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
   hide () {
     this.closingModal = true
     this.openedModal.close()
+    this.form.reset()
   }
 
   isReplacingExistingCaption () {
@@ -70,8 +72,6 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
   }
 
   async addCaption () {
-    this.hide()
-
     const languageId = this.form.value[ 'language' ]
     const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
 
@@ -80,6 +80,6 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
       captionfile: this.form.value[ 'captionfile' ]
     })
 
-    this.form.reset()
+    this.hide()
   }
 }