Führe Dokumente mit Kapiteln, Fassung, Seite und PDF mit Inhaltsverzeichnis ein (ADR-51)
Ein Dokument ist eine Komposition der Art document, ein Kapitel ein Text mit der automatischen Materialart Dokumentkapitel; die Ebene steht in der Rolle. Der Aufbaueditor bekommt den Kapitelarbeitsplatz (Übersicht, Ordnen als Block, offene Eingaben bleiben beim Wechsel erhalten, Speichern als Entwurf, Bereitstellen als Dokumentfassung). Module und Programme binden eine Fassung über den gemeinsamen Picker ein. Mitglieder lesen sie mit anklickbarem Inhaltsverzeichnis und laden ein PDF mit Inhaltsverzeichnis, Seitenzahlen, Tabellen und Bildern. Ein älterer Stand liefert die gebundene Fassung weiter. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c57a506f85
commit
3e2fd872c2
43 files changed
+2827
-64
No files matched your search
@@ -127,12 +127,25 @@ public function test_an_image_is_a_reference_to_an_image_version_and_never_an_ad
|
||||
{
|
||||
$html = FormattedText::canonical('<p>Davor</p><img data-id="12" alt="Ein Bild" src="https://evil.example/x.png" onerror="x()" width="40"><p>Danach</p><img src="y.png"><p>Eingebettet <img data-id="9" alt="x"> im Absatz</p>');
|
||||
|
||||
$this->assertSame('<p>Davor</p><img data-id="12" alt="Ein Bild"><p>Danach</p><p>Eingebettet im Absatz</p>', $html);
|
||||
$this->assertSame([12], FormattedText::imageIds($html));
|
||||
$this->assertSame('<p>Davor</p><img data-id="12" alt="Ein Bild"><p>Danach</p><p>Eingebettet <img data-id="9" alt="x"> im Absatz</p>', $html, 'Der Editor setzt ein Bild mitten in einen Absatz; es bleibt dort.');
|
||||
$this->assertSame([12, 9], FormattedText::imageIds($html));
|
||||
$this->assertSame([['type' => 'paragraph', 'text' => 'Eingebettet'], ['type' => 'image', 'id' => 9], ['type' => 'paragraph', 'text' => 'im Absatz']], array_map(fn (array $block): array => $block['type'] === 'image' ? ['type' => 'image', 'id' => $block['id']] : ['type' => $block['type'], 'text' => trim(implode('', array_column($block['runs'], 'text')))], array_slice(FormattedText::blocks($html), 3)), 'Im PDF teilt das Bild den Absatz.');
|
||||
$this->assertSame('<h3>Kopf</h3><ul><li><p>Punkt</p></li></ul>', FormattedText::canonical('<h3>Kopf<img data-id="5"></h3><ul><li><p>Punkt<img data-id="6"></p></li></ul>'), 'In Überschrift und Liste entfällt ein Bild.');
|
||||
$this->assertSame($html, FormattedText::canonical($html));
|
||||
$this->assertSame('<img data-id="3" alt="">', FormattedText::canonical('<img data-id="3" alt="">'), 'Ein Text nur aus einem Bild ist nicht leer.');
|
||||
}
|
||||
|
||||
public function test_an_image_in_a_table_cell_is_kept_because_the_editor_can_put_it_there(): void
|
||||
{
|
||||
$html = FormattedText::canonical('<table><tbody><tr><td><p>Stuhlkreis</p><img data-id="7" alt="Aufstellung" src="x.png"></td></tr></tbody></table>');
|
||||
|
||||
$this->assertSame('<table><tbody><tr><td><p>Stuhlkreis</p><img data-id="7" alt="Aufstellung"></td></tr></tbody></table>', $html);
|
||||
$this->assertSame([7], FormattedText::imageIds($html));
|
||||
$this->assertSame('image', FormattedText::blocks($html)[0]['rows'][0][0]['blocks'][1]['type']);
|
||||
$this->assertSame($html, FormattedText::canonical($html));
|
||||
$this->assertSame('<table><tbody><tr><td><img data-id="7" alt=""></td></tr></tbody></table>', FormattedText::canonical('<table><tbody><tr><td><img data-id="7"></td></tr></tbody></table>'), 'Eine Zelle nur mit Bild bleibt erhalten.');
|
||||
}
|
||||
|
||||
public function test_images_appear_only_where_the_reader_resolves_them(): void
|
||||
{
|
||||
$html = '<p>Davor</p><img data-id="12" alt="Ein Bild"><img data-id="13" alt="Anderes"><p>Danach</p>';
|
||||
|
||||
Reference in new issue
Block a user