From 6c016c55e05f69eb346bb18979c9809b689bf004 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 8 May 2023 18:11:35 +0200 Subject: [PATCH] =?utf8?q?Replace=20`

=E2=80=A6

`=20with=20`

`?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../node/HtmlOutputNodeNormalizer.class.php | 9 +++++++++ .../node/HtmlOutputNodeProcessor.class.php | 16 ++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php index cb59e84d05..07c5d43d3c 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeNormalizer.class.php @@ -20,6 +20,8 @@ final class HtmlOutputNodeNormalizer $candidates = $this->getPossibleSpacerParagraphs($xpath); $this->reduceSpacerParagraphs($candidates); + + $this->stripMarkerOnBr($xpath); } /** @@ -149,4 +151,11 @@ final class HtmlOutputNodeNormalizer $br->remove(); } } + + private function stripMarkerOnBr(\DOMXPath $xpath): void + { + foreach ($xpath->query(".//br[@data-cke-filler='true']") as $br) { + $br->removeAttribute("data-cke-filler"); + } + } } diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php index 2a6a109505..fd214e0cc7 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php @@ -122,18 +122,10 @@ class HtmlOutputNodeProcessor extends AbstractHtmlNodeProcessor } if (!$isLastNode) { - // check if paragraph only contains
- if (StringUtil::trim($paragraph->textContent) === '') { - // get last element - $element = $paragraph->firstChild; - while ($element && $element->nodeType !== \XML_ELEMENT_NODE) { - $element = $element->nextSibling; - } - - if ($paragraph->childNodes->length === 0 || ($element && $element->nodeName === 'br')) { - DOMUtil::removeNode($paragraph, true); - continue; - } + // Add an extra `
` unless the paragraph already contains a `
`. + if ($paragraph->childNodes->length !== 1 || $paragraph->childNodes->item(0)->nodeName !== 'br') { + $br = $this->getDocument()->createElement('br'); + $paragraph->appendChild($br); } $br = $this->getDocument()->createElement('br'); -- 2.20.1