Easiest way to add button in plugins #5184
Labels
Component: PeerTube Plugin 📦
Features that can be developed in a plugin, but require PeerTube plugin API development
Type: Feature Request ✨
Describe the problem to be solved
If we want to add button under videos in plugins, there is currently no easy way:
action:video-watch.video.loaded
hook (so we can get thevideo
object), and add buttons before themy-video-rate
component (for example), it is too soon, and the buttons will be removed from the DOMThe easiest working method I found is:
Describe the solution you would like
I see two solutions.
1. Placeholder + Hook
Create new client placeholder elements:
my-video-rate
componentAdd an action hook called just after the buttons are inserted in the DOM, so we can add our custom buttons safely.
2. A client helper function
Add a
registerButton
helper function. So that plugins can add buttons.Here is what it can look like, from the plugin point of view:
The text was updated successfully, but these errors were encountered: