X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/123b453a3cf4195c7a7b0133f740ea568af859a7..2f9850da2c6ad0258f87c3d8972689da6aa8011d:/src/editor/plugins/core/lists.js diff --git a/src/editor/plugins/core/lists.js b/src/editor/plugins/core/lists.js index 7a9d321..65b6e69 100644 --- a/src/editor/plugins/core/lists.js +++ b/src/editor/plugins/core/lists.js @@ -8,10 +8,14 @@ var getBoundriesForAList = function(fragment) { var node; if(fragment instanceof fragment.RangeFragment && fragment.hasSiblingBoundries()) { - return fragment.boundriesSiblingParents(); + return fragment.startNode.hasSameContextRoot(fragment.endNode) && fragment.boundriesSiblingParents(); } if(fragment instanceof fragment.NodeFragment) { node = fragment.node.getNearestElementNode(); + if(node.isContextRoot()) { + node = fragment.node; + } + return { node1: node, node2: node @@ -152,7 +156,7 @@ var toggleListAction = function(type) { } var boundries = getBoundriesForAList(params.fragment); - if(boundries) { + if(boundries && boundries.node1.hasSameContextRoot(boundries.node2)) { return { allowed: true, description: interpolate(gettext('Make %s fragment(s) into list'), [countItems(getBoundriesForAList(params.fragment))]),