From: Alexander Ebert Date: Mon, 21 Aug 2017 12:27:44 +0000 (+0200) Subject: Fixed orphaned paragraphs w/ block bbcodes X-Git-Tag: 3.1.0_Alpha_1~3^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2484de5f2380179c50147a305726b1fe5443e290;p=GitHub%2FWoltLab%2FWCF.git Fixed orphaned paragraphs w/ block bbcodes --- diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php index 1d40f249fa..dc42a86724 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeWoltlabMetacodeMarker.class.php @@ -339,6 +339,14 @@ class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlInputNode { } while ($parent->nodeName === 'p' || !$this->isBlockElement($parent)); + // block elements can sometimes contain a line break after the end tag + // which needs to be removed to avoid it being split into a separate p + if ($node = $end->nextSibling) { + if ($node->nodeType === XML_TEXT_NODE && $node->textContent === "\n" || $node->textContent === "\r\n") { + DOMUtil::removeNode($node); + } + } + $element = DOMUtil::splitParentsUntil($start, $parent); if ($start !== $element) DOMUtil::insertBefore($start, $element);