diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-10 10:34:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-10 10:34:25 +0100 |
commit | c1b3f2e05d11dc8b452869582dcb1b926b306d79 (patch) | |
tree | 38e869ebe2ff609cab4ca4d3a498aa849dc3385a | |
parent | 4857f887f73328f2d4492eb04a8126cb7e446668 (diff) | |
download | PeerTube-c1b3f2e05d11dc8b452869582dcb1b926b306d79.tar.gz PeerTube-c1b3f2e05d11dc8b452869582dcb1b926b306d79.tar.zst PeerTube-c1b3f2e05d11dc8b452869582dcb1b926b306d79.zip |
Add action:video-edit.form.updated hook
-rw-r--r-- | client/src/app/+videos/+video-edit/shared/video-edit.component.ts | 10 | ||||
-rw-r--r-- | shared/models/plugins/client/client-hook.model.ts | 4 |
2 files changed, 13 insertions, 1 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 13359a4d1..e3bd5fe71 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 | |||
@@ -240,7 +240,15 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
240 | this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute | 240 | this.schedulerInterval = setInterval(() => this.minScheduledDate = new Date(), 1000 * 60) // Update every minute |
241 | }) | 241 | }) |
242 | 242 | ||
243 | this.hooks.runAction('action:video-edit.init', 'video-edit', { type: this.type }) | 243 | const updateForm = (values: any) => { |
244 | this.form.patchValue(values) | ||
245 | this.cd.detectChanges() | ||
246 | } | ||
247 | this.hooks.runAction('action:video-edit.init', 'video-edit', { type: this.type, updateForm }) | ||
248 | |||
249 | this.form.valueChanges.subscribe(() => { | ||
250 | this.hooks.runAction('action:video-edit.form.updated', 'video-edit', { type: this.type, formValues: this.form.value }) | ||
251 | }) | ||
244 | } | 252 | } |
245 | 253 | ||
246 | ngOnDestroy () { | 254 | ngOnDestroy () { |
diff --git a/shared/models/plugins/client/client-hook.model.ts b/shared/models/plugins/client/client-hook.model.ts index 20e019304..ec1d2b5e5 100644 --- a/shared/models/plugins/client/client-hook.model.ts +++ b/shared/models/plugins/client/client-hook.model.ts | |||
@@ -129,8 +129,12 @@ export const clientActionHookObject = { | |||
129 | 'action:video-channel-playlists.playlists.loaded': true, | 129 | 'action:video-channel-playlists.playlists.loaded': true, |
130 | 130 | ||
131 | // Fired when the video edit page (upload, URL/torrent import, update) is being initialized | 131 | // Fired when the video edit page (upload, URL/torrent import, update) is being initialized |
132 | // Contains a `type` and `updateForm` object attributes | ||
132 | 'action:video-edit.init': true, | 133 | 'action:video-edit.init': true, |
133 | 134 | ||
135 | // Fired when values of the video edit form changed | ||
136 | 'action:video-edit.form.updated': true, | ||
137 | |||
134 | // Fired when the login page is being initialized | 138 | // Fired when the login page is being initialized |
135 | 'action:login.init': true, | 139 | 'action:login.init': true, |
136 | 140 | ||