Flag empty paragraphs as editor generated
authorAlexander Ebert <ebert@woltlab.com>
Thu, 4 May 2023 13:57:40 +0000 (15:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 8 May 2023 16:34:04 +0000 (18:34 +0200)
wcfsetup/install/files/lib/system/html/input/filter/MessageHtmlInputFilter.class.php
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeProcessor.class.php

index 5f16d41bc6fc19283874f4df93d5d75e5cd3041c..4c69a26999859dbcab8d7ae3c51f917fe52eec8d 100644 (file)
@@ -82,6 +82,9 @@ class MessageHtmlInputFilter implements IHtmlInputFilter
     {
         $definition = $config->getHTMLDefinition(true);
 
+        // <br>
+        $definition->addAttribute('br', 'data-cke-filler', new \HTMLPurifier_AttrDef_Enum(['true']));
+
         // code
         $definition->addAttribute('pre', 'data-file', 'Text');
         $definition->addAttribute('pre', 'data-line', 'Number');
index e7601bccf99128aaf5485fb410d46bd98207013a..0e9c6a9d0257a4acedeb819077e6e49fb3d0a779 100644 (file)
@@ -452,6 +452,7 @@ class HtmlInputNodeProcessor extends AbstractHtmlNodeProcessor
                 $node = $paragraph->childNodes->item(0);
                 if ($node->nodeType === \XML_TEXT_NODE && $node->textContent === "\u{00a0}") {
                     $br = $node->ownerDocument->createElement("br");
+                    $br->setAttribute("data-cke-filler", "true");
                     $node->parentNode->appendChild($br);
                     $node->parentNode->removeChild($node);