From b320989d8e8a140bff478ce150c478c6e5fd16f6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 1 Feb 2019 12:03:21 +0100 Subject: [PATCH] Proper placement of the external link icon for floated images with links --- .../html/output/node/HtmlOutputNodeA.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php index 4d03b03d4e..bc4cee9f5d 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php @@ -87,5 +87,17 @@ class HtmlOutputNodeA extends AbstractHtmlOutputNode { if (!empty($rel)) { $element->setAttribute('rel', $rel); } + + // If the link contains only a single image that is floated to the right, + // then the external link marker is misaligned. Inheriting the CSS class + // will cause the link marker to behave properly. + if ($element->childNodes->length === 1) { + $child = $element->childNodes->item(0); + if ($child->nodeType === XML_ELEMENT_NODE && $child->nodeName === 'img') { + if (preg_match('~\b(?PmessageFloatObject(?:Left|Right))\b~', $child->getAttribute('class'), $match)) { + $element->setAttribute('class', $element->getAttribute('class') . ' ' . $match['className']); + } + } + } } } -- 2.20.1