Skip to content

Commit

Permalink
Do not overwrite existing style tag values on native wordpress attach…
Browse files Browse the repository at this point in the history
…ment images
  • Loading branch information
hirasso committed Jan 17, 2025
1 parent e4b819b commit 0735c23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/moody-snails-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"focal-point-picker": patch
---

Do not overwrite existing style tag values on native wordpress attachment images
3 changes: 2 additions & 1 deletion src/FocalPointPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public static function wp_get_attachment_image_attributes(
$atts['class'] .= " focal-point-image";
}

$atts['style'] = "--focal-point-left: {$focalPoint->left}; --focal-point-top: {$focalPoint->top}";
$atts['style'] ??= '';
$atts['style'] .= " --focal-point-left: {$focalPoint->left}; --focal-point-top: {$focalPoint->top}; ";

return $atts;
}
Expand Down

0 comments on commit 0735c23

Please sign in to comment.