From 3ad682a3aae5f07a845b9be255c65b8598bdff24 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Wed, 8 Jan 2025 18:00:15 +0000 Subject: [PATCH] Revert "Fix import issue with Bard (#65)" This reverts commit 9e512d0cbab02be31d7e7494d46979a87825041d. --- src/Transformers/BardTransformer.php | 8 -------- tests/Transformers/BardTransformerTest.php | 23 ---------------------- 2 files changed, 31 deletions(-) diff --git a/src/Transformers/BardTransformer.php b/src/Transformers/BardTransformer.php index 536b8a2..2fceb3f 100644 --- a/src/Transformers/BardTransformer.php +++ b/src/Transformers/BardTransformer.php @@ -31,13 +31,6 @@ public function transform(string $value): array $value = collect($value) ->map(function (array $node): ?array { - if ($node['type'] === 'text') { - return [ - 'type' => 'paragraph', - 'content' => [$node], - ]; - } - if ($node['type'] === 'image' && $this->field->get('container') && isset($this->config['assets_base_url'])) { $assetContainer = AssetContainer::find($this->field->get('container')); @@ -64,7 +57,6 @@ public function transform(string $value): array return $node; }) ->filter() - ->values() ->all(); $this->enableBardButtons($value); diff --git a/tests/Transformers/BardTransformerTest.php b/tests/Transformers/BardTransformerTest.php index 835baee..08eecec 100644 --- a/tests/Transformers/BardTransformerTest.php +++ b/tests/Transformers/BardTransformerTest.php @@ -83,29 +83,6 @@ public function it_converts_html_to_prosemirror() ]], $output); } - #[Test] - public function it_handles_text_without_paragraph_tags() - { - $transformer = new BardTransformer( - import: $this->import, - blueprint: $this->blueprint, - field: $this->field, - config: [] - ); - - $output = $transformer->transform(<<<'HTML' -

Blah blah

-Nam voluptatem rem molestiae cumque doloremque. Saepe animi deserunt Maxime iam et inventore. ipsam in dignissimos qui occaecati. -HTML); - - $this->assertEquals([ - ['type' => 'heading', 'attrs' => ['level' => 2, 'textAlign' => 'left'], 'content' => [['type' => 'text', 'text' => 'Blah blah']]], - ['type' => 'paragraph', 'content' => [ - ['type' => 'text', 'text' => 'Nam voluptatem rem molestiae cumque doloremque. Saepe animi deserunt Maxime iam et inventore. ipsam in dignissimos qui occaecati.'], - ]], - ], $output); - } - #[Test] public function it_handles_images() {