From d23bf7443177a85f4c8bf9521dc63da7ccfdd799 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 13 Apr 2024 15:27:21 -0300 Subject: content: image: take dimensions slot, more powerful than square --- src/content/dependencies/image.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js index db307a6b..134f99c9 100644 --- a/src/content/dependencies/image.js +++ b/src/content/dependencies/image.js @@ -61,8 +61,13 @@ export default { reveal: {type: 'boolean', default: true}, lazy: {type: 'boolean', default: false}, + square: {type: 'boolean', default: false}, + dimensions: { + validate: v => v.isDimensions, + }, + alt: {type: 'string'}, width: {type: 'number'}, height: {type: 'number'}, @@ -134,7 +139,10 @@ export default { !isMissingImageFile && !empty(contentWarnings); - const willSquare = slots.square; + const willSquare = + (slots.dimensions + ? slots.dimensions[0] === slots.dimensions[1] + : slots.square); const imgAttributes = html.attributes([ {class: 'image'}, -- cgit 1.3.0-6-gf8a5