From eee73c7fc8cd9ef4c496b0378a0044b2034d7315 Mon Sep 17 00:00:00 2001 From: Oliver Pulges Date: Wed, 1 Jul 2015 14:17:30 +0300 Subject: [PATCH] Fix uneditable container delete sometimes not happening especially in safari --- src/selection/selection.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/selection/selection.js b/src/selection/selection.js index 6c7b7db..6602d4e 100644 --- a/src/selection/selection.js +++ b/src/selection/selection.js @@ -529,7 +529,15 @@ if (includePrevLeaves) { var prevNode = this.getPreviousNode(startNode, true), - prevLeaf = prevNode ? wysihtml5.dom.domNode(prevNode).lastLeafNode() : null; + prevLeaf = null; + + if(prevNode) { + if (prevNode.nodeType === 1 && wysihtml5.dom.hasClass(prevNode, this.unselectableClass)) { + prevLeaf = prevNode; + } else { + prevLeaf = wysihtml5.dom.domNode(prevNode).lastLeafNode(); + } + } if (prevLeaf) { return {