« get me outta code hell

content: image: accept class as well as id attribute - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-06 19:56:08 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-06 19:56:08 -0300
commit8a647d1727bc5345c4bcb0066ff195c8e45beea4 (patch)
treedad188db41b1b8f0aef1acb02fdf7c3630ddc9fc /src/content/dependencies
parent46a9ea4039b86a177779c83f49ab4af3d4f1529c (diff)
content: image: accept class as well as id attribute
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/image.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index f9cb00bf..bd7898b1 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -51,6 +51,7 @@ export default {
         square: {type: 'boolean', default: false},
 
         id: {type: 'string'},
+        class: {type: 'string'},
         alt: {type: 'string'},
         width: {type: 'number'},
         height: {type: 'number'},
@@ -86,6 +87,8 @@ export default {
 
         const idOnImg = willLink ? null : slots.id;
         const idOnLink = willLink ? slots.id : null;
+        const classOnImg = willLink ? null : slots.class;
+        const classOnLink = willLink ? slots.class : null;
 
         if (!originalSrc) {
           return prepare(
@@ -119,6 +122,7 @@ export default {
 
         const imgAttributes = {
           id: idOnImg,
+          class: classOnImg,
           alt: slots.alt,
           width: slots.width,
           height: slots.height,
@@ -189,6 +193,7 @@ export default {
                   'box',
                   'image-link',
                   hide && 'js-hide',
+                  classOnLink,
                 ],
 
                 href: