« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/image.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 1582d3f4..db307a6b 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -55,6 +55,10 @@ export default {
       validate: v => v.isColor,
     },
 
+    warnings: {
+      validate: v => v.looseArrayOf(v.isString),
+    },
+
     reveal: {type: 'boolean', default: true},
     lazy: {type: 'boolean', default: false},
     square: {type: 'boolean', default: false},
@@ -120,11 +124,15 @@ export default {
       !isMissingImageFile &&
       (typeof slots.link === 'string' || slots.link);
 
+    const contentWarnings =
+      slots.warnings ??
+      data.contentWarnings;
+
     const willReveal =
       slots.reveal &&
       originalSrc &&
       !isMissingImageFile &&
-      !empty(data.contentWarnings);
+      !empty(contentWarnings);
 
     const willSquare = slots.square;
 
@@ -159,7 +167,7 @@ export default {
 
         html.tag('span', {class: 'reveal-warnings'},
           language.$('misc.contentWarnings.warnings', {
-            warnings: language.formatUnitList(data.contentWarnings),
+            warnings: language.formatUnitList(contentWarnings),
           })),
 
         html.tag('br'),