Skip to content

Commit

Permalink
Refactor(web-twig): FileUploader imageObjectFit data attr changed to …
Browse files Browse the repository at this point in the history
…style

- Update the implementation to set image object fit directly using
CSS properties, eliminating the need for the data attribute and
js plugin
  • Loading branch information
pavelklibani committed Nov 8, 2023
1 parent 728f31b commit 37c34c1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

{# Attributes #}
{%- set _dataImagePreviewAttr = _generateImagePreview ? 'data-spirit-imagePreview="true"' : null -%}
{%- set _imageObjectFitAttr = _imageObjectFit ? 'data-spirit-image-object-fit=' ~ _imageObjectFit : null -%}
{%- set _imageObjectFitAttr = _imageObjectFit ? 'style="--file-uploader-attachment-image-object-fit: ' ~ _imageObjectFit | escape('html_attr') ~ '"' : null -%}

{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
Expand All @@ -34,8 +34,8 @@
{{ _dataImagePreviewAttr | raw }}
>
{% if _generateImagePreview or _imagePreview %}
<span class="{{ _imageClassName }}">
<img src="{{ _imagePreview }}" {{ _imageObjectFitAttr }} width="54" height="54" alt="{{- _fileName -}}" />
<span class="{{ _imageClassName }}" data-spirit-element="attachment-image">
<img src="{{ _imagePreview }}" {{ _imageObjectFitAttr | raw }} width="54" height="54" alt="{{- _fileName -}}" />
</span>
{% endif %}
{% if not _imagePreview %}
Expand Down

0 comments on commit 37c34c1

Please sign in to comment.