Hook the ImportHtml module into the API

pull/204/head
Lorenzo Gil Sanchez 2011-11-17 10:18:35 +01:00
parent 9fe6c11d87
commit a26918c69e
2 changed files with 23 additions and 0 deletions

View File

@ -26,6 +26,8 @@ var authorManager = require("./AuthorManager");
var sessionManager = require("./SessionManager");
var async = require("async");
var exportHtml = require("../utils/ExportHtml");
var importHtml = require("../utils/ImportHtml");
var cleanText = require("./Pad").cleanText;
/**********************/
/**GROUP FUNCTIONS*****/
@ -254,6 +256,26 @@ exports.getHTML = function(padID, rev, callback)
});
}
exports.setHTML = function(padID, html, callback)
{
//get the pad
getPadSafe(padID, true, function(err, pad)
{
if(err)
{
callback(err);
return;
}
// add a new changeset with the new html to the pad
importHtml.setPadHTML(pad, cleanText(html));
//update the clients on the pad
padMessageHandler.updatePadClients(pad, callback);
});
}
/*****************/
/**PAD FUNCTIONS */
/*****************/

View File

@ -51,6 +51,7 @@ var functions = {
"getText" : ["padID", "rev"],
"setText" : ["padID", "text"],
"getHTML" : ["padID", "rev"],
"setHTML" : ["padID", "html"],
"getRevisionsCount" : ["padID"],
"deletePad" : ["padID"],
"getReadOnlyID" : ["padID"],