Hook the ImportHtml module into the API
parent
9fe6c11d87
commit
a26918c69e
|
@ -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 */
|
||||
/*****************/
|
||||
|
|
|
@ -51,6 +51,7 @@ var functions = {
|
|||
"getText" : ["padID", "rev"],
|
||||
"setText" : ["padID", "text"],
|
||||
"getHTML" : ["padID", "rev"],
|
||||
"setHTML" : ["padID", "html"],
|
||||
"getRevisionsCount" : ["padID"],
|
||||
"deletePad" : ["padID"],
|
||||
"getReadOnlyID" : ["padID"],
|
||||
|
|
Loading…
Reference in New Issue