editor: plugins/core - restore selection after editing/deleting link via a link tool box
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / genericElement.js
index f115bd4..a2601f8 100644 (file)
@@ -104,11 +104,9 @@ $.extend(generic, {
         }
       
         if(event.type === 'nodeMoved') {
         }
       
         if(event.type === 'nodeMoved') {
-            /* globals Node */
-            if(event.meta.node.nodeType === Node.TEXT_NODE) {
-                actionArg = utils.getElementForTextNode(event.meta.node);
-            } else {
-                actionArg = utils.getElementForNode(event.meta.node);
+            actionArg = utils.getElementForNode(event.meta.node, event.meta.parent);
+            if(actionArg.sameNode(referenceElement)) {
+                referenceElement = this.children()[nodeIndex];
             }
         } else {
             actionArg = event.meta.node;
             }
         } else {
             actionArg = event.meta.node;