1
0
Fork 0

Add action:video-edit.form.updated hook

This commit is contained in:
Chocobozzz 2023-03-10 10:34:25 +01:00
parent 3b2844f803
commit 085aba61c3
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 13 additions and 1 deletions

View File

@ -240,7 +240,15 @@ export class VideoEditComponent implements OnInit, OnDestroy {
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 updateForm = (values: any) => {
this.form.patchValue(values)
this.cd.detectChanges()
}
this.hooks.runAction('action:video-edit.init', 'video-edit', { type: this.type, updateForm })
this.form.valueChanges.subscribe(() => {
this.hooks.runAction('action:video-edit.form.updated', 'video-edit', { type: this.type, formValues: this.form.value })
})
}
ngOnDestroy () {

View File

@ -129,8 +129,12 @@ export const clientActionHookObject = {
'action:video-channel-playlists.playlists.loaded': true,
// Fired when the video edit page (upload, URL/torrent import, update) is being initialized
// Contains a `type` and `updateForm` object attributes
'action:video-edit.init': true,
// Fired when values of the video edit form changed
'action:video-edit.form.updated': true,
// Fired when the login page is being initialized
'action:login.init': true,