small fix for lists
authorJan Szejko <janek37@gmail.com>
Thu, 23 Feb 2017 17:02:58 +0000 (18:02 +0100)
committerJan Szejko <janek37@gmail.com>
Thu, 23 Feb 2017 17:02:58 +0000 (18:02 +0100)
src/editor/modules/documentCanvas/canvas/keyboard.js

index 577c2fe..0871199 100644 (file)
@@ -360,8 +360,10 @@ var keyEventHandlers = [
         applies: function(e, s) {
             var parent = s.element && s.element.wlxmlNode.parent(),
                 parentIsItem = parent && parent.is('item'),
         applies: function(e, s) {
             var parent = s.element && s.element.wlxmlNode.parent(),
                 parentIsItem = parent && parent.is('item'),
-                itemIsOnList = parent && parent.parent() && parent.parent().is('list');
-            return s.type === 'caret' && e.key === KEYS.ENTER && s.element.isEmpty() && parentIsItem && itemIsOnList;
+                itemIsOnList = parent && parent.parent() && parent.parent().is('list'),
+                onlyChild = parent.contents().length === 1;
+            return s.type === 'caret' && e.key === KEYS.ENTER && s.element.isEmpty() && onlyChild &&
+                parentIsItem && itemIsOnList;
         },
         run: function(e, s) {
             var item = s.element.wlxmlNode.parent(),
         },
         run: function(e, s) {
             var item = s.element.wlxmlNode.parent(),