Preserve comments when editing SVG source

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@315 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2009-07-13 03:23:58 +00:00
parent 5ce77bca33
commit 5e15483254
2 changed files with 19 additions and 17 deletions

View File

@@ -486,6 +486,7 @@ function SvgCanvas(c)
}
undoStack.push(cmd);
undoStackPointer = undoStack.length;
console.log(undoStack);
};
// private functions
@@ -617,16 +618,26 @@ function SvgCanvas(c)
{
var child = childs.item(i);
if (child.id == "selectorParentGroup") continue;
if (child.nodeType == 1) { // element node
switch(child.nodeType) {
case 1: // element node
out.push("\n");
out.push(svgToString(childs.item(i), indent));
} else if (child.nodeType == 3) { // text node
break;
case 3: // text node
var str = child.nodeValue.replace(/^\s+|\s+$/g, "");
if (str != "") {
bOneLine = true;
out.push(str + "");
}
}
break;
case 8: // comment
out.push("\n");
out.push(new Array(indent+1).join(" "));
out.push("<!--");
out.push(child.data);
out.push("-->");
break;
} // switch on node type
}
indent--;
if (!bOneLine) {