From: Aleksander Ɓukasz Date: Wed, 20 Nov 2013 15:57:05 +0000 (+0100) Subject: integration wip: handle backspace/delete X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/4ddf36452af460dbc26fd181f2ba3640a7c71374 integration wip: handle backspace/delete --- diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index e7f5fe8..16f2f68 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -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 = grandParent.append({text: ''}); + goto = grandParent.data('wlxmlNode').append({text: ''}); } else { goto = element.getNearestTextElement(direction); } - parent.detach(); + parent.data('wlxmlNode').detach(); } else { goto = element.getNearestTextElement(direction); - element.detach(); + element.data('wlxmlNode').detach(); } canvas.setCurrentElement(goto, {caretTo: caretTo}); canvas.publisher('contentChanged');