diff --git a/src/js/method-draw.js b/src/js/method-draw.js index 480ee32..a84449e 100644 --- a/src/js/method-draw.js +++ b/src/js/method-draw.js @@ -898,7 +898,6 @@ window.methodDraw = function() { }; var clickSave = function(){ - console.log("hi") flash($('#file_menu')); svgCanvas.save(); }; diff --git a/src/js/sanitize.js b/src/js/sanitize.js index 5f9e1d7..77e231a 100644 --- a/src/js/sanitize.js +++ b/src/js/sanitize.js @@ -50,7 +50,7 @@ var svgWhiteList_ = { "circle": ["class", "clip-path", "clip-rule", "cx", "cy", "fill", "fill-opacity", "fill-rule", "filter", "id", "mask", "opacity", "r", "requiredFeatures", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "style", "systemLanguage", "transform"], "clipPath": ["class", "clipPathUnits", "id"], "defs": [], - "style" : ["type"], + "style" : ["type"], "desc": [], "ellipse": ["class", "clip-path", "clip-rule", "cx", "cy", "fill", "fill-opacity", "fill-rule", "filter", "id", "mask", "opacity", "requiredFeatures", "rx", "ry", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "style", "systemLanguage", "transform"], "feGaussianBlur": ["class", "color-interpolation-filters", "id", "requiredFeatures", "stdDeviation"], diff --git a/src/js/svgcanvas.js b/src/js/svgcanvas.js index 59473c2..60e0315 100644 --- a/src/js/svgcanvas.js +++ b/src/js/svgcanvas.js @@ -5128,13 +5128,6 @@ this.svgCanvasToString = function() { pathActions.clear(true); - // Keep SVG-Edit comment on top - $.each(svgcontent.childNodes, function(i, node) { - if(i && node.nodeType === 8 && node.data.indexOf('Created with') >= 0) { - svgcontent.insertBefore(node, svgcontent.firstChild); - } - }); - // Move out of in-group editing mode if(current_group) { leaveContext(); @@ -5162,6 +5155,7 @@ this.svgCanvasToString = function() { $(this).replaceWith(svg); } }); + var output = this.svgToString(svgcontent, 0); // Rewrap gsvg @@ -5202,17 +5196,6 @@ this.svgToString = function(elem, indent) { var res = getResolution(); var vb = ""; - // TODO: Allow this by dividing all values by current baseVal - // Note that this also means we should properly deal with this on import -// if(curConfig.baseUnit !== "px") { -// var unit = curConfig.baseUnit; -// var unit_m = svgedit.units.getTypeMap()[unit]; -// res.w = svgedit.units.shortFloat(res.w / unit_m) -// res.h = svgedit.units.shortFloat(res.h / unit_m) -// vb = ' viewBox="' + [0, 0, res.w, res.h].join(' ') + '"'; -// res.w += unit; -// res.h += unit; -// } if(unit !== "px") { res.w = svgedit.units.convertUnit(res.w, unit) + unit; @@ -5780,6 +5763,13 @@ var convertToGroup = this.convertToGroup = function(elem) { } } +this.styleToAttributes = function(doc) { + const docEl = doc.documentElement; + + return doc; + +} + // // Function: setSvgString // This function sets the current drawing as the input SVG XML. @@ -5797,6 +5787,9 @@ this.setSvgString = function(xmlString) { var batchCmd = new BatchCommand("Change Source"); + newDoc = this.styleToAttributes(newDoc); + + // remove old svg document var nextSibling = svgcontent.nextSibling; var oldzoom = svgroot.removeChild(svgcontent);