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>
31 lines
1.3 KiB
JavaScript
31 lines
1.3 KiB
JavaScript
// Zeichen im Text der Website (ADR-69): Symbol vor einem Absatz, Nummern im Kreis, Symbol statt Aufzählungspunkt.
|
|
// Der Editor führt nur Schlüssel als Attribute der Knoten: data-symbol am Absatz; data-marker, data-symbol und data-tone an
|
|
// Aufzählung und Nummerierung. Bilder und Farben setzt erst die Ausgabe der Website ein.
|
|
// Gegenstück: App\Filament\Support\TipTap\TextMarksExtension (PHP-Modell beim Speichern). Filament lädt diese Datei als
|
|
// Erweiterung (RichContentPlugin::getTipTapJsExtensions) und stellt TipTap über window.FilamentRichEditor bereit.
|
|
const { Extension } = window.FilamentRichEditor.tiptap.core
|
|
|
|
const attribute = (name) => ({
|
|
default: null,
|
|
parseHTML: (element) => element.getAttribute(name),
|
|
renderHTML: (attributes) => (attributes[name] ? { [name]: attributes[name] } : {}),
|
|
})
|
|
|
|
export default Extension.create({
|
|
name: 'textMarks',
|
|
|
|
addGlobalAttributes() {
|
|
return [
|
|
{ types: ['paragraph'], attributes: { 'data-symbol': attribute('data-symbol') } },
|
|
{
|
|
types: ['bulletList', 'orderedList'],
|
|
attributes: {
|
|
'data-marker': attribute('data-marker'),
|
|
'data-symbol': attribute('data-symbol'),
|
|
'data-tone': attribute('data-tone'),
|
|
},
|
|
},
|
|
]
|
|
},
|
|
})
|