From: Aleksander Ɓukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Date: Mon, 8 Jul 2013 12:02:48 +0000 (+0200)
Subject: Allow for moving elements already inside canvas
X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/428f22c06a5a72b9f036429f84eec9e1deea1c57?hp=26f26828b3cad2c2c1a2f7d4d3c06c025c212f98

Allow for moving elements already inside canvas
---

diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js
index 13ed6a6..aca727a 100644
--- a/modules/documentCanvas/canvas/documentElement.js
+++ b/modules/documentCanvas/canvas/documentElement.js
@@ -70,9 +70,14 @@ DocumentNodeElement.prototype = new DocumentElement();
 DocumentTextElement.prototype = new DocumentElement();
 
 var manipulate = function(e, params, action) {
-    var newElement = DocumentNodeElement.createDOM(params);
-    e.$element[action](newElement);
-    return documentElementFromHTMLElement(newElement);
+    var dom;
+    if(params instanceof DocumentElement) {
+        dom = params.dom()
+    } else {
+        dom = DocumentNodeElement.createDOM(params);
+    }
+    e.$element[action](dom);
+    return documentElementFromHTMLElement(dom);
 };
 
 $.extend(DocumentNodeElement.prototype, {