-
Notifications
You must be signed in to change notification settings - Fork 0
More Etherpad plugin reading
A plugin is made up of a number of files. These files are:
This file registers callback functions (hooks), and indicates the parts of a plugin and the order of execution, you will only need to edit this if your plugin conflicts with other plugins.
Where the functions that will be called are
Where npm dependencies are dictated, the name and description of the plugin is set.
A functions job is to perform a desired task. Your must then specify which hooks will call a function. For example, if you write a function called HelloWorld() you must then specify in which hook you wish for this function to be executed. Hooks are hard coded in Etherpad, [see this reference point] <-- to be done. Here are the most commonly used hooks..
Pre/Post defines the order in which parts of a plugin are executed. This is required to ensure that plugins and their hooks are executed in the correct order. Pre defines parts that must be excected previously to this part executing.
===={ep_monospace/ep.json}====
{
"parts": [
{ /* You need at least one part like this */
"name": "plugin",
"pre": [],
"post": ["ep_onemoreplugin/partone"]
"hooks": {
"toolbarButtons": "ep_monospace/plugin:getSomeToolbarButtons",
"changeToMonospace": "ep_monospace/plugin:getSomePopups",
}
},
{ /* You can add as many parts as you want here... This is not required but it's in for reference purpose */
"name": "otherpart",
"pre": ["ep_my_example/somepart", "ep_otherplugin/main"],
"post": [],
"hooks": {
"somehookname": "ep_my_example/otherpart:somehook",
"morehook": "ep_my_example/otherpart:morehook"
}
}
]
}Each part must exist as a submodule that can be loaded using node.js:s require statement as
require("ep_my_example/mypart");Each hook must exist as a function inside a module that can be loaded with require();
For example the hook
ep_my_example/plugin:getSomeToolbarButtonsmeans the plugin framework will do
hook_fn = require("ep_my_example/plugin").getSomeToolbarButtons;