diff --git a/webodf/lib/core/Cursor.js b/webodf/lib/core/Cursor.js index bcf9b70e..cd34cfc2 100644 --- a/webodf/lib/core/Cursor.js +++ b/webodf/lib/core/Cursor.js @@ -111,12 +111,15 @@ core.Cursor = function Cursor(selection, document) { runtime.assert(Boolean(cursorNode.parentNode), "cursorNode.parentNode is undefined"); + // Merge the left and right textnodes - if (prev && prev.nodeType === 3 && prev.length > 0) { + if (prev && prev.nodeType === 3) { textNodeIncrease = prev.length; - if (next && next.nodeType === 3 && next.length > 0) { + if (next && next.nodeType === 3) { + if (prev.length > 0) { + next.insertData(0, prev.data); + } prev.parentNode.removeChild(prev); - next.insertData(0, prev.data); } }