@ndla/article-converter 1.0.12 → 1.0.15

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.
@@ -43,6 +43,16 @@ export var divPlugin = function divPlugin(node, opts) {
43
43
  children: domToReact(files, opts)
44
44
  }) : undefined, domToReact(pdfs, opts)]
45
45
  });
46
+ } else if (node.attribs['class'].includes('c-bodybox') && node.childNodes.filter(function (c) {
47
+ return 'attribs' in c;
48
+ }).some(function (c) {
49
+ return c.name === 'table';
50
+ })) {
51
+ var _props = attributesToProps(node.attribs);
52
+ return _jsx("div", _objectSpread(_objectSpread({}, _props), {}, {
53
+ className: "".concat(_props.className, " c-bodybox--contains-table"),
54
+ children: domToReact(node.children, opts)
55
+ }));
46
56
  }
47
57
  return null;
48
58
  };
@@ -40,6 +40,16 @@ var divPlugin = function divPlugin(node, opts) {
40
40
  children: (0, _htmlReactParser.domToReact)(files, opts)
41
41
  }) : undefined, (0, _htmlReactParser.domToReact)(pdfs, opts)]
42
42
  });
43
+ } else if (node.attribs['class'].includes('c-bodybox') && node.childNodes.filter(function (c) {
44
+ return 'attribs' in c;
45
+ }).some(function (c) {
46
+ return c.name === 'table';
47
+ })) {
48
+ var _props = (0, _htmlReactParser.attributesToProps)(node.attribs);
49
+ return (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, _props), {}, {
50
+ className: "".concat(_props.className, " c-bodybox--contains-table"),
51
+ children: (0, _htmlReactParser.domToReact)(node.children, opts)
52
+ }));
43
53
  }
44
54
  return null;
45
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "1.0.12",
3
+ "version": "1.0.15",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ndla/code": "^2.1.25",
34
- "@ndla/ui": "^35.0.6",
34
+ "@ndla/ui": "^35.0.9",
35
35
  "html-react-parser": "^3.0.8",
36
36
  "lodash": "^4.17.20"
37
37
  },
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "30cbfc9784fbadda461c414e7683f731bad1bdc9"
47
+ "gitHead": "27dac8e675121d005ea26442c1391d83fa4c04ea"
48
48
  }
@@ -16,7 +16,7 @@ export const divPlugin: PluginType = (node, opts) => {
16
16
 
17
17
  return (
18
18
  <RelatedArticleListV2 {...props} headingLevel="h3">
19
- {/* @ts-ignore */}
19
+ {/* @ts-ignore */}
20
20
  {domToReact(node.children, opts)}
21
21
  </RelatedArticleListV2>
22
22
  );
@@ -35,6 +35,16 @@ export const divPlugin: PluginType = (node, opts) => {
35
35
  {domToReact(pdfs, opts)}
36
36
  </>
37
37
  );
38
+ } else if (
39
+ node.attribs['class'].includes('c-bodybox') &&
40
+ node.childNodes.filter((c): c is Element => 'attribs' in c).some((c) => c.name === 'table')
41
+ ) {
42
+ const props = attributesToProps(node.attribs);
43
+ return (
44
+ <div {...props} className={`${props.className} c-bodybox--contains-table`}>
45
+ {domToReact(node.children, opts)}
46
+ </div>
47
+ );
38
48
  }
39
49
  return null;
40
50
  };