[feat] New server-side hook: padCopy
Let plugins know when a pad is copied.pull/3195/head
parent
8345fd1539
commit
fc89034a55
|
@ -106,7 +106,7 @@ Here you can add custom toolbar items that will be available in the toolbar conf
|
||||||
|
|
||||||
Usage examples:
|
Usage examples:
|
||||||
|
|
||||||
* [https://github.com/tiblu/ep_authorship_toggle]()
|
* https://github.com/tiblu/ep_authorship_toggle
|
||||||
|
|
||||||
## padCreate
|
## padCreate
|
||||||
Called from: src/node/db/Pad.js
|
Called from: src/node/db/Pad.js
|
||||||
|
@ -137,6 +137,20 @@ Things in context:
|
||||||
|
|
||||||
This hook gets called when an existing pad was updated.
|
This hook gets called when an existing pad was updated.
|
||||||
|
|
||||||
|
## padCopy
|
||||||
|
Called from: src/node/db/Pad.js
|
||||||
|
|
||||||
|
Things in context:
|
||||||
|
|
||||||
|
1. originalPad - the source pad instance
|
||||||
|
2. destinationID - the id of the pad copied from originalPad
|
||||||
|
|
||||||
|
This hook gets called when an existing pad was copied.
|
||||||
|
|
||||||
|
Usage examples:
|
||||||
|
|
||||||
|
* https://github.com/ether/ep_comments
|
||||||
|
|
||||||
## padRemove
|
## padRemove
|
||||||
Called from: src/node/db/Pad.js
|
Called from: src/node/db/Pad.js
|
||||||
|
|
||||||
|
@ -146,6 +160,10 @@ Things in context:
|
||||||
|
|
||||||
This hook gets called when an existing pad was removed/deleted.
|
This hook gets called when an existing pad was removed/deleted.
|
||||||
|
|
||||||
|
Usage examples:
|
||||||
|
|
||||||
|
* https://github.com/ether/ep_comments
|
||||||
|
|
||||||
## socketio
|
## socketio
|
||||||
Called from: src/node/hooks/express/socketio.js
|
Called from: src/node/hooks/express/socketio.js
|
||||||
|
|
||||||
|
|
|
@ -592,6 +592,11 @@ Pad.prototype.copy = function copy(destinationID, force, callback) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
padManager.getPad(destinationID, null, callback) // this runs too early.
|
padManager.getPad(destinationID, null, callback) // this runs too early.
|
||||||
},10);
|
},10);
|
||||||
|
},
|
||||||
|
// let the plugins know the pad was copied
|
||||||
|
function(callback) {
|
||||||
|
hooks.callAll('padCopy', { 'originalPad': _this, 'destinationID': destinationID });
|
||||||
|
callback();
|
||||||
}
|
}
|
||||||
// series
|
// series
|
||||||
], function(err)
|
], function(err)
|
||||||
|
|
Loading…
Reference in New Issue