editor: canvas fix
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 26 Jun 2014 12:33:41 +0000 (14:33 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 26 Jun 2014 12:34:07 +0000 (14:34 +0200)
src/editor/modules/documentCanvas/canvas/keyboard.js

index b739cf8..71a50b0 100644 (file)
@@ -48,7 +48,7 @@ handlers.push({key: KEYS.ENTER,
 
         if(Object.keys(cursor.getPosition()).length === 0) {
             var currentElement = canvas.getCurrentNodeElement();
 
         if(Object.keys(cursor.getPosition()).length === 0) {
             var currentElement = canvas.getCurrentNodeElement();
-            if(currentElement) {
+            if(currentElement && !currentElement.wlxmlNode.isRoot()) {
                 canvas.wlxmlDocument.transaction(function() {
                     var added = currentElement.wlxmlNode.after({
                         tagName: currentElement.wlxmlNode.getTagName() || 'div',
                 canvas.wlxmlDocument.transaction(function() {
                     var added = currentElement.wlxmlNode.after({
                         tagName: currentElement.wlxmlNode.getTagName() || 'div',