diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-13 15:27:21 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-04-13 15:47:35 -0300 |
commit | d23bf7443177a85f4c8bf9521dc63da7ccfdd799 (patch) | |
tree | 9c60b67c840a90336a09256098eaf1469249e60d | |
parent | 2143d55665f1899375b99c208745cf8c62c782e0 (diff) |
content: image: take dimensions slot, more powerful than square
-rw-r--r-- | src/content/dependencies/image.js | 10 |
1 files changed, 9 insertions, 1 deletions
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'}, |