Skip to content

Commit

Permalink
Merge pull request #541 from awcodes/fix/php-image-extension
Browse files Browse the repository at this point in the history
Fix: php image extension property exception
  • Loading branch information
awcodes authored Jan 7, 2025
2 parents d2b91fd + 38d75a7 commit 260f4f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Extensions/Nodes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ public function addAttributes(): array
'media' => [
'default' => null,
'parseHTML' => fn ($DOMNode) => $DOMNode->getAttribute('data-media-id') ?: null,
'renderHTML' => fn ($attributes) => $attributes->media ? ['data-media-id' => $attributes->media] : null,
'renderHTML' => function ($attributes) {
if (! property_exists($attributes, 'media')) {
return null;
}

return ['data-media-id' => $attributes->media];
},
],
];
}
Expand Down

0 comments on commit 260f4f1

Please sign in to comment.