From 70a8e50a5d3df90cba615559b5aaba1536356f5a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 28 Feb 2022 13:42:48 +0100 Subject: Cleanup subtitle edition PR --- .../video-caption-edit-modal.component.html | 2 +- .../video-caption-edit-modal.component.ts | 19 +++++-------------- .../+video-edit/shared/video-edit.component.ts | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) (limited to 'client/src/app/+videos') diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html index 4543b93d8..be6f676c2 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html @@ -17,7 +17,7 @@
- {{ formErrors.description }} + {{ formErrors.captionFileContent }}
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts index d2232a38e..f74f3c5ea 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts @@ -1,5 +1,4 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' - import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators' import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main' @@ -23,7 +22,6 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn videoCaptionLanguages: VideoConstant[] = [] private openedModal: NgbModalRef - private closingModal = false constructor ( protected formValidatorService: FormValidatorService, @@ -44,25 +42,21 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn loadCaptionContent () { const { captionPath } = this.videoCaption - if (captionPath) { - this.videoCaptionService.getCaptionContent({ - captionPath - }).subscribe((res) => { + if (!captionPath) return + + this.videoCaptionService.getCaptionContent({ captionPath }) + .subscribe(res => { this.form.patchValue({ captionFileContent: res }) }) - } } show () { - this.closingModal = false - this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false }) } hide () { - this.closingModal = true this.openedModal.close() } @@ -70,14 +64,11 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn this.hide() } - isReplacingExistingCaption () { - return true - } - updateCaption () { const format = 'vtt' const languageId = this.videoCaption.language.id const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) + this.captionEdited.emit({ language: languageObject, captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, { diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 0f4d0619b..2801fc519 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts @@ -59,7 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { @Input() userVideoChannels: SelectChannelItem[] = [] @Input() forbidScheduledPublication = true - @Input() videoCaptions: (VideoCaptionWithPathEdit)[] = [] + @Input() videoCaptions: VideoCaptionWithPathEdit[] = [] @Input() waitTranscodingEnabled = true @Input() type: VideoEditType -- cgit v1.2.3