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>
Tue, 27 Mar 2018 15:01:26 +0000 (17:01 +0200)
(cherry picked from commit a3899fd)

src/editor/modules/documentCanvas/canvas/keyboard.js

index 4136e18..becb355 100644 (file)
@@ -364,8 +364,10 @@ var keyEventHandlers = [
         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(),