integration wip: take-away-node command
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 19 Nov 2013 15:03:04 +0000 (16:03 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 2 Dec 2013 13:50:53 +0000 (14:50 +0100)
src/editor/modules/documentCanvas/commands.js

index 6ff1d86..ac56a31 100644 (file)
@@ -151,7 +151,7 @@ commands.register('take-away-node', function(canvas) {
         return;
 
 
-    var range = nodeElement.unwrapContents();
+    var range = nodeElement.data('wlxmlNode').unwrapContent();
 
     if(element) {
         var elementIsFirstChild = nodeElement.childIndex(element);
@@ -159,13 +159,13 @@ commands.register('take-away-node', function(canvas) {
             canvas.setCurrentElement(element, {caretTo: position.offset});
         } else {
             if(elementIsFirstChild) {
-                canvas.setCurrentElement(range.element1, {caretTo: 'end'});
+                canvas.setCurrentElement(findCanvasElement(range.element1), {caretTo: 'end'});
             } else {
-                canvas.setCurrentElement(range.element2, {caretTo: 'end'});
+                canvas.setCurrentElement(findCanvasElement(range.element2), {caretTo: 'end'});
             }
         }
     } else {
-        canvas.setCurrentElement(range.element1, {caretTo: 'start'});
+        canvas.setCurrentElement(findCanvasElement(range.element1), {caretTo: 'start'});
     }
 
 });