From d8b766ddf82316727a6f8fad6e3df4e470d8fa9b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 13 Apr 2024 15:42:53 -0300 Subject: content: image: remove width/height slots --- src/content/dependencies/image.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/content/dependencies/image.js') diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js index 134f99c9..93e76583 100644 --- a/src/content/dependencies/image.js +++ b/src/content/dependencies/image.js @@ -69,8 +69,6 @@ export default { }, alt: {type: 'string'}, - width: {type: 'number'}, - height: {type: 'number'}, attributes: { type: 'attributes', @@ -139,8 +137,13 @@ export default { !isMissingImageFile && !empty(contentWarnings); + const hasBothDimensions = + !!(slots.dimensions && + slots.dimensions[0] !== null && + slots.dimensions[1] !== null); + const willSquare = - (slots.dimensions + (hasBothDimensions ? slots.dimensions[0] === slots.dimensions[1] : slots.square); @@ -148,8 +151,12 @@ export default { {class: 'image'}, slots.alt && {alt: slots.alt}, - slots.width && {width: slots.width}, - slots.height && {height: slots.height}, + + slots.dimensions?.[0] && + {width: slots.dimensions[0]}, + + slots.dimensions?.[1] && + {width: slots.dimensions[1]}, ]); const isPlaceholder = -- cgit 1.3.0-6-gf8a5