diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 754745fc..d6604300 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -188,7 +188,7 @@ var selectedElements = []; // * curStyles - Boolean indicating that current style attributes should be applied first // // Returns: The new element -var addSvgElementFromJson = this.addSvgElementFromJson = function(data) { +var addSvgElementFromJson = this.addSvgElementFromJson = function addSvgElementFromJson(data) { var shape = svgedit.utilities.getElem(data.attr.id); // if shape is a path but we need to create a rect/ellipse, then remove the path var current_layer = getCurrentDrawing().getCurrentLayer(); @@ -218,6 +218,12 @@ var addSvgElementFromJson = this.addSvgElementFromJson = function(data) { } svgedit.utilities.assignAttributes(shape, data.attr, 100); svgedit.utilities.cleanupElement(shape); + + // Children + if(data.children) data.children.forEach(function(child){ + shape.appendChild(addSvgElementFromJson(child)); + }); + return shape; };