From: Alexander Ebert Date: Sun, 28 Aug 2016 15:38:03 +0000 (+0200) Subject: Fixed check for empty paragraph after insert X-Git-Tag: 3.0.0_Beta_1~435 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5b888dc6446b86fa3cac2f6a794a55d78c7ce5c3;p=GitHub%2FWoltLab%2FWCF.git Fixed check for empty paragraph after insert --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js index 4d4003b4de..f28d1c5eee 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabInsert.js @@ -17,10 +17,20 @@ $.Redactor.prototype.WoltLabInsert = function() { mpHtml.call(this, html, data); - if (block && block.nodeName === 'P' && block.nextElementSibling && !block.childElementCount && block.textContent.replace(/\u200B/g, '').trim() === '') { - // inserting HTML tends to cause new paragraphs inserted - // rather than using the current, empty one - elRemove(block); + if (block && block.nodeName === 'P' && block.nextElementSibling) { + var removeBlock = false; + if (block.childElementCount === 0 && block.textContent.replace(/\u200B/g, '').trim() === '') { + removeBlock = true; + } + else if (block.childElementCount === 1 && block.innerHTML === '
') { + removeBlock = true; + } + + if (removeBlock) { + // inserting HTML tends to cause new paragraphs inserted + // rather than using the current, empty one + elRemove(block); + } } }).bind(this);