Hook the ImportHtml module into the API
This commit is contained in:
parent
9fe6c11d87
commit
a26918c69e
|
@ -26,6 +26,8 @@ var authorManager = require("./AuthorManager");
|
||||||
var sessionManager = require("./SessionManager");
|
var sessionManager = require("./SessionManager");
|
||||||
var async = require("async");
|
var async = require("async");
|
||||||
var exportHtml = require("../utils/ExportHtml");
|
var exportHtml = require("../utils/ExportHtml");
|
||||||
|
var importHtml = require("../utils/ImportHtml");
|
||||||
|
var cleanText = require("./Pad").cleanText;
|
||||||
|
|
||||||
/**********************/
|
/**********************/
|
||||||
/**GROUP FUNCTIONS*****/
|
/**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 */
|
/**PAD FUNCTIONS */
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
|
@ -51,6 +51,7 @@ var functions = {
|
||||||
"getText" : ["padID", "rev"],
|
"getText" : ["padID", "rev"],
|
||||||
"setText" : ["padID", "text"],
|
"setText" : ["padID", "text"],
|
||||||
"getHTML" : ["padID", "rev"],
|
"getHTML" : ["padID", "rev"],
|
||||||
|
"setHTML" : ["padID", "html"],
|
||||||
"getRevisionsCount" : ["padID"],
|
"getRevisionsCount" : ["padID"],
|
||||||
"deletePad" : ["padID"],
|
"deletePad" : ["padID"],
|
||||||
"getReadOnlyID" : ["padID"],
|
"getReadOnlyID" : ["padID"],
|
||||||
|
|
Loading…
Reference in New Issue