Fix that wsm images can inside a link
authorCyperghost <olaf_schmitz_1@t-online.de>
Mon, 5 Feb 2024 11:30:25 +0000 (12:30 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Mon, 5 Feb 2024 11:30:25 +0000 (12:30 +0100)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php

index e7bc34656dc6a663619d74dceb701e19953930d3..a881b61e6422dce018b6d5283d6cc45d67932ea5 100644 (file)
@@ -182,15 +182,19 @@ class HtmlInputNodeImg extends AbstractHtmlInputNode
         }
 
         $replaceElement = $element;
-        $parent = $this->getParentFigure($element);
-        if ($parent !== null) {
-            if (\preg_match('~\b(?<float>image-style-side-left|image-style-side)\b~', $parent->getAttribute('class'), $matches)) {
+        $figure = $this->getParentFigure($element);
+        if ($figure !== null) {
+            if (\preg_match('~\b(?<float>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 = [