mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
pluginfw: Export .etherpad hooks (#4466)
* export support * proper prefix * just a basic example, needs working on still * docs * comments shouldnt be hard coded
This commit is contained in:
parent
d5c5ca224b
commit
3fa58efede
3 changed files with 42 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
|
||||
let db = require("../db/DB");
|
||||
let hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');
|
||||
|
||||
exports.getPadRaw = async function(padId) {
|
||||
|
||||
|
@ -58,5 +59,17 @@ exports.getPadRaw = async function(padId) {
|
|||
}
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
// get content that has a different prefix IE comments:padId:foo
|
||||
// a plugin would return something likle ["comments", "cakes"]
|
||||
hooks.aCallAll('exportEtherpadAdditionalContent').then((prefixes) => {
|
||||
prefixes.forEach(async function(prefix) {
|
||||
let pluginContent = await db.get(prefix + ":" + padId);
|
||||
data[prefix + ":" + padId] = pluginContent;
|
||||
});
|
||||
})
|
||||
]);
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue