🐛 Fix: image shortcode invalid params height and weight (#200)

This commit is contained in:
Cell
2022-09-24 13:56:40 +08:00
parent 22f7a226e3
commit bd5b9a6328
4 changed files with 22 additions and 8 deletions
+1
View File
@@ -37,6 +37,7 @@ All notable changes to this project will be documented in this file.
- :bug: Fix: `center-quote` shortcode rendering error when config `unsafe = false` (@yureiita[#160](https://github.com/hugo-fixit/FixIt/pull/160))
- :bug: Fix: menu item invalid params `draft` in submenu
- :bug: Fix: missing height and weight of img element and lazyload object-fit style
- :bug: Fix: image shortcode invalid params `height` and `weight` ([#200](https://github.com/hugo-fixit/FixIt/issues/200))
- :bug: Fix: typeit shortcode invalid config `duration = -1` and fix style
- :bug: Fix: typeit shortcode prints consecutive spaces and newline errors
- :art: Style: change the default icons of some social links
+5 -5
View File
@@ -71,10 +71,10 @@
height: auto;
margin: 0 auto;
overflow: hidden;
}
img.lazyloaded {
width: 100%;
&.lazyloaded {
width: 100%;
}
}
}
@@ -290,7 +290,7 @@
margin: 0 auto;
overflow: hidden;
&.lazyloaded {
&.lazyloaded:not([data-w]) {
width: 100%;
}
}
@@ -301,7 +301,7 @@
@include object-fit(none);
}
.lazyloaded {
.lazyloaded:not([data-h]) {
@include object-fit(fill);
}
+1 -1
Submodule docs updated: fe8f41062c...d805b77640
+15 -2
View File
@@ -8,6 +8,15 @@
{{- $height = $height | default .Height -}}
{{- end -}}
{{- $style := "" -}}
{{- with $width -}}
{{- $style = printf "width: %v;" . -}}
{{- end -}}
{{- with $height -}}
{{- $style = printf "%vheight: %v;" $style . -}}
{{- end -}}
{{- /* with $style }} {{ printf "style=\"%v\"" $style | safeHTMLAttr -}}{{- end */ -}}
{{- $small := .SrcSmall | default $src -}}
{{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}}
{{- $small = .RelPermalink -}}
@@ -31,8 +40,10 @@
data-sizes="auto"
alt="{{ $alt }}"
title="{{ .Title | default $alt }}"
{{- with .Height }} height="{{ . }}"{{- end -}}
{{- with .Width }} width="{{ . }}"{{- end -}}
{{- with $width }} width="{{ . }}"{{- end -}}
{{- with $height }} height="{{ . }}"{{- end -}}
{{- with .Width }} data-w{{- end -}}
{{- with .Height }} data-h{{- end -}}
/>
</a>
{{- else -}}
@@ -46,5 +57,7 @@
title="{{ .Title | default $alt }}"
{{- with $width }} width="{{ . }}"{{- end -}}
{{- with $height }} height="{{ . }}"{{- end -}}
{{- with .Width }} data-w{{- end -}}
{{- with .Height }} data-h{{- end -}}
/>
{{- end -}}