Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid auto-escaping in image component #1108

Merged
merged 7 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM boltdesignsystem/bolt-docker:latest
# @todo replace with `boltdesignsystem/bolt-docker:latest` once that is configured correctly
# RUN php -m
# RUN sudo apt-get install --no-install-recommends -y php7.2-gd
# RUN echo "extension=<extension>.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# RUN php -m

WORKDIR /app
COPY . .
EXPOSE 3123
RUN composer global require hirak/prestissimo
# RUN composer global require hirak/prestissimo
RUN yarn run setup
RUN yarn run build

Expand Down
10 changes: 6 additions & 4 deletions packages/components/bolt-image/src/image.twig
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,19 @@
}} />
{% endset %}

{% set children %}
{{ ext == "jpg" ? imagePlaceholder : "" }}
{{ imageTag }}
{% endset %}

<bolt-image {% if placeholderColor and ext == "jpg" %} style="background-color: {{ placeholderColor }};" {% endif %}>
{% block image_content %}
{% if width > 0 and height > 0 and useAspectRatio == true %}
{% include "@bolt-components-ratio/ratio.twig" with {
attributes: attributes,
aspectRatioHeight: height * 1,
aspectRatioWidth: width * 1,
children: [
ext == "jpg" ? imagePlaceholder : "",
imageTag,
] | join("")
children: children
} only %}
{% else %}
{{ ext == "jpg" ? imagePlaceholder : "" }}
Expand Down