fix problem with delete
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / keyboard.js
index 0ad2ff3..99201bc 100644 (file)
@@ -247,11 +247,12 @@ var keyEventHandlers = [
                 element = s.canvas.getNearestTextElement('below', s.element);
             }
 
+            e.preventDefault();
+
             if(!element) {
                 return;
             }
 
-
             var parent = element.wlxmlNode.parent();
             if(element.wlxmlNode.getIndex() === 0 && parent.isContextRoot() && (!parent.is('item') || parent.getIndex() === 0)) {
                 // Don't even try to do anything at the edge of a context root, except for non-first items
@@ -259,8 +260,6 @@ var keyEventHandlers = [
                 return;
             }
 
-            e.preventDefault();
-
             s.canvas.wlxmlDocument.transaction(function() {
                 if(element.wlxmlNode.getIndex() === 0) {
                     goto = element.wlxmlNode.parent().moveUp();