Fix: Umbrueche bleiben beim Bearbeiten von Legacy-PMs erhalten
Bestehende (importierte) Pressemitteilungen speichern ihren Text als Plaintext mit \n-Umbruechen. Beim Laden in den HTML-Editor (flux:editor) kollabierten diese zu einem Fliesssatz, weil HTML Whitespace faltet. Die Plaintext->HTML-Konvertierung (Doppelumbruch = Absatz, Einzelumbruch = <br>) lag bisher nur im Anzeige-Pfad (render()). Sie ist jetzt als toEditorHtml() wiederverwendbar und wird beim Laden des Editors genutzt; die Link-Policy (rel/target) bleibt dabei dem Anzeige-Pfad vorbehalten. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
624fca68a8
commit
bcac326814
4 changed files with 93 additions and 4 deletions
|
|
@ -59,6 +59,36 @@ test('editor shows the content score panel when a score exists', function () {
|
|||
->assertSee('Noch 13 Punkte bis zur nächsten Stufe.');
|
||||
});
|
||||
|
||||
test('mount converts legacy plain-text body to editable html so line breaks survive', function () {
|
||||
/** @var TestCase $this */
|
||||
['customer' => $customer, 'pr' => $pr] = makeCustomerWithPressRelease([
|
||||
'text' => "Erster Absatz mit Inhalt.\nZweite Zeile desselben Absatzes.\n\nNeuer Absatz nach Leerzeile.",
|
||||
]);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
$component = LivewireVolt::test('customer.press-releases.edit', ['id' => $pr->id]);
|
||||
$loaded = $component->get('text');
|
||||
|
||||
expect($loaded)->toContain('<p>');
|
||||
expect($loaded)->toContain('Erster Absatz mit Inhalt.<br');
|
||||
expect($loaded)->toContain('<p>Neuer Absatz nach Leerzeile.</p>');
|
||||
});
|
||||
|
||||
test('mount leaves stored html body untouched in structure', function () {
|
||||
/** @var TestCase $this */
|
||||
['customer' => $customer, 'pr' => $pr] = makeCustomerWithPressRelease([
|
||||
'text' => '<p>Absatz eins.</p><p>Absatz zwei.</p>',
|
||||
]);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
$loaded = LivewireVolt::test('customer.press-releases.edit', ['id' => $pr->id])->get('text');
|
||||
|
||||
expect($loaded)->toContain('<p>Absatz eins.</p>');
|
||||
expect($loaded)->toContain('<p>Absatz zwei.</p>');
|
||||
});
|
||||
|
||||
test('mount loads all Phase 7 fields and pivot contact', function () {
|
||||
/** @var TestCase $this */
|
||||
['customer' => $customer, 'pr' => $pr, 'contact' => $contact] = makeCustomerWithPressRelease([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue