ExportEtherpad: Fix `exportEtherpadAdditionalContent` hook docs
When exporting, only records like `comments:padId` are supported, not records like `comments:padId:foo`.pull/5513/head
parent
936185e3b6
commit
78b44daaa8
|
@ -945,17 +945,19 @@ exports.exportHtmlAdditionalTagsWithData = function(hook, pad, cb){
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## exportEtherpadAdditionalContent
|
## `exportEtherpadAdditionalContent`
|
||||||
Called from src/node/utils/ExportEtherpad.js and
|
|
||||||
src/node/utils/ImportEtherpad.js
|
|
||||||
|
|
||||||
Things in context: Nothing
|
Called from `src/node/utils/ExportEtherpad.js` and
|
||||||
|
`src/node/utils/ImportEtherpad.js`.
|
||||||
|
|
||||||
Useful for exporting and importing pad metadata that is stored in the database
|
Called when exporting to an `.etherpad` file or when importing from an
|
||||||
but not in the pad's content or attributes. For example, in ep_comments_page the
|
`.etherpad` file. The hook function should return prefixes for pad-specific
|
||||||
comments are stored as `comments:padId:uniqueIdOfComment` so a complete export
|
records that should be included in the export/import. On export, each
|
||||||
of all pad data to an `.etherpad` file must include the `comments:padId:*`
|
`${prefix}:${padId}` record (but not `${prefix}:${padId}:*` records) are
|
||||||
records.
|
included in the generated `.etherpad` file. On import, all `${prefix}:${padId}`
|
||||||
|
and `${prefix}:${padId}:*` records are loaded into the database.
|
||||||
|
|
||||||
|
Context properties: None.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ exports.getPadRaw = async (padId, readOnlyId) => {
|
||||||
}
|
}
|
||||||
for (let i = 0; i <= pad.head; ++i) data[`${pfx}:revs:${i}`] = await pad.getRevision(i);
|
for (let i = 0; i <= pad.head; ++i) data[`${pfx}:revs:${i}`] = await pad.getRevision(i);
|
||||||
for (let i = 0; i <= pad.chatHead; ++i) data[`${pfx}:chat:${i}`] = await pad.getChatMessage(i);
|
for (let i = 0; i <= pad.chatHead; ++i) data[`${pfx}:chat:${i}`] = await pad.getChatMessage(i);
|
||||||
// get content that has a different prefix IE comments:padId:foo
|
|
||||||
// a plugin would return something likle ['comments', 'cakes']
|
|
||||||
const prefixes = await hooks.aCallAll('exportEtherpadAdditionalContent');
|
const prefixes = await hooks.aCallAll('exportEtherpadAdditionalContent');
|
||||||
await Promise.all(prefixes.map(async (prefix) => {
|
await Promise.all(prefixes.map(async (prefix) => {
|
||||||
data[`${prefix}:${readOnlyId || padId}`] = await pad.db.get(`${prefix}:${padId}`);
|
data[`${prefix}:${readOnlyId || padId}`] = await pad.db.get(`${prefix}:${padId}`);
|
||||||
|
|
Loading…
Reference in New Issue