@parameter1/base-cms-marko-web 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parameter1/base-cms-marko-web",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Core Marko+Express components for BaseCMS websites",
5
5
  "author": "Jacob Bare <jacob@parameter1.com>",
6
6
  "main": "index.js",
@@ -25,7 +25,7 @@
25
25
  "@parameter1/base-cms-object-path": "^3.0.0",
26
26
  "@parameter1/base-cms-tenant-context": "^3.0.0",
27
27
  "@parameter1/base-cms-utils": "^3.0.0",
28
- "@parameter1/base-cms-web-common": "^3.0.0",
28
+ "@parameter1/base-cms-web-common": "^3.3.1",
29
29
  "cookie-parser": "^1.4.5",
30
30
  "express": "^4.17.1",
31
31
  "express-http-proxy": "^1.6.2",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "ee5705e924b161f9617b1984a95c21f73004e4b5"
49
+ "gitHead": "28ccd5f7561f59051f43eefc429804866368a1d3"
50
50
  }
@@ -6,6 +6,13 @@ const stringifyAttrs = attrs => Object.keys(attrs).reduce((arr, key) => {
6
6
  return arr;
7
7
  }, []).join(' ');
8
8
 
9
+ const buildWrapperClass = ({ caption, credit }) => {
10
+ const classes = [];
11
+ if (caption) classes.push('image-with-caption');
12
+ if (credit) classes.push('image-with-credit');
13
+ return classes.join(' ');
14
+ };
15
+
9
16
  module.exports = (tag, { config } = {}, { lazyloadImages } = {}) => {
10
17
  const lazyload = lazyloadImages == null ? config.lazyloadImages() : lazyloadImages;
11
18
  const src = tag.get('src');
@@ -17,10 +24,13 @@ module.exports = (tag, { config } = {}, { lazyloadImages } = {}) => {
17
24
  const width = tag.get('width');
18
25
  const height = tag.get('height');
19
26
 
27
+ const wrapperClass = buildWrapperClass({ caption, credit });
28
+
20
29
  const attrs = {
21
30
  'data-embed-type': tag.type,
22
31
  'data-embed-id': tag.id,
23
32
  'data-embed-align': align,
33
+ ...(wrapperClass && { class: wrapperClass }),
24
34
  };
25
35
 
26
36
  const minWidth = 400;