From: Cyperghost Date: Mon, 5 Feb 2024 11:30:25 +0000 (+0100) Subject: Fix that wsm images can inside a link X-Git-Tag: 6.1.0_Alpha_1~175^2~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6fafaf3ad6c916b27f9ac871d91003360de35d9c;p=GitHub%2FWoltLab%2FWCF.git Fix that wsm images can inside a link --- 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 = [