integration wip: handle backspace/delete
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 20 Nov 2013 15:57:05 +0000 (16:57 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 2 Dec 2013 13:50:53 +0000 (14:50 +0100)
src/editor/modules/documentCanvas/canvas/keyboard.js

index e7f5fe8..16f2f68 100644 (file)
@@ -189,14 +189,14 @@ handlers.push({keys: [KEYS.BACKSPACE, KEYS.DELETE],
                 goto;
             if(parent.children().length === 1 && parent.children()[0].sameNode(element)) {
                 if(grandParent && grandParent.children().length === 1) {
                 goto;
             if(parent.children().length === 1 && parent.children()[0].sameNode(element)) {
                 if(grandParent && grandParent.children().length === 1) {
-                    goto = grandParent.append({text: ''});
+                    goto = grandParent.data('wlxmlNode').append({text: ''});
                 } else {
                     goto = element.getNearestTextElement(direction);
                 }
                 } else {
                     goto = element.getNearestTextElement(direction);
                 }
-                parent.detach();
+                parent.data('wlxmlNode').detach();
             } else {
                 goto = element.getNearestTextElement(direction);
             } else {
                 goto = element.getNearestTextElement(direction);
-                element.detach();
+                element.data('wlxmlNode').detach();
             }
             canvas.setCurrentElement(goto, {caretTo: caretTo});
             canvas.publisher('contentChanged');
             }
             canvas.setCurrentElement(goto, {caretTo: caretTo});
             canvas.publisher('contentChanged');