From: Aleksander Ɓukasz Date: Mon, 27 Jan 2014 11:03:04 +0000 (+0100) Subject: editor: fix - block removing root node via insert/delete X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/1dfb9c497ad66a5c0025e806bd6ee4777baaf1aa?ds=sidebyside editor: fix - block removing root node via insert/delete --- diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index 6b55909..c815489 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -249,6 +249,9 @@ handlers.push({keys: [KEYS.BACKSPACE, KEYS.DELETE], event.preventDefault(); var parent = element.parent(), grandParent = parent ? parent.parent() : null; + if(!grandParent && parent.children().length === 1) { + return; + } if(parent.children().length === 1 && parent.children()[0].sameNode(element)) { if(grandParent && grandParent.children().length === 1) { goto = grandParent.data('wlxmlNode').append({text: ''});