aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
diff options
context:
space:
mode:
authorlutangar <johan.dufour@gmail.com>2021-12-22 18:36:56 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-02-28 14:29:01 +0100
commit57d74ec83d64daaf2efc6a3dad8adbcfe1f59415 (patch)
tree3d56b8c45e6f7c88149c34e9c93b994c94587107 /client/src/app/+videos/+video-edit/shared/video-edit.component.ts
parente66d0892b12c5b3b3e8a6b7a4129103a912486a9 (diff)
downloadPeerTube-57d74ec83d64daaf2efc6a3dad8adbcfe1f59415.tar.gz
PeerTube-57d74ec83d64daaf2efc6a3dad8adbcfe1f59415.tar.zst
PeerTube-57d74ec83d64daaf2efc6a3dad8adbcfe1f59415.zip
Add simple subtitle edition from video captions tab
Introduce a new __Edit__ button on a subtitle. It opens a modal with simple textarea allowing the user to do quick corrections on a subtitle.
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.ts12
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'
22import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms' 22import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms'
23import { InstanceService } from '@app/shared/shared-instance' 23import { InstanceService } from '@app/shared/shared-instance'
24import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' 24import { VideoCaptionEdit, VideoCaptionWithPathEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
25import { PluginInfo } from '@root-helpers/plugins-manager' 25import { PluginInfo } from '@root-helpers/plugins-manager'
26import { 26import {
27 HTMLServerConfig, 27 HTMLServerConfig,
@@ -34,6 +34,7 @@ import {
34} from '@shared/models' 34} from '@shared/models'
35import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' 35import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'
36import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' 36import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
37import { VideoCaptionEditModalComponent } from './video-caption-edit-modal/video-caption-edit-modal.component'
37import { VideoEditType } from './video-edit.type' 38import { VideoEditType } from './video-edit.type'
38 39
39type VideoLanguages = VideoConstant<string> & { group?: string } 40type 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 }