Fix the image resizing of aligned images
authorAlexander Ebert <ebert@woltlab.com>
Mon, 17 Jul 2023 11:25:41 +0000 (13:25 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 17 Jul 2023 11:25:41 +0000 (13:25 +0200)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeImg.class.php

index a6694618a48a82c4a8e826dc057f3db84c4e0092..371a343c980051ad9841f009f99c71fc1f569717 100644 (file)
@@ -267,6 +267,14 @@ class HtmlInputNodeImg extends AbstractHtmlInputNode
 
     protected function mirrorWidthAttribute(\DOMElement $element): void
     {
+        // Aligned images are wrapped in a `<figure>` element that is the target
+        // of the resize operation.
+        if ($element->parentNode->nodeName === 'figure') {
+            $this->mirrorWidthAttribute($element->parentNode);
+            return;
+        }
+
+
         $width = $element->getAttribute("data-width");
         if ($width && $width !== "100%") {
             $style = $element->getAttribute("style");