diff options
Diffstat (limited to 'client/src/app/+videos/+video-edit/shared/video-edit.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-edit/shared/video-edit.component.ts | 12 |
1 files changed, 7 insertions, 5 deletions
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 31dbe43e6..0f4d0619b 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 | |||
@@ -21,7 +21,7 @@ import { | |||
21 | } from '@app/shared/form-validators/video-validators' | 21 | } from '@app/shared/form-validators/video-validators' |
22 | import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms' | 22 | import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms' |
23 | import { InstanceService } from '@app/shared/shared-instance' | 23 | import { InstanceService } from '@app/shared/shared-instance' |
24 | import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' | 24 | import { VideoCaptionEdit, VideoCaptionWithPathEdit, VideoEdit, VideoService } from '@app/shared/shared-main' |
25 | import { PluginInfo } from '@root-helpers/plugins-manager' | 25 | import { PluginInfo } from '@root-helpers/plugins-manager' |
26 | import { | 26 | import { |
27 | HTMLServerConfig, | 27 | HTMLServerConfig, |
@@ -34,6 +34,7 @@ import { | |||
34 | } from '@shared/models' | 34 | } from '@shared/models' |
35 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' | 35 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' |
36 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' | 36 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
37 | import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component' | ||
37 | import { VideoEditType } from './video-edit.type' | 38 | import { VideoEditType } from './video-edit.type' |
38 | 39 | ||
39 | type VideoLanguages = VideoConstant<string> & { group?: string } | 40 | type VideoLanguages = VideoConstant<string> & { group?: string } |
@@ -58,13 +59,14 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
58 | @Input() userVideoChannels: SelectChannelItem[] = [] | 59 | @Input() userVideoChannels: SelectChannelItem[] = [] |
59 | @Input() forbidScheduledPublication = true | 60 | @Input() forbidScheduledPublication = true |
60 | 61 | ||
61 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] | 62 | @Input() videoCaptions: (VideoCaptionWithPathEdit)[] = [] |
62 | 63 | ||
63 | @Input() waitTranscodingEnabled = true | 64 | @Input() waitTranscodingEnabled = true |
64 | @Input() type: VideoEditType | 65 | @Input() type: VideoEditType |
65 | @Input() liveVideo: LiveVideo | 66 | @Input() liveVideo: LiveVideo |
66 | 67 | ||
67 | @ViewChild('videoCaptionAddModal', { static: true }) videoCaptionAddModal: VideoCaptionAddModalComponent | 68 | @ViewChild('videoCaptionAddModal', { static: true }) videoCaptionAddModal: VideoCaptionAddModalComponent |
69 | @ViewChild('videoCaptionEditModal', { static: true }) editCaptionModal: VideoCaptionEditModalComponent | ||
68 | 70 | ||
69 | @Output() formBuilt = new EventEmitter<void>() | 71 | @Output() formBuilt = new EventEmitter<void>() |
70 | @Output() pluginFieldsAdded = new EventEmitter<void>() | 72 | @Output() pluginFieldsAdded = new EventEmitter<void>() |
@@ -228,12 +230,12 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
228 | .map(c => c.language.id) | 230 | .map(c => c.language.id) |
229 | } | 231 | } |
230 | 232 | ||
231 | onCaptionAdded (caption: VideoCaptionEdit) { | 233 | onCaptionEdited (caption: VideoCaptionEdit) { |
232 | const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id) | 234 | const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id) |
233 | 235 | ||
234 | // Replace existing caption? | 236 | // Replace existing caption? |
235 | if (existingCaption) { | 237 | if (existingCaption) { |
236 | Object.assign(existingCaption, caption, { action: 'CREATE' as 'CREATE' }) | 238 | Object.assign(existingCaption, caption) |
237 | } else { | 239 | } else { |
238 | this.videoCaptions.push( | 240 | this.videoCaptions.push( |
239 | Object.assign(caption, { action: 'CREATE' as 'CREATE' }) | 241 | Object.assign(caption, { action: 'CREATE' as 'CREATE' }) |
@@ -251,7 +253,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
251 | } | 253 | } |
252 | 254 | ||
253 | // This caption is not on the server, just remove it from our array | 255 | // This caption is not on the server, just remove it from our array |
254 | if (caption.action === 'CREATE') { | 256 | if (caption.action === 'CREATE' || caption.action === 'UPDATE') { |
255 | removeElementFromArray(this.videoCaptions, caption) | 257 | removeElementFromArray(this.videoCaptions, caption) |
256 | return | 258 | return |
257 | } | 259 | } |