From 41b9c45b9f2973655e8631219284f79874b4a608 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 16 May 2016 11:47:47 +1000 Subject: [PATCH] Feat(save-html): beautify HTML/XML output (closes #750) --- js/ui/save-html.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/ui/save-html.js b/js/ui/save-html.js index 772e1cbc8a..319bb269ae 100644 --- a/js/ui/save-html.js +++ b/js/ui/save-html.js @@ -3,8 +3,8 @@ // Saves content to HTML when asked to define( - ["core/utils"], - function (utils) { + ["core/utils", "beautify-html", "core/beautify-options"], + function (utils, beautify, beautifyOpts) { var msg, doc, conf; var cleanup = function (rootEl) { $(".removeOnSave", rootEl).remove(); @@ -154,7 +154,8 @@ define( cleanup(rootEl); str += rootEl.innerHTML; str += ""; - return str; + var beautifulHTML = beautify.html_beautify(str, beautifyOpts); + return beautifulHTML; } // convert the document to XML, pass 5 as mode for XHTML5 , toXML: function (mode) { @@ -239,7 +240,8 @@ define( return out; }; str += dumpNode(rootEl) + ""; - return str; + var beautifulXML = beautify.html_beautify(str, beautifyOpts); + return beautifulXML; } // create a diff marked version against the previousURI // strategy - open a window in which there is a form with the