diff --git a/editor/svg-editor.html b/editor/svg-editor.html
index f4094c98..84ae5dd4 100644
--- a/editor/svg-editor.html
+++ b/editor/svg-editor.html
@@ -32,7 +32,7 @@
diff --git a/editor/svg-editor.js b/editor/svg-editor.js
index 78bd6f08..29cc5d0a 100644
--- a/editor/svg-editor.js
+++ b/editor/svg-editor.js
@@ -411,7 +411,6 @@ function svg_edit_setup() {
};
// TODO: prevent 'u' from showing up in the textarea
- // TODO: prevent extra carriage returns
// TODO: properly size the text area during resize
// TODO: properly handle error conditions (error msg dialog)
// TODO: prevent @style showing up on the svg element
@@ -420,7 +419,6 @@ function svg_edit_setup() {
if (editingsource) return;
editingsource = true;
var str = svgCanvas.getSvgString();
- console.log(str);
$('#svg_source_textarea').val(str);
$('#svg_source_editor').fadeIn();
properlySourceSizeTextArea();
diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js
index bd8787d8..b721c220 100644
--- a/editor/svgcanvas.js
+++ b/editor/svgcanvas.js
@@ -545,7 +545,11 @@ function SvgCanvas(c)
// this function only keeps what is allowed from our whitelist defined above
var sanitizeSvg = function(node) {
// we only care about element nodes
- // automatically return for all text, comment, etc nodes
+ // automatically return for all comment, etc nodes
+ // for text, we do a whitespace trim
+ if (node.nodeType == 3) {
+ node.nodeValue = node.nodeValue.replace(/^\s+|\s+$/g, "");
+ }
if (node.nodeType != 1) return;
var doc = node.ownerDocument;
@@ -617,9 +621,10 @@ function SvgCanvas(c)
out.push("\n");
out.push(svgToString(childs.item(i), indent));
} else if (child.nodeType == 3) { // text node
- bOneLine = true;
- if (child.nodeValue != "") {
- out.push(child.nodeValue + "");
+ var str = child.nodeValue.replace(/^\s+|\s+$/g, "");
+ if (str != "") {
+ bOneLine = true;
+ out.push(str + "");
}
}
}
@@ -1338,7 +1343,6 @@ function SvgCanvas(c)
// FIXME: after parsing in the new file, how do we synchronize getId()?
this.setSvgString = function(xmlString) {
try {
- console.log(xmlString);
// convert string into XML document
var newDoc = Utils.text2xml(xmlString);