name: Feature request
about: Suggest an idea for this project
title: 'Add hook for loading a pad that also gets called when a pad is already initialized'
labels: enhancement
assignees:
Is your feature request related to a problem? Please describe.
If you would like to hook into Etherpad on the server when a pad gets loaded you can use padLoad hook. This runs only once, when the pad is not yet initiated, to my knowledge there is no hook that runs for each time you actually "load" the pad, aka go to the URL of the specific pad.
Describe the solution you'd like
Add an extra hook in the src/node/db/PadManager.js file that gets called both on initial run (like padLoad) and when the pad is already initialized. I am not sure what the best name for this hook should be, or reuse padLoad. As I don't know what the implications are for the padLoad hook getting called multiple times. But here is a possible solution:
From line 135 in src/node/db/PadManager.js
// return pad if it's already loaded
if (pad != null) {
hooks.callAll('padInitialized', {pad});
return pad;
}
// try to load pad
pad = new Pad.Pad(id);
// initialize the pad
await pad.init(text);
hooks.callAll('padLoad', {pad});
hooks.callAll('padInitialized', {pad});
globalPads.set(id, pad);
padList.addPad(id);
Describe alternatives you've considered
Doesn't apply
Additional context
Doesn't apply
Plugin?
No
name: Feature request
about: Suggest an idea for this project
title: 'Add hook for loading a pad that also gets called when a pad is already initialized'
labels: enhancement
assignees:
Is your feature request related to a problem? Please describe.
If you would like to hook into Etherpad on the server when a pad gets loaded you can use
padLoadhook. This runs only once, when the pad is not yet initiated, to my knowledge there is no hook that runs for each time you actually "load" the pad, aka go to the URL of the specific pad.Describe the solution you'd like
Add an extra hook in the
src/node/db/PadManager.jsfile that gets called both on initial run (likepadLoad) and when the pad is already initialized. I am not sure what the best name for this hook should be, or reusepadLoad. As I don't know what the implications are for thepadLoadhook getting called multiple times. But here is a possible solution:From line 135 in
src/node/db/PadManager.jsDescribe alternatives you've considered
Doesn't apply
Additional context
Doesn't apply
Plugin?
No