From 7be2d558d35cf02863a10427b0877bddae424e97 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Sat, 9 Apr 2022 18:34:30 +0200 Subject: Use float classes instead of inline styles Commit ea7baaa (templates: Allow setting 'float' for figures in the 'img' shortcode, 2022-04-09) introduces inline styles which were considered more straightforward than adding special CSS rules. Sadly, restrictive Content-Security-Policy settings will make browsers disregard inline styles as a security measure. Since we don't want to turn off CSP, this comment implement CSS rules for setting the float attribute on elements. --- sass/style.sass | 6 ++++++ templates/shortcodes/img.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sass/style.sass b/sass/style.sass index 69c0b1c..29de71b 100644 --- a/sass/style.sass +++ b/sass/style.sass @@ -118,6 +118,12 @@ body color: var(--fg-color) background-color: var(--bg-color) +.float-left + float: left + +.float-right + float: right + main display: flex flex-direction: column diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html index 320ac84..d57e54e 100644 --- a/templates/shortcodes/img.html +++ b/templates/shortcodes/img.html @@ -3,7 +3,7 @@ {% if not float -%}
{% else -%} -
+
{% endif -%} {{ alt }} -- cgit v1.2.3-2-gb3c3