editor: small fix
[fnpeditor.git] / src / editor / plugins / core / lists.js
index 5a1b875..7a9d321 100644 (file)
@@ -45,11 +45,13 @@ var toggleListAction = function(type) {
                         item1 = list.object.getItem(0),
                         text = item1 ? item1.contents()[0] : undefined, //
                         doc = boundries.node1.document;
-
-                   return doc.createFragment(doc.CaretFragment, {node: text, offset:0});
+                    if(text) {
+                        return doc.createFragment(doc.CaretFragment, {node: text, offset:0});
+                    }
                 }, {
                     metadata: {
-                        description: action.getState().description
+                        description: action.getState().description,
+                        fragment: params.fragment
                     },
                     success: callback
                 });
@@ -77,7 +79,8 @@ var toggleListAction = function(type) {
                         return toret;
                     }, {
                         metadata: {
-                            description: action.getState().description
+                            description: action.getState().description,
+                            fragment: params.fragment
                         },
                         success: callback
                     });
@@ -99,7 +102,8 @@ var toggleListAction = function(type) {
                 }
             }, {
                 metadata: {
-                    description: action.getState().description
+                    description: action.getState().description,
+                    fragment: params.fragment
                 },
                 success: callback
             });