diff --git a/src/node/db/API.js b/src/node/db/API.js index 07141fec2..5f8189140 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -270,7 +270,7 @@ exports.setHTML = function(padID, html, callback) if(ERR(err, callback)) return; // add a new changeset with the new html to the pad - importHtml.setPadHTML(pad, cleanText(html)); + importHtml.setPadHTML(pad, cleanText(html), callback); //update the clients on the pad padMessageHandler.updatePadClients(pad, callback); diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index 6e8ab23a2..686d1c614 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -25,10 +25,6 @@ function setPadHTML(pad, html, callback) { var apiLogger = log4js.getLogger("ImportHtml"); - // Clean the pad. This makes the rest of the code easier - // by several orders of magnitude. - pad.setText(""); - var padText = pad.text(); // Parse the incoming HTML with jsdom var doc = jsdom(html.replace(/>\n+<')); apiLogger.debug('html:'); @@ -44,6 +40,8 @@ function setPadHTML(pad, html, callback) return; // We don't process the HTML because it was bad.. } + // console.warn("LUL WUT THE FUCK U DOIN HERE?"); + var result = cc.finish(); apiLogger.debug('Lines:'); @@ -90,6 +88,7 @@ function setPadHTML(pad, html, callback) // the changeset is ready! var theChangeset = builder.toString(); apiLogger.debug('The changeset: ' + theChangeset); + pad.setText(""); pad.appendRevision(theChangeset); }