From 627c0b6b1348299ccb3b164017ca7e6200960a46 Mon Sep 17 00:00:00 2001 From: mauroc8 Date: Sun, 1 Jan 2017 18:47:31 -0300 Subject: [PATCH] 5.22.2 --- dist/js/medium-editor.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dist/js/medium-editor.js b/dist/js/medium-editor.js index 28a438a5c..1e52cec16 100644 --- a/dist/js/medium-editor.js +++ b/dist/js/medium-editor.js @@ -629,11 +629,10 @@ MediumEditor.extensions = {}; splitEndNodeIfNeeded: function (currentNode, newNode, matchEndIndex, currentTextIndex) { var textIndexOfEndOfFarthestNode, endSplitPoint; - textIndexOfEndOfFarthestNode = currentTextIndex + (newNode || currentNode).nodeValue.length + - (newNode ? currentNode.nodeValue.length : 0) - - 1; - endSplitPoint = (newNode || currentNode).nodeValue.length - - (textIndexOfEndOfFarthestNode + 1 - matchEndIndex); + textIndexOfEndOfFarthestNode = currentTextIndex + currentNode.nodeValue.length + + (newNode ? newNode.nodeValue.length : 0) - 1; + endSplitPoint = matchEndIndex - currentTextIndex - + (newNode ? currentNode.nodeValue.length : 0); if (textIndexOfEndOfFarthestNode >= matchEndIndex && currentTextIndex !== textIndexOfEndOfFarthestNode && endSplitPoint !== 0) {