mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
plugins: Move plugin definitions to avoid monkey patching
Also document the plugin data structures.
This commit is contained in:
parent
dcbf876d03
commit
da459888dc
15 changed files with 104 additions and 92 deletions
|
@ -1,4 +1,5 @@
|
|||
var _ = require("underscore");
|
||||
var defs = require('./plugin_defs');
|
||||
|
||||
function loadFn(path, hookName) {
|
||||
var functionName
|
||||
|
@ -59,3 +60,25 @@ function extractHooks(parts, hook_set_name, normalizer) {
|
|||
};
|
||||
|
||||
exports.extractHooks = extractHooks;
|
||||
|
||||
/*
|
||||
* Returns an array containing the names of the installed client-side plugins
|
||||
*
|
||||
* If no client-side plugins are installed, returns an empty array.
|
||||
* Duplicate names are always discarded.
|
||||
*
|
||||
* A client-side plugin is a plugin that implements at least one client_hook
|
||||
*
|
||||
* EXAMPLE:
|
||||
* No plugins: []
|
||||
* Some plugins: [ 'ep_adminpads', 'ep_add_buttons', 'ep_activepads' ]
|
||||
*/
|
||||
exports.clientPluginNames = function() {
|
||||
var client_plugin_names = _.uniq(
|
||||
defs.parts
|
||||
.filter(function(part) { return part.hasOwnProperty('client_hooks'); })
|
||||
.map(function(part) { return 'plugin-' + part['plugin']; })
|
||||
);
|
||||
|
||||
return client_plugin_names;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue