From: Cyperghost Date: Mon, 22 Jan 2024 11:00:59 +0000 (+0100) Subject: Simplify the code X-Git-Tag: 6.0.7_dev_1~7^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=377f389b7f72a8e6548a3f3b2e173cd5613ee3f0;p=GitHub%2FWoltLab%2FWCF.git Simplify the code --- diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php index 5b794e2b1e..4a54c26943 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php @@ -810,24 +810,22 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor $nextSibling = $this->getNonEmptyNode($parentLinkElement, 'nextSibling'); $previousSibling = $this->getNonEmptyNode($parentLinkElement, 'previousSibling'); - // Check whether the link is at the beginning or end of the paragraph - // and whether the next or previous sibling is a line break. + // Check whether the link is the only content in the line. + // To do this, we need to check whether the next/previous sibling is a `
' element or + // is the start/end of the paragraph. //

https://example.com
…

//

…
https://example.com

- if ( - ($nextSibling === null && $previousSibling !== null && $previousSibling->nodeName === 'br') - || ($previousSibling === null && $nextSibling !== null && $nextSibling->nodeName === 'br') - ) { - $this->plainLinks[] = $plainLink->setIsStandalone($parent, false); - continue; - } - // If not, the previous and next sibling may be a line break. //

…
https://example.com
…

//

…
https://example.com
…

- if ( - $previousSibling !== null && $nextSibling !== null - && $previousSibling->nodeName === 'br' && $nextSibling->nodeName === 'br' - ) { + + if ($nextSibling !== null && $nextSibling->nodeName === 'br') { + $nextSibling = null; + } + if ($previousSibling !== null && $previousSibling->nodeName === 'br') { + $previousSibling = null; + } + + if ($nextSibling === null && $previousSibling === null) { $this->plainLinks[] = $plainLink->setIsStandalone($parent, false); continue; }