summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2015-12-01 17:46:52 +0000
committerJohn McLear <john@mclear.co.uk>2015-12-01 17:46:52 +0000
commit11ab89d8971e8652c47afc7d0f158f3d21662dbc (patch)
treeb67887188d899ad77b08beb0093dd11eb2d9df36
parent8a79ae6e0229075dcc4d153463e5e27233746b97 (diff)
parent1a8462fb4fc337e2f49737b40415a771f2c7ba30 (diff)
downloadetherpad-lite-11ab89d8971e8652c47afc7d0f158f3d21662dbc.zip
Merge pull request #2849 from ether/exportConvert-hook
Hook for export convert control
-rw-r--r--src/node/handler/ExportHandler.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/node/handler/ExportHandler.js b/src/node/handler/ExportHandler.js
index 0a808977..5e7d6de4 100644
--- a/src/node/handler/ExportHandler.js
+++ b/src/node/handler/ExportHandler.js
@@ -105,7 +105,7 @@ exports.doExport = function(req, res, padId, type)
//if this is a html export, we can send this from here directly
if(type == "html")
{
- // do any final changes the plugin might want to make cake
+ // do any final changes the plugin might want to make
hooks.aCallFirst("exportHTMLSend", html, function(err, newHTML){
if(newHTML.length) html = newHTML;
res.send(html);
@@ -133,7 +133,18 @@ exports.doExport = function(req, res, padId, type)
function(callback)
{
destFile = tempDirectory + "/etherpad_export_" + randNum + "." + type;
- convertor.convertFile(srcFile, destFile, type, callback);
+
+ // Allow plugins to overwrite the convert in export process
+ hooks.aCallAll("exportConvert", {srcFile: srcFile, destFile: destFile}, function(err, result){
+ if(!err && result.length > 0){
+ // console.log("export handled by plugin", destFile);
+ handledByPlugin = true;
+ callback();
+ }else{
+ convertor.convertFile(srcFile, destFile, type, callback);
+ }
+ });
+
},
//send the file
function(callback)