changeset 400:a33628b071b2

SvgEditor: fixed loading of all svg elements
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 25 Aug 2009 08:25:30 +0200
parents 74b81223475a
children b1a9b182d9fd
files data/plugin/action/SvgEditor.py htdocs/svg-edit/CHANGES.current htdocs/svg-edit/editor/svg-editor.js
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/SvgEditor.py	Tue Aug 25 07:36:23 2009 +0200
+++ b/data/plugin/action/SvgEditor.py	Tue Aug 25 08:25:30 2009 +0200
@@ -22,6 +22,11 @@
         fpath = AttachFile.getFilename(request, pagename, target).encode(config.charset)
         filecontent = file(fpath, 'r').readlines()
         filecontent = ''.join(filecontent[1:])
+        if filecontent:
+            # svg data is saved as xml. at least firefox changes the data by adding closing tags e.g. </rect></circle></circle></circle></rect></svg>
+            # this renders then only the first element
+            filecontent = "<!-- %s -->" % filecontent
+
         
     do = request.values.get('do', '')
     if do == 'save':
--- a/htdocs/svg-edit/CHANGES.current	Tue Aug 25 07:36:23 2009 +0200
+++ b/htdocs/svg-edit/CHANGES.current	Tue Aug 25 08:25:30 2009 +0200
@@ -12,7 +12,6 @@
 ToDo
  * adjust coordinates for drawing tools (offset probably from relative)
  * fix wrong url for square and circle 
- * add base 64 decoder to svg-editor.js
 
 SVG-edit is a lightweight, web-based, Javascript-driven SVG editor that works in any modern browser: initial version of svg-edit Revision r448 (http://code.google.com/p/svg-edit/) for moin-1.9 added
 
--- a/htdocs/svg-edit/editor/svg-editor.js	Tue Aug 25 07:36:23 2009 +0200
+++ b/htdocs/svg-edit/editor/svg-editor.js	Tue Aug 25 08:25:30 2009 +0200
@@ -14,7 +14,9 @@
     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(' -->', '');
+
     if (filecontent != '') {
         if (!svgCanvas.setSvgString(filecontent)) {
             if( !confirm('There were parsing errors in your SVG source.\nRevert back to original SVG source?') ) {