@ndla/article-converter 6.0.41 → 6.0.43

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.
Files changed (147) hide show
  1. package/es/extractEmbedMeta.js +8 -8
  2. package/es/index.js +2 -2
  3. package/es/plugins/anchorPlugin.js +3 -3
  4. package/es/plugins/asidePlugin.js +4 -4
  5. package/es/plugins/copyParagraphPlugin.js +4 -4
  6. package/es/plugins/ddPlugin.js +2 -2
  7. package/es/plugins/divPlugin.js +14 -14
  8. package/es/plugins/dtPlugin.js +2 -2
  9. package/es/plugins/embed/KeyFigureEmbedPlugin.js +5 -5
  10. package/es/plugins/embed/audioEmbedPlugin.js +3 -3
  11. package/es/plugins/embed/blogPostEmbedPlugin.js +5 -5
  12. package/es/plugins/embed/brightcoveEmbedPlugin.js +3 -3
  13. package/es/plugins/embed/campaignBlockPlugin.js +5 -5
  14. package/es/plugins/embed/codeEmbedPlugin.js +3 -3
  15. package/es/plugins/embed/conceptEmbedPlugin.js +3 -3
  16. package/es/plugins/embed/conceptListEmbedPlugin.js +3 -3
  17. package/es/plugins/embed/contactBlockEmbedPlugin.js +4 -4
  18. package/es/plugins/embed/contentLinkEmbedPlugin.js +3 -3
  19. package/es/plugins/embed/externalEmbedPlugin.js +3 -3
  20. package/es/plugins/embed/fileEmbedPlugin.js +5 -5
  21. package/es/plugins/embed/footnoteEmbedPlugin.js +3 -3
  22. package/es/plugins/embed/h5pEmbedPlugin.js +3 -3
  23. package/es/plugins/embed/iframeEmbedPlugin.js +3 -3
  24. package/es/plugins/embed/imageEmbedPlugin.js +4 -4
  25. package/es/plugins/embed/index.js +27 -27
  26. package/es/plugins/embed/linkBlockEmbedPlugin.js +3 -3
  27. package/es/plugins/embed/relatedContentEmbedPlugin.js +3 -3
  28. package/es/plugins/h3Plugin.js +1 -1
  29. package/es/plugins/index.js +15 -15
  30. package/es/plugins/mathPlugin.js +2 -2
  31. package/es/plugins/navPlugin.js +3 -3
  32. package/es/plugins/oembed/anchorPlugin.js +3 -3
  33. package/es/plugins/olPlugin.js +5 -5
  34. package/es/plugins/paragraphPlugin.js +3 -3
  35. package/es/plugins/spanPlugin.js +3 -3
  36. package/es/plugins/tablePlugin.js +2 -2
  37. package/es/plugins/ulPlugin.js +3 -3
  38. package/es/transform.js +9 -9
  39. package/lib/extractEmbedMeta.d.ts +1 -1
  40. package/lib/extractEmbedMeta.js +7 -7
  41. package/lib/index.d.ts +3 -3
  42. package/lib/plugins/anchorPlugin.d.ts +1 -1
  43. package/lib/plugins/asidePlugin.d.ts +1 -1
  44. package/lib/plugins/asidePlugin.js +2 -2
  45. package/lib/plugins/copyParagraphPlugin.d.ts +1 -1
  46. package/lib/plugins/copyParagraphPlugin.js +2 -2
  47. package/lib/plugins/ddPlugin.d.ts +1 -1
  48. package/lib/plugins/divPlugin.d.ts +1 -1
  49. package/lib/plugins/divPlugin.js +11 -11
  50. package/lib/plugins/dtPlugin.d.ts +1 -1
  51. package/lib/plugins/embed/KeyFigureEmbedPlugin.d.ts +1 -1
  52. package/lib/plugins/embed/KeyFigureEmbedPlugin.js +3 -3
  53. package/lib/plugins/embed/audioEmbedPlugin.d.ts +1 -1
  54. package/lib/plugins/embed/audioEmbedPlugin.js +1 -1
  55. package/lib/plugins/embed/blogPostEmbedPlugin.d.ts +1 -1
  56. package/lib/plugins/embed/blogPostEmbedPlugin.js +3 -3
  57. package/lib/plugins/embed/brightcoveEmbedPlugin.d.ts +1 -1
  58. package/lib/plugins/embed/brightcoveEmbedPlugin.js +1 -1
  59. package/lib/plugins/embed/campaignBlockPlugin.d.ts +1 -1
  60. package/lib/plugins/embed/campaignBlockPlugin.js +3 -3
  61. package/lib/plugins/embed/codeEmbedPlugin.d.ts +1 -1
  62. package/lib/plugins/embed/codeEmbedPlugin.js +1 -1
  63. package/lib/plugins/embed/conceptEmbedPlugin.d.ts +1 -1
  64. package/lib/plugins/embed/conceptEmbedPlugin.js +1 -1
  65. package/lib/plugins/embed/conceptListEmbedPlugin.d.ts +1 -1
  66. package/lib/plugins/embed/conceptListEmbedPlugin.js +1 -1
  67. package/lib/plugins/embed/contactBlockEmbedPlugin.d.ts +1 -1
  68. package/lib/plugins/embed/contactBlockEmbedPlugin.js +2 -2
  69. package/lib/plugins/embed/contentLinkEmbedPlugin.d.ts +1 -1
  70. package/lib/plugins/embed/contentLinkEmbedPlugin.js +1 -1
  71. package/lib/plugins/embed/externalEmbedPlugin.d.ts +1 -1
  72. package/lib/plugins/embed/externalEmbedPlugin.js +1 -1
  73. package/lib/plugins/embed/fileEmbedPlugin.d.ts +1 -1
  74. package/lib/plugins/embed/fileEmbedPlugin.js +3 -3
  75. package/lib/plugins/embed/footnoteEmbedPlugin.d.ts +1 -1
  76. package/lib/plugins/embed/footnoteEmbedPlugin.js +1 -1
  77. package/lib/plugins/embed/h5pEmbedPlugin.d.ts +1 -1
  78. package/lib/plugins/embed/h5pEmbedPlugin.js +1 -1
  79. package/lib/plugins/embed/iframeEmbedPlugin.d.ts +1 -1
  80. package/lib/plugins/embed/iframeEmbedPlugin.js +1 -1
  81. package/lib/plugins/embed/imageEmbedPlugin.d.ts +1 -1
  82. package/lib/plugins/embed/imageEmbedPlugin.js +2 -2
  83. package/lib/plugins/embed/index.d.ts +1 -1
  84. package/lib/plugins/embed/index.js +9 -9
  85. package/lib/plugins/embed/linkBlockEmbedPlugin.d.ts +1 -1
  86. package/lib/plugins/embed/linkBlockEmbedPlugin.js +1 -1
  87. package/lib/plugins/embed/relatedContentEmbedPlugin.d.ts +1 -1
  88. package/lib/plugins/embed/relatedContentEmbedPlugin.js +1 -1
  89. package/lib/plugins/h3Plugin.d.ts +1 -1
  90. package/lib/plugins/index.d.ts +1 -1
  91. package/lib/plugins/mathPlugin.d.ts +1 -1
  92. package/lib/plugins/mathPlugin.js +1 -1
  93. package/lib/plugins/navPlugin.d.ts +1 -1
  94. package/lib/plugins/navPlugin.js +1 -1
  95. package/lib/plugins/oembed/anchorPlugin.d.ts +1 -1
  96. package/lib/plugins/olPlugin.d.ts +1 -1
  97. package/lib/plugins/olPlugin.js +3 -3
  98. package/lib/plugins/paragraphPlugin.d.ts +1 -1
  99. package/lib/plugins/paragraphPlugin.js +2 -2
  100. package/lib/plugins/spanPlugin.d.ts +1 -1
  101. package/lib/plugins/spanPlugin.js +2 -2
  102. package/lib/plugins/tablePlugin.d.ts +1 -1
  103. package/lib/plugins/types.d.ts +2 -2
  104. package/lib/plugins/ulPlugin.d.ts +1 -1
  105. package/lib/plugins/ulPlugin.js +1 -1
  106. package/lib/transform.d.ts +1 -1
  107. package/lib/transform.js +5 -5
  108. package/package.json +5 -5
  109. package/src/extractEmbedMeta.ts +9 -9
  110. package/src/index.ts +3 -3
  111. package/src/plugins/anchorPlugin.tsx +4 -4
  112. package/src/plugins/asidePlugin.tsx +5 -5
  113. package/src/plugins/copyParagraphPlugin.tsx +5 -5
  114. package/src/plugins/ddPlugin.tsx +3 -3
  115. package/src/plugins/divPlugin.tsx +15 -15
  116. package/src/plugins/dtPlugin.tsx +3 -3
  117. package/src/plugins/embed/KeyFigureEmbedPlugin.tsx +7 -7
  118. package/src/plugins/embed/audioEmbedPlugin.tsx +5 -5
  119. package/src/plugins/embed/blogPostEmbedPlugin.tsx +7 -7
  120. package/src/plugins/embed/brightcoveEmbedPlugin.tsx +5 -5
  121. package/src/plugins/embed/campaignBlockPlugin.tsx +11 -8
  122. package/src/plugins/embed/codeEmbedPlugin.tsx +5 -5
  123. package/src/plugins/embed/conceptEmbedPlugin.tsx +5 -5
  124. package/src/plugins/embed/conceptListEmbedPlugin.tsx +5 -5
  125. package/src/plugins/embed/contactBlockEmbedPlugin.tsx +6 -6
  126. package/src/plugins/embed/contentLinkEmbedPlugin.tsx +5 -5
  127. package/src/plugins/embed/externalEmbedPlugin.tsx +5 -5
  128. package/src/plugins/embed/fileEmbedPlugin.tsx +7 -7
  129. package/src/plugins/embed/footnoteEmbedPlugin.tsx +5 -5
  130. package/src/plugins/embed/h5pEmbedPlugin.tsx +5 -5
  131. package/src/plugins/embed/iframeEmbedPlugin.tsx +5 -5
  132. package/src/plugins/embed/imageEmbedPlugin.tsx +6 -6
  133. package/src/plugins/embed/index.ts +28 -28
  134. package/src/plugins/embed/linkBlockEmbedPlugin.tsx +5 -5
  135. package/src/plugins/embed/relatedContentEmbedPlugin.tsx +5 -5
  136. package/src/plugins/h3Plugin.tsx +2 -2
  137. package/src/plugins/index.ts +16 -16
  138. package/src/plugins/mathPlugin.tsx +3 -3
  139. package/src/plugins/navPlugin.tsx +4 -4
  140. package/src/plugins/oembed/anchorPlugin.tsx +4 -4
  141. package/src/plugins/olPlugin.tsx +6 -6
  142. package/src/plugins/paragraphPlugin.tsx +4 -4
  143. package/src/plugins/spanPlugin.tsx +4 -4
  144. package/src/plugins/tablePlugin.tsx +3 -3
  145. package/src/plugins/types.ts +2 -2
  146. package/src/plugins/ulPlugin.tsx +5 -5
  147. package/src/transform.tsx +11 -11
@@ -6,28 +6,28 @@
6
6
  *
7
7
  */
8
8
 
9
- import parse from 'html-react-parser';
9
+ import parse from "html-react-parser";
10
10
  const extractEmbedMeta = embed => {
11
11
  const node = parse(embed);
12
- if (typeof node === 'string' || Array.isArray(node) || node.type !== 'ndlaembed' || !node.props['data-json']) {
12
+ if (typeof node === "string" || Array.isArray(node) || node.type !== "ndlaembed" || !node.props["data-json"]) {
13
13
  return;
14
14
  }
15
- return JSON.parse(node.props['data-json']);
15
+ return JSON.parse(node.props["data-json"]);
16
16
  };
17
17
  export const extractEmbedMetas = embed => {
18
18
  const nodes = parse(embed);
19
19
 
20
20
  // There are no embeds in the string
21
- if (typeof nodes === 'string') {
21
+ if (typeof nodes === "string") {
22
22
  return [];
23
23
  }
24
24
  // There is only one embed in the string
25
- else if (!Array.isArray(nodes) && nodes.type === 'ndlaembed' && !!nodes.props['data-json']) {
26
- return [JSON.parse(nodes.props['data-json'])];
25
+ else if (!Array.isArray(nodes) && nodes.type === "ndlaembed" && !!nodes.props["data-json"]) {
26
+ return [JSON.parse(nodes.props["data-json"])];
27
27
  }
28
28
  // There are multiple embeds in the string
29
- else if (Array.isArray(nodes) && nodes.length && nodes.every(n => n.type === 'ndlaembed' && !!n.props['data-json'])) {
30
- return nodes.map(n => JSON.parse(n.props['data-json']));
29
+ else if (Array.isArray(nodes) && nodes.length && nodes.every(n => n.type === "ndlaembed" && !!n.props["data-json"])) {
30
+ return nodes.map(n => JSON.parse(n.props["data-json"]));
31
31
  } else {
32
32
  return [];
33
33
  }
package/es/index.js CHANGED
@@ -6,5 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- export { default as transform } from './transform';
10
- export { default as extractEmbedMeta, extractEmbedMetas } from './extractEmbedMeta';
9
+ export { default as transform } from "./transform";
10
+ export { default as extractEmbedMeta, extractEmbedMetas } from "./extractEmbedMeta";
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import SafeLink from '@ndla/safelink';
11
- import { getPossiblyRelativeUrl } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import SafeLink from "@ndla/safelink";
11
+ import { getPossiblyRelativeUrl } from "@ndla/ui";
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  export const anchorPlugin = (node, opts, _ref) => {
14
14
  let {
@@ -6,15 +6,15 @@
6
6
  *
7
7
  */
8
8
 
9
- import { domToReact } from 'html-react-parser';
10
- import { Aside, FactBox } from '@ndla/ui';
9
+ import { domToReact } from "html-react-parser";
10
+ import { Aside, FactBox } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const asidePlugin = (node, opts) => {
13
- if (node.attribs['data-type'] === 'factAside') {
13
+ if (node.attribs["data-type"] === "factAside") {
14
14
  return _jsx(FactBox, {
15
15
  children: domToReact(node.children, opts)
16
16
  });
17
- } else if (node.attribs['data-type'] === 'rightAside') {
17
+ } else if (node.attribs["data-type"] === "rightAside") {
18
18
  return _jsx(Aside, {
19
19
  wideScreen: true,
20
20
  alwaysShow: true,
@@ -6,14 +6,14 @@
6
6
  *
7
7
  */
8
8
 
9
- import { domToReact } from 'html-react-parser';
10
- import { CopyParagraphButton } from '@ndla/ui';
9
+ import { domToReact } from "html-react-parser";
10
+ import { CopyParagraphButton } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const copyParagraphPlugin = (node, converterOpts, opts) => {
13
13
  const parent = node.parent;
14
- if (parent?.name === 'section' || parent?.name === 'div' && Object.keys(parent.attribs ?? {}).length === 0) {
14
+ if (parent?.name === "section" || parent?.name === "div" && Object.keys(parent.attribs ?? {}).length === 0) {
15
15
  return _jsx(CopyParagraphButton, {
16
- copyText: node.attribs['data-text'],
16
+ copyText: node.attribs["data-text"],
17
17
  lang: opts.articleLanguage,
18
18
  children: domToReact(node.children, converterOpts)
19
19
  });
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { DefinitionDescription } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { DefinitionDescription } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const ddPlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
@@ -6,39 +6,39 @@
6
6
  *
7
7
  */
8
8
 
9
- import { domToReact, attributesToProps } from 'html-react-parser';
10
- import partition from 'lodash/partition';
11
- import { FileList, RelatedArticleList, Grid, GridParallaxItem, FramedContent } from '@ndla/ui';
9
+ import { domToReact, attributesToProps } from "html-react-parser";
10
+ import partition from "lodash/partition";
11
+ import { FileList, RelatedArticleList, Grid, GridParallaxItem, FramedContent } from "@ndla/ui";
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
15
15
  export const divPlugin = (node, opts) => {
16
- if (node.attribs['data-type'] === 'framed-content' || node.attribs.class === 'c-bodybox') {
16
+ if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
17
17
  return _jsx(FramedContent, {
18
18
  children: domToReact(node.children, opts)
19
19
  });
20
20
  }
21
- if (node.attribs['data-type'] === 'related-content' && node.children.length) {
21
+ if (node.attribs["data-type"] === "related-content" && node.children.length) {
22
22
  const props = attributesToProps(node.attribs);
23
23
  return _jsx(RelatedArticleList, {
24
24
  ...props,
25
25
  headingLevel: "h3",
26
26
  children: domToReact(node.children, opts)
27
27
  });
28
- } else if (node.attribs['data-type'] === 'file' && node.childNodes.length) {
29
- const elements = node.childNodes.filter(c => c.type === 'tag' && c.name === 'ndlaembed' && c.attribs['data-resource'] === 'file');
30
- const [pdfs, files] = partition(elements, el => el.attribs['data-type'] === 'pdf' && el.attribs['data-display'] === 'block');
28
+ } else if (node.attribs["data-type"] === "file" && node.childNodes.length) {
29
+ const elements = node.childNodes.filter(c => c.type === "tag" && c.name === "ndlaembed" && c.attribs["data-resource"] === "file");
30
+ const [pdfs, files] = partition(elements, el => el.attribs["data-type"] === "pdf" && el.attribs["data-display"] === "block");
31
31
  return _jsxs(_Fragment, {
32
32
  children: [files.length ? _jsx(FileList, {
33
33
  children: domToReact(files, opts)
34
34
  }) : undefined, domToReact(pdfs, opts)]
35
35
  });
36
- } else if (node.attribs['data-type'] === 'grid' && node.children.length > 0) {
36
+ } else if (node.attribs["data-type"] === "grid" && node.children.length > 0) {
37
37
  const props = attributesToProps(node.attribs);
38
- const columns = props['data-columns'];
39
- const border = props['data-border'];
40
- const background = props['data-background'];
41
- const frontpage = !!props['data-size'];
38
+ const columns = props["data-columns"];
39
+ const border = props["data-border"];
40
+ const background = props["data-background"];
41
+ const frontpage = !!props["data-size"];
42
42
  return _jsx(Grid, {
43
43
  isFrontpage: frontpage,
44
44
  border: border,
@@ -47,7 +47,7 @@ export const divPlugin = (node, opts) => {
47
47
  ...props,
48
48
  children: domToReact(node.children, opts)
49
49
  });
50
- } else if (node.attribs['data-parallax-cell'] === 'true' && node.children.length) {
50
+ } else if (node.attribs["data-parallax-cell"] === "true" && node.children.length) {
51
51
  return _jsx(GridParallaxItem, {
52
52
  children: domToReact(node.children, opts)
53
53
  });
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { DefinitionTerm } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { DefinitionTerm } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const dtPlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { KeyFigure } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { KeyFigure } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const keyFigureEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  const {
16
16
  title,
17
17
  subtitle,
@@ -20,9 +20,9 @@ export const keyFigureEmbedPlugin = (element, _, opts) => {
20
20
  return _jsx(KeyFigure, {
21
21
  title: title,
22
22
  subtitle: subtitle,
23
- image: data.status === 'success' && data.data.metaImage ? {
23
+ image: data.status === "success" && data.data.metaImage ? {
24
24
  src: data.data.metaImage.image.imageUrl,
25
- alt: alt === undefined ? '' : alt
25
+ alt: alt === undefined ? "" : alt
26
26
  } : undefined,
27
27
  lang: opts.articleLanguage
28
28
  });
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { AudioEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { AudioEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const audioEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(AudioEmbed, {
16
16
  embed: data,
17
17
  heartButton: opts.components?.heartButton,
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { BlogPostV2 } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { BlogPostV2 } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const errorSvgSrc = `data:image/svg+xml;charset=UTF-8,%3Csvg fill='%238A8888' height='400' viewBox='0 0 24 12' width='100%25' xmlns='http://www.w3.org/2000/svg' style='background-color: %23EFF0F2'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath transform='scale(0.3) translate(28, 8.5)' d='M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3E%3C/svg%3E`;
13
13
  export const blogPostEmbedPlugin = (element, _, opts) => {
14
14
  const props = attributesToProps(element.attribs);
15
- const data = JSON.parse(props['data-json']);
15
+ const data = JSON.parse(props["data-json"]);
16
16
  const {
17
17
  title,
18
18
  author,
@@ -31,8 +31,8 @@ export const blogPostEmbedPlugin = (element, _, opts) => {
31
31
  size: size,
32
32
  path: opts.path,
33
33
  metaImage: {
34
- alt: alt ? alt : '',
35
- url: data.status === 'success' ? data.data.metaImage?.image.imageUrl ?? errorSvgSrc : errorSvgSrc
34
+ alt: alt ? alt : "",
35
+ url: data.status === "success" ? data.data.metaImage?.image.imageUrl ?? errorSvgSrc : errorSvgSrc
36
36
  }
37
37
  });
38
38
  };
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { BrightcoveEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { BrightcoveEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const brightcoveEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(BrightcoveEmbed, {
16
16
  embed: data,
17
17
  heartButton: opts.components?.heartButton,
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { CampaignBlock } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { CampaignBlock } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const campaignBlockPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  const embed = data.embedData;
16
16
  return _jsx(CampaignBlock, {
17
17
  title: {
@@ -28,9 +28,9 @@ export const campaignBlockPlugin = (element, _, opts) => {
28
28
  },
29
29
  path: opts.path,
30
30
  imageSide: embed.imageSide,
31
- image: data.status === 'success' && data.data.image ? {
31
+ image: data.status === "success" && data.data.image ? {
32
32
  src: data.data.image.image.imageUrl,
33
- alt: embed.alt === undefined ? '' : embed.alt
33
+ alt: embed.alt === undefined ? "" : embed.alt
34
34
  } : undefined
35
35
  });
36
36
  };
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { CodeEmbed } from '@ndla/code';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { CodeEmbed } from "@ndla/code";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const codeEmbedPlugin = element => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(CodeEmbed, {
16
16
  embed: data
17
17
  });
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ConceptEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ConceptEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const conceptEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(ConceptEmbed, {
16
16
  embed: data,
17
17
  fullWidth: true,
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ConceptListEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ConceptListEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const conceptListEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(ConceptListEmbed, {
16
16
  embed: data,
17
17
  lang: opts.articleLanguage
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ContactBlock } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ContactBlock } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const contactBlockEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const embedData = JSON.parse(props['data-json']);
14
+ const embedData = JSON.parse(props["data-json"]);
15
15
  const {
16
16
  name,
17
17
  email,
@@ -22,7 +22,7 @@ export const contactBlockEmbedPlugin = (element, _, opts) => {
22
22
  alt
23
23
  } = embedData.embedData;
24
24
  return _jsx(ContactBlock, {
25
- image: embedData.status === 'success' ? embedData.data.image : undefined,
25
+ image: embedData.status === "success" ? embedData.data.image : undefined,
26
26
  embedAlt: alt,
27
27
  description: description,
28
28
  email: email,
@@ -6,15 +6,15 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ContentLinkEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ContentLinkEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const contentLinkEmbedPlugin = (element, _, _ref) => {
13
13
  let {
14
14
  isOembed
15
15
  } = _ref;
16
16
  const props = attributesToProps(element.attribs);
17
- const data = JSON.parse(props['data-json']);
17
+ const data = JSON.parse(props["data-json"]);
18
18
  return _jsx(ContentLinkEmbed, {
19
19
  embed: data,
20
20
  isOembed: isOembed
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ExternalEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ExternalEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const externalEmbedPlugin = element => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(ExternalEmbed, {
16
16
  embed: data
17
17
  });
@@ -6,19 +6,19 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { PdfFile, File } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { PdfFile, File } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const fileEmbedPlugin = element => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  const {
16
16
  type,
17
17
  title,
18
18
  url,
19
19
  display
20
20
  } = data.embedData;
21
- if (type === 'pdf' && display === 'block') {
21
+ if (type === "pdf" && display === "block") {
22
22
  return _jsx(PdfFile, {
23
23
  title: title,
24
24
  url: url
@@ -27,7 +27,7 @@ export const fileEmbedPlugin = element => {
27
27
  return _jsx(File, {
28
28
  url: url,
29
29
  title: title,
30
- fileExists: data.status === 'success' ? !!data.data.exists : false,
30
+ fileExists: data.status === "success" ? !!data.data.exists : false,
31
31
  fileType: type
32
32
  });
33
33
  }
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { FootnoteEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { FootnoteEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const footnoteEmbedPlugin = element => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(FootnoteEmbed, {
16
16
  embed: data
17
17
  });
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { H5pEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { H5pEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const h5pEmbedPlugin = element => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(H5pEmbed, {
16
16
  embed: data
17
17
  });
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { IframeEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { IframeEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const iframeEmbedPlugin = element => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(IframeEmbed, {
16
16
  embed: data
17
17
  });
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ImageEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ImageEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const imageEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
15
- const inGrid = element.parentNode?.parentNode?.attribs?.['data-type'] === 'grid';
14
+ const data = JSON.parse(props["data-json"]);
15
+ const inGrid = element.parentNode?.parentNode?.attribs?.["data-type"] === "grid";
16
16
  return _jsx(ImageEmbed, {
17
17
  inGrid: inGrid,
18
18
  embed: data,
@@ -6,41 +6,41 @@
6
6
  *
7
7
  */
8
8
 
9
- import { audioEmbedPlugin } from './audioEmbedPlugin';
10
- import { blogPostEmbedPlugin } from './blogPostEmbedPlugin';
11
- import { brightcoveEmbedPlugin } from './brightcoveEmbedPlugin';
12
- import { campaignBlockPlugin } from './campaignBlockPlugin';
13
- import { codeEmbedPlugin } from './codeEmbedPlugin';
14
- import { conceptEmbedPlugin } from './conceptEmbedPlugin';
15
- import { conceptListEmbedPlugin } from './conceptListEmbedPlugin';
16
- import { contactBlockEmbedPlugin } from './contactBlockEmbedPlugin';
17
- import { contentLinkEmbedPlugin } from './contentLinkEmbedPlugin';
18
- import { externalEmbedPlugin } from './externalEmbedPlugin';
19
- import { fileEmbedPlugin } from './fileEmbedPlugin';
20
- import { footnoteEmbedPlugin } from './footnoteEmbedPlugin';
21
- import { h5pEmbedPlugin } from './h5pEmbedPlugin';
22
- import { iframeEmbedPlugin } from './iframeEmbedPlugin';
23
- import { imageEmbedPlugin } from './imageEmbedPlugin';
24
- import { keyFigureEmbedPlugin } from './KeyFigureEmbedPlugin';
25
- import { linkBlockPlugin } from './linkBlockEmbedPlugin';
26
- import { relatedContentEmbedPlugin } from './relatedContentEmbedPlugin';
9
+ import { audioEmbedPlugin } from "./audioEmbedPlugin";
10
+ import { blogPostEmbedPlugin } from "./blogPostEmbedPlugin";
11
+ import { brightcoveEmbedPlugin } from "./brightcoveEmbedPlugin";
12
+ import { campaignBlockPlugin } from "./campaignBlockPlugin";
13
+ import { codeEmbedPlugin } from "./codeEmbedPlugin";
14
+ import { conceptEmbedPlugin } from "./conceptEmbedPlugin";
15
+ import { conceptListEmbedPlugin } from "./conceptListEmbedPlugin";
16
+ import { contactBlockEmbedPlugin } from "./contactBlockEmbedPlugin";
17
+ import { contentLinkEmbedPlugin } from "./contentLinkEmbedPlugin";
18
+ import { externalEmbedPlugin } from "./externalEmbedPlugin";
19
+ import { fileEmbedPlugin } from "./fileEmbedPlugin";
20
+ import { footnoteEmbedPlugin } from "./footnoteEmbedPlugin";
21
+ import { h5pEmbedPlugin } from "./h5pEmbedPlugin";
22
+ import { iframeEmbedPlugin } from "./iframeEmbedPlugin";
23
+ import { imageEmbedPlugin } from "./imageEmbedPlugin";
24
+ import { keyFigureEmbedPlugin } from "./KeyFigureEmbedPlugin";
25
+ import { linkBlockPlugin } from "./linkBlockEmbedPlugin";
26
+ import { relatedContentEmbedPlugin } from "./relatedContentEmbedPlugin";
27
27
  export const embedPlugins = {
28
28
  image: imageEmbedPlugin,
29
29
  audio: audioEmbedPlugin,
30
30
  h5p: h5pEmbedPlugin,
31
- 'code-block': codeEmbedPlugin,
31
+ "code-block": codeEmbedPlugin,
32
32
  external: externalEmbedPlugin,
33
33
  iframe: iframeEmbedPlugin,
34
34
  footnote: footnoteEmbedPlugin,
35
35
  brightcove: brightcoveEmbedPlugin,
36
- 'related-content': relatedContentEmbedPlugin,
37
- 'content-link': contentLinkEmbedPlugin,
36
+ "related-content": relatedContentEmbedPlugin,
37
+ "content-link": contentLinkEmbedPlugin,
38
38
  concept: conceptEmbedPlugin,
39
- 'concept-list': conceptListEmbedPlugin,
40
- 'blog-post': blogPostEmbedPlugin,
39
+ "concept-list": conceptListEmbedPlugin,
40
+ "blog-post": blogPostEmbedPlugin,
41
41
  file: fileEmbedPlugin,
42
- 'key-figure': keyFigureEmbedPlugin,
43
- 'contact-block': contactBlockEmbedPlugin,
44
- 'campaign-block': campaignBlockPlugin,
45
- 'link-block': linkBlockPlugin
42
+ "key-figure": keyFigureEmbedPlugin,
43
+ "contact-block": contactBlockEmbedPlugin,
44
+ "campaign-block": campaignBlockPlugin,
45
+ "link-block": linkBlockPlugin
46
46
  };
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { LinkBlock } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { LinkBlock } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const linkBlockPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(LinkBlock, {
16
16
  ...data.embedData,
17
17
  path: opts.path
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { RelatedContentEmbed } from '@ndla/ui';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { RelatedContentEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const relatedContentEmbedPlugin = (element, _, opts) => {
13
13
  const props = attributesToProps(element.attribs);
14
- const data = JSON.parse(props['data-json']);
14
+ const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(RelatedContentEmbed, {
16
16
  embed: data,
17
17
  subject: opts.subject,