@mindful-web/image 1.84.0 → 1.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/create-alt-for.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindful-web/image",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.96.0",
|
|
4
4
|
"description": "Common image utilities for Mindful Web projects.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Jacob Bare <jacob@parameter1.com>",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@mindful-web/html": "^1.84.0",
|
|
16
16
|
"@mindful-web/inflector": "^1.0.0",
|
|
17
|
-
"@mindful-web/utils": "^1.
|
|
17
|
+
"@mindful-web/utils": "^1.92.0"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "d088c8e3959d3371f48648bf5fcd04fa71cba40b"
|
|
23
23
|
}
|
package/src/create-alt-for.js
CHANGED
|
@@ -26,6 +26,7 @@ const clean = (v, { prepend, append }) => {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
module.exports = ({
|
|
29
|
+
alt,
|
|
29
30
|
displayName,
|
|
30
31
|
caption,
|
|
31
32
|
name,
|
|
@@ -33,6 +34,8 @@ module.exports = ({
|
|
|
33
34
|
prepend,
|
|
34
35
|
append,
|
|
35
36
|
} = {}) => {
|
|
37
|
+
// the image's own alt text (written by Mindful CMS), when set, before any fallback
|
|
38
|
+
if (alt) return clean(alt, { prepend, append });
|
|
36
39
|
if (displayName) return clean(displayName, { prepend, append });
|
|
37
40
|
if (caption) return clean(caption, { prepend, append });
|
|
38
41
|
if (name) return clean(altFrom(name), { prepend, append });
|