Added ability to create a text node with just a string in addSvgElementFromJson().

master
KB Jørgensen 2016-08-08 16:32:59 +02:00
parent b301acf716
commit e79db0f2a6
1 changed files with 2 additions and 0 deletions

View File

@ -189,6 +189,8 @@ var selectedElements = [];
// //
// Returns: The new element // Returns: The new element
var addSvgElementFromJson = this.addSvgElementFromJson = function addSvgElementFromJson(data) { var addSvgElementFromJson = this.addSvgElementFromJson = function addSvgElementFromJson(data) {
if(typeof(data) == 'string') return svgdoc.createTextNode(data);
var shape = svgedit.utilities.getElem(data.attr.id); 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 // if shape is a path but we need to create a rect/ellipse, then remove the path
var current_layer = getCurrentDrawing().getCurrentLayer(); var current_layer = getCurrentDrawing().getCurrentLayer();