@ndla/article-converter 1.0.16 → 1.0.19

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.
@@ -22,6 +22,7 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
22
22
  import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
23
23
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
24
24
  export var divPlugin = function divPlugin(node, opts) {
25
+ var _node$attribs$class;
25
26
  if (node.attribs['data-type'] === 'related-content' && node.children.length) {
26
27
  var props = attributesToProps(node.attribs);
27
28
  return _jsx(RelatedArticleListV2, _objectSpread(_objectSpread({}, props), {}, {
@@ -43,7 +44,7 @@ export var divPlugin = function divPlugin(node, opts) {
43
44
  children: domToReact(files, opts)
44
45
  }) : undefined, domToReact(pdfs, opts)]
45
46
  });
46
- } else if (node.attribs['class'].includes('c-bodybox') && node.childNodes.filter(function (c) {
47
+ } else if ((_node$attribs$class = node.attribs['class']) !== null && _node$attribs$class !== void 0 && _node$attribs$class.includes('c-bodybox') && node.childNodes.filter(function (c) {
47
48
  return 'attribs' in c;
48
49
  }).some(function (c) {
49
50
  return c.name === 'table';
@@ -19,6 +19,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
19
19
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
20
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
  var divPlugin = function divPlugin(node, opts) {
22
+ var _node$attribs$class;
22
23
  if (node.attribs['data-type'] === 'related-content' && node.children.length) {
23
24
  var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
24
25
  return (0, _jsxRuntime.jsx)(_ui.RelatedArticleListV2, _objectSpread(_objectSpread({}, props), {}, {
@@ -40,7 +41,7 @@ var divPlugin = function divPlugin(node, opts) {
40
41
  children: (0, _htmlReactParser.domToReact)(files, opts)
41
42
  }) : undefined, (0, _htmlReactParser.domToReact)(pdfs, opts)]
42
43
  });
43
- } else if (node.attribs['class'].includes('c-bodybox') && node.childNodes.filter(function (c) {
44
+ } else if ((_node$attribs$class = node.attribs['class']) !== null && _node$attribs$class !== void 0 && _node$attribs$class.includes('c-bodybox') && node.childNodes.filter(function (c) {
44
45
  return 'attribs' in c;
45
46
  }).some(function (c) {
46
47
  return c.name === 'table';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -27,11 +27,11 @@
27
27
  "src"
28
28
  ],
29
29
  "devDependencies": {
30
- "@ndla/types-embed": "^1.0.3"
30
+ "@ndla/types-embed": "^1.0.5"
31
31
  },
32
32
  "dependencies": {
33
- "@ndla/code": "^2.1.26",
34
- "@ndla/ui": "^35.0.10",
33
+ "@ndla/code": "^2.1.29",
34
+ "@ndla/ui": "^35.0.13",
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": "22f7610e54a80f8e6f4a8eb2e0dd66d164bb36af"
47
+ "gitHead": "c6beedc1a79427fa7549ecda85a6ffde6560b0ff"
48
48
  }
@@ -36,7 +36,7 @@ export const divPlugin: PluginType = (node, opts) => {
36
36
  </>
37
37
  );
38
38
  } else if (
39
- node.attribs['class'].includes('c-bodybox') &&
39
+ node.attribs['class']?.includes('c-bodybox') &&
40
40
  node.childNodes.filter((c): c is Element => 'attribs' in c).some((c) => c.name === 'table')
41
41
  ) {
42
42
  const props = attributesToProps(node.attribs);