Skip to content

Commit

Permalink
Ensure text nodes are wrapped in paragraph nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Dec 19, 2024
1 parent 1031c0f commit d664bf9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Transformers/BardTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public function transform(string $value): array

return 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 Down

0 comments on commit d664bf9

Please sign in to comment.