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
@@ -12,7 +12,7 @@
|
||||
final class RichText
|
||||
{
|
||||
/** Werkzeugleiste des Editors; muss zur Erlaubnisliste unten passen. */
|
||||
public const TOOLBAR = [['bold', 'italic', 'link', 'interneSeite'], ['bulletList', 'orderedList'], ['undo', 'redo']];
|
||||
public const TOOLBAR = [['bold', 'italic', 'link', 'interneSeite'], ['bulletList', 'orderedList'], ['absatzSymbol', 'listenStil'], ['undo', 'redo']];
|
||||
|
||||
private static ?HtmlSanitizer $sanitizer = null;
|
||||
|
||||
@@ -22,7 +22,8 @@ public static function sanitize(?string $html): string
|
||||
return '';
|
||||
}
|
||||
|
||||
return trim(self::sanitizer()->sanitize($html));
|
||||
// Zeichen vor Absätzen und in Listen (ADR-69) bleiben nur mit bekannten Schlüsseln erhalten.
|
||||
return TextMarkers::clean(trim(self::sanitizer()->sanitize($html)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,14 +61,14 @@ private static function sanitizer(): HtmlSanitizer
|
||||
{
|
||||
return self::$sanitizer ??= new HtmlSanitizer(
|
||||
(new HtmlSanitizerConfig)
|
||||
->allowElement('p')
|
||||
->allowElement('p', TextMarkers::PARAGRAPH_ATTRIBUTES)
|
||||
->allowElement('br')
|
||||
->allowElement('strong')
|
||||
->allowElement('b')
|
||||
->allowElement('em')
|
||||
->allowElement('i')
|
||||
->allowElement('ul')
|
||||
->allowElement('ol')
|
||||
->allowElement('ul', TextMarkers::LIST_ATTRIBUTES)
|
||||
->allowElement('ol', TextMarkers::LIST_ATTRIBUTES)
|
||||
->allowElement('li')
|
||||
->allowElement('a', ['href'])
|
||||
->allowLinkSchemes(['http', 'https', 'mailto'])
|
||||
|
||||
Reference in new issue
Block a user