diff options
Diffstat (limited to 'node/db/API.js')
-rw-r--r-- | node/db/API.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/node/db/API.js b/node/db/API.js index 2069ce68..c40c49ca 100644 --- a/node/db/API.js +++ b/node/db/API.js @@ -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 */ /*****************/ |