From d18c7b69cbc94bec9a75a4c1e0671e65597b5b24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Fri, 29 Nov 2013 11:53:49 +0100 Subject: [PATCH 1/1] Always create new element on nodeAdded event Checking for existence on canvas should be performed only if handling nodeMoved event. --- src/editor/modules/documentCanvas/canvas/wlxmlListener.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editor/modules/documentCanvas/canvas/wlxmlListener.js b/src/editor/modules/documentCanvas/canvas/wlxmlListener.js index c5deabf..ce9de6d 100644 --- a/src/editor/modules/documentCanvas/canvas/wlxmlListener.js +++ b/src/editor/modules/documentCanvas/canvas/wlxmlListener.js @@ -40,7 +40,7 @@ var handlers = { var canvasNode = utils.findCanvasElement(event.meta.node); canvasNode.setWlxmlTag(event.meta.newTagName); }, - nodeAdded: function(event) { + nodeAdded: function(event, checkForExistence) { if(event.meta.node.isRoot()) { this.canvas.reloadRoot(); return; @@ -57,11 +57,11 @@ var handlers = { referenceAction = 'after'; } - actionArg = utils.findCanvasElement(event.meta.node) || event.meta.node; + actionArg = (checkForExistence && utils.findCanvasElement(event.meta.node)) || event.meta.node; referenceElement[referenceAction](actionArg); }, nodeMoved: function(event) { - return handlers.nodeAdded(event); + return handlers.nodeAdded(event, true); }, nodeDetached: function(event) { var canvasNode = utils.findCanvasElementInParent(event.meta.node, event.meta.parent); -- 2.20.1