Setze Symbole vor Absätze, Nummern in Kreise und Symbole statt Aufzählungspunkte im Text (ADR-69)
Zwei Werkzeuge im Texteditor (Symbol vor dem Absatz, Listenstil); gespeichert werden nur Schlüssel, Bild und Farbe setzt die Ausgabe ein. Kreisfarben aus der Palette, Verwendung wird mitgezählt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67764c3e4f
commit
e904b500fb
24 files changed
+814
-14
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\TextMarkers;
|
||||
use Dom\HTMLDocument;
|
||||
use Dom\Node;
|
||||
use Symfony\Component\HtmlSanitizer\HtmlSanitizer;
|
||||
@@ -557,7 +558,9 @@ private static function block(Node $node): string
|
||||
}
|
||||
}
|
||||
|
||||
return $items === '' ? '' : '<'.$name.'>'.$items.'</'.$name.'>';
|
||||
// Zeichen der Liste (Nummern im Kreis, Symbol): nur Schlüssel, die TextMarkers kennt; im Profil der
|
||||
// Verwaltung hat die Bereinigung sie schon entfernt.
|
||||
return $items === '' ? '' : '<'.$name.TextMarkers::attributes($name, $node).'>'.$items.'</'.$name.'>';
|
||||
}
|
||||
|
||||
$inner = self::inner($node);
|
||||
@@ -571,7 +574,10 @@ private static function block(Node $node): string
|
||||
? ' style="'.$node->getAttribute('style').'"'
|
||||
: '';
|
||||
|
||||
return self::hasContent($inner) ? '<'.$name.$align.'>'.$inner.'</'.$name.'>' : '';
|
||||
// Symbol vor dem Absatz (nur Absätze auf der obersten Ebene, siehe TextMarkers::attributes()).
|
||||
$symbol = $name === 'p' ? TextMarkers::attributes('p', $node) : '';
|
||||
|
||||
return self::hasContent($inner) ? '<'.$name.$align.$symbol.'>'.$inner.'</'.$name.'>' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -779,8 +785,10 @@ private static function sanitizer(bool $site = false): HtmlSanitizer
|
||||
// Das Webprofil lässt zusätzlich Spans (Größe, Farbe) und den Stil an Absätzen und Überschriften zu; siteMarks()
|
||||
// führt beides danach auf feste Werte zurück. Verwaltung und PDF kennen weder Spans noch Stile.
|
||||
$text = $site ? ['style'] : [];
|
||||
$paragraph = $site ? [...$text, ...TextMarkers::PARAGRAPH_ATTRIBUTES] : [];
|
||||
$list = $site ? TextMarkers::LIST_ATTRIBUTES : [];
|
||||
$config = (new HtmlSanitizerConfig)
|
||||
->allowElement('p', $text)
|
||||
->allowElement('p', $paragraph)
|
||||
->allowElement('h3', $text)
|
||||
->allowElement('h4', $text)
|
||||
->allowElement('h5', $text)
|
||||
@@ -795,8 +803,8 @@ private static function sanitizer(bool $site = false): HtmlSanitizer
|
||||
->allowElement('br')
|
||||
->allowElement('strong')
|
||||
->allowElement('em')
|
||||
->allowElement('ul')
|
||||
->allowElement('ol')
|
||||
->allowElement('ul', $list)
|
||||
->allowElement('ol', $list)
|
||||
->allowElement('li')
|
||||
->allowElement('blockquote')
|
||||
->allowElement('table')
|
||||
|
||||
Reference in new issue
Block a user