From 6fafaf3ad6c916b27f9ac871d91003360de35d9c Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Mon, 5 Feb 2024 12:30:25 +0100 Subject: [PATCH] Fix that wsm images can inside a link --- .../html/input/node/HtmlInputNodeImg.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php index e7bc34656d..a881b61e64 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php @@ -182,15 +182,19 @@ class HtmlInputNodeImg extends AbstractHtmlInputNode } $replaceElement = $element; - $parent = $this->getParentFigure($element); - if ($parent !== null) { - if (\preg_match('~\b(?image-style-side-left|image-style-side)\b~', $parent->getAttribute('class'), $matches)) { + $figure = $this->getParentFigure($element); + if ($figure !== null) { + if (\preg_match('~\b(?image-style-side-left|image-style-side)\b~', $figure->getAttribute('class'), $matches)) { $float = ($matches['float'] === 'image-style-side-left') ? 'left' : 'right'; } else { $float = 'center'; } - $replaceElement = $parent; + $replaceElement = $figure; + if (($element->parentNode instanceof \DOMElement) && $element->parentNode->nodeName === "a") { + DOMUtil::replaceElement($figure, $element->parentNode, false); + $replaceElement = $element; + } } $attributes = [ -- 2.20.1