import { catchError, first, map, shareReplay } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http'
import { Inject, Injectable, LOCALE_ID, NgZone } from '@angular/core'
+import { VideoEditType } from '@app/+videos/+video-edit/shared/video-edit.type'
import { AuthService } from '@app/core/auth'
import { Notifier } from '@app/core/notification'
import { MarkdownService } from '@app/core/renderer'
import { ServerService } from '@app/core/server/server.service'
import { getDevLocale, isOnDevLocale } from '@app/helpers'
import { CustomModalComponent } from '@app/modal/custom-modal.component'
-import { Hooks, loadPlugin, PluginInfo, runHook } from '@root-helpers/plugins'
+import { FormFields, Hooks, loadPlugin, PluginInfo, runHook } from '@root-helpers/plugins'
import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
import {
ClientHook,
'video-watch': new ReplaySubject<boolean>(1),
signup: new ReplaySubject<boolean>(1),
login: new ReplaySubject<boolean>(1),
+ 'video-edit': new ReplaySubject<boolean>(1),
embed: new ReplaySubject<boolean>(1)
}
private loadingScopes: { [id in PluginClientScope]?: boolean } = {}
private hooks: Hooks = {}
+ private formFields: FormFields = {
+ video: []
+ }
constructor (
private authService: AuthService,
: PluginType.THEME
}
+ getRegisteredVideoFormFields (type: VideoEditType) {
+ return this.formFields.video.filter(f => f.videoFormOptions.type === type)
+ }
+
private loadPlugin (pluginInfo: PluginInfo) {
return this.zone.runOutsideAngular(() => {
- return loadPlugin(this.hooks, pluginInfo, pluginInfo => this.buildPeerTubeHelpers(pluginInfo))
+ return loadPlugin({
+ hooks: this.hooks,
+ formFields: this.formFields,
+ pluginInfo,
+ peertubeHelpersFactory: pluginInfo => this.buildPeerTubeHelpers(pluginInfo)
+ })
})
}