From 1979a46a996bf7439d985fd66d322c0b01e51b46 Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Fri, 6 Dec 2024 15:16:41 +0100 Subject: [PATCH] Fixes the problem that the end node is inserted before the content --- .../node/HtmlUpcastNodeWoltlabMetacode.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/upcast/node/HtmlUpcastNodeWoltlabMetacode.class.php b/wcfsetup/install/files/lib/system/html/upcast/node/HtmlUpcastNodeWoltlabMetacode.class.php index 18786e1a13..a4146db96b 100644 --- a/wcfsetup/install/files/lib/system/html/upcast/node/HtmlUpcastNodeWoltlabMetacode.class.php +++ b/wcfsetup/install/files/lib/system/html/upcast/node/HtmlUpcastNodeWoltlabMetacode.class.php @@ -111,21 +111,23 @@ final class HtmlUpcastNodeWoltlabMetacode extends AbstractHtmlUpcastNode DOMUtil::removeNode($element, true); } } else { - $insertNode = $element->parentNode->insertBefore( + $element->parentNode->insertBefore( $element->ownerDocument->createTextNode("[{$name}{$attributes}]"), $element ); + $endNode = $element->parentNode->insertBefore( + $element->ownerDocument->createTextNode("[/{$name}]"), + $element->nextSibling + ); if ($bbcode->isSourceCode) { - $insertNode->parentNode->appendChild( - $element->ownerDocument->createTextNode($element->textContent) + $endNode->parentNode->insertBefore( + $element->ownerDocument->createTextNode($element->textContent), + $endNode ); DOMUtil::removeNode($element); } else { DOMUtil::removeNode($element, true); } - $insertNode->parentNode->appendChild( - $element->ownerDocument->createTextNode("[/{$name}]") - ); } } } -- 2.20.1