From 3c5047bcbfbf205b879352c1485b1db34c07b383 Mon Sep 17 00:00:00 2001 From: Oliver Pulges Date: Mon, 16 Mar 2015 16:24:15 +0200 Subject: [PATCH] List context improvements --- src/browser.js | 4 ++-- src/commands/insertList.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/browser.js b/src/browser.js index 68f00c9..7fa7556 100644 --- a/src/browser.js +++ b/src/browser.js @@ -180,8 +180,8 @@ wysihtml5.browser = (function() { // When inserting unordered or ordered lists in Firefox, Chrome or Safari, the current selection or line gets // converted into a list (,
  1. ...
) // IE and Opera act a bit different here as they convert the entire content of the current block element into a list - "insertUnorderedList": isIE(), - "insertOrderedList": isIE() + "insertUnorderedList": isIE(9, ">="), + "insertOrderedList": isIE(9, ">=") }; // Firefox throws errors for queryCommandSupported, so we have to build up our own object of supported commands diff --git a/src/commands/insertList.js b/src/commands/insertList.js index 6f06871..e6c944d 100644 --- a/src/commands/insertList.js +++ b/src/commands/insertList.js @@ -21,7 +21,7 @@ wysihtml5.commands.insertList = (function(wysihtml5) { }; if (node) { - var parentLi = wysihtml5.dom.getParentElement(node, { query: "li" }), + var parentLi = wysihtml5.dom.getParentElement(node, { query: "li" }, false, composer.element), otherNodeName = (nodeName === "UL") ? "OL" : "UL"; if (isNode(node, nodeName)) { @@ -136,6 +136,7 @@ wysihtml5.commands.insertList = (function(wysihtml5) { selectedNode = composer.selection.getSelectedNode(), list = findListEl(selectedNode, nodeName, composer); + if (!list.el) { if (composer.commands.support(cmd)) { doc.execCommand(cmd, false, null);