From 2484de5f2380179c50147a305726b1fe5443e290 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 21 Aug 2017 14:27:44 +0200 Subject: [PATCH] Fixed orphaned paragraphs w/ block bbcodes --- .../node/HtmlInputNodeWoltlabMetacodeMarker.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.20.1