Skip to content

Commit

Permalink
Revert "Fix import issue with Bard (#65)"
Browse files Browse the repository at this point in the history
This reverts commit 9e512d0.
  • Loading branch information
duncanmcclean authored Jan 8, 2025
1 parent 65a9193 commit 3ad682a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
8 changes: 0 additions & 8 deletions src/Transformers/BardTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand All @@ -64,7 +57,6 @@ public function transform(string $value): array
return $node;
})
->filter()
->values()
->all();

$this->enableBardButtons($value);
Expand Down
23 changes: 0 additions & 23 deletions tests/Transformers/BardTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
<h2>Blah blah</h2>
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()
{
Expand Down

0 comments on commit 3ad682a

Please sign in to comment.