import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms'
import { InstanceService } from '@app/shared/shared-instance'
import { VideoCaptionEdit, VideoCaptionWithPathEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
+import { logger } from '@root-helpers/logger'
import { PluginInfo } from '@root-helpers/plugins-manager'
import {
HTMLServerConfig,
VideoDetails,
VideoPrivacy
} from '@shared/models'
+import { VideoSource } from '@shared/models/videos/video-source'
import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'
import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
import { VideoCaptionEditModalContentComponent } from './video-caption-edit-modal-content/video-caption-edit-modal-content.component'
import { VideoEditType } from './video-edit.type'
-import { VideoSource } from '@shared/models/videos/video-source'
-import { logger } from '@root-helpers/logger'
-import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
type VideoLanguages = VideoConstant<string> & { group?: string }
type PluginField = {
@Input() videoCaptions: VideoCaptionWithPathEdit[] = []
@Input() videoSource: VideoSource
- @Input() waitTranscodingEnabled = true
+ @Input() hideWaitTranscoding = false
+
@Input() type: VideoEditType
@Input() liveVideo: LiveVideo
nsfw: 'false',
commentsEnabled: this.serverConfig.defaults.publish.commentsEnabled,
downloadEnabled: this.serverConfig.defaults.publish.downloadEnabled,
- waitTranscoding: 'true',
+ waitTranscoding: true,
licence: this.serverConfig.defaults.publish.licence,
tags: []
}
this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute
})
- this.hooks.runAction('action:video-edit.init', 'video-edit', { type: this.type })
+ const updateFormForPlugins = (values: any) => {
+ this.form.patchValue(values)
+ this.cd.detectChanges()
+ }
+ this.hooks.runAction('action:video-edit.init', 'video-edit', { type: this.type, updateForm: updateFormForPlugins })
+
+ this.form.valueChanges.subscribe(() => {
+ this.hooks.runAction('action:video-edit.form.updated', 'video-edit', { type: this.type, formValues: this.form.value })
+ })
}
ngOnDestroy () {
for (const setting of this.pluginFields) {
await this.pluginService.translateSetting(setting.pluginInfo.plugin.npmName, setting.commonOptions)
+ // Not a form input, just a HTML tag
+ if (setting.commonOptions.type === 'html') continue
+
const validator = async (control: AbstractControl) => {
if (!setting.commonOptions.error) return null