changeset 419:ca495f80cc5c

svg-editor: bug fixed of reading existing svg files
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 12 Sep 2009 17:46:02 +0200
parents 2efbd05651e1
children 792b9ee3d139
files htdocs/svg-edit/editor/svg-editor.js
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/htdocs/svg-edit/editor/svg-editor.js	Sat Sep 12 17:44:32 2009 +0200
+++ b/htdocs/svg-edit/editor/svg-editor.js	Sat Sep 12 17:46:02 2009 +0200
@@ -12,11 +12,10 @@
 	var modKey = ""; //(isMac ? "meta+" : "ctrl+");
 	var htdocs = document.getElementById("htdocs").innerHTML.replace('<!-- ', '').replace(' -->', '');
 	var textcha_question = document.getElementById("textcha-question").firstChild.data;
-	var svg = document.getElementById("svgdata");
 	var svgCanvas = new SvgCanvas(document.getElementById("svgcanvas"));
-	var filecontent =  svg.innerHTML;
 	// because moin uses currently HTML 4.0.1 we send the data as a comment in the HTML code
-	filecontent = filecontent.replace('<!-- ', '').replace(' -->', '');
+	var svgdata = document.getElementById("svgdata").innerHTML;
+	var filecontent = svgdata.slice(5, svgdata.length - 4);
 	if (filecontent != '') {
 	    if (!svgCanvas.setSvgString(filecontent)) {
 	        if(!confirm('There were parsing errors in your SVG source.\nRevert back to original SVG source?') ) {