X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/b5db2e60c7ee08a0ccd0b8ded776730996c46aeb..926f304f00fd207bb24cf5c354cf4533abdcac48:/src/editor/plugins/core/lists.js diff --git a/src/editor/plugins/core/lists.js b/src/editor/plugins/core/lists.js index 5a1b875..c6de730 100644 --- a/src/editor/plugins/core/lists.js +++ b/src/editor/plugins/core/lists.js @@ -12,6 +12,10 @@ var getBoundriesForAList = function(fragment) { } if(fragment instanceof fragment.NodeFragment) { node = fragment.node.getNearestElementNode(); + if(node.isContextRoot()) { + node = fragment.node; + } + return { node1: node, node2: node @@ -45,11 +49,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 +83,8 @@ var toggleListAction = function(type) { return toret; }, { metadata: { - description: action.getState().description + description: action.getState().description, + fragment: params.fragment }, success: callback }); @@ -99,7 +106,8 @@ var toggleListAction = function(type) { } }, { metadata: { - description: action.getState().description + description: action.getState().description, + fragment: params.fragment }, success: callback });