@ndla/article-converter 6.0.42 → 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,16 +6,16 @@
6
6
  *
7
7
  */
8
8
 
9
- import { domToReact, attributesToProps, Element } from 'html-react-parser';
10
- import partition from 'lodash/partition';
11
- import { FileList, RelatedArticleList, Grid, GridType, GridParallaxItem, FramedContent } from '@ndla/ui';
12
- import { PluginType } from './types';
9
+ import { domToReact, attributesToProps, Element } from "html-react-parser";
10
+ import partition from "lodash/partition";
11
+ import { FileList, RelatedArticleList, Grid, GridType, GridParallaxItem, FramedContent } from "@ndla/ui";
12
+ import { PluginType } from "./types";
13
13
 
14
14
  export const divPlugin: PluginType = (node, opts) => {
15
- if (node.attribs['data-type'] === 'framed-content' || node.attribs.class === 'c-bodybox') {
15
+ if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
16
16
  return <FramedContent>{domToReact(node.children, opts)}</FramedContent>;
17
17
  }
18
- if (node.attribs['data-type'] === 'related-content' && node.children.length) {
18
+ if (node.attribs["data-type"] === "related-content" && node.children.length) {
19
19
  const props = attributesToProps(node.attribs);
20
20
 
21
21
  return (
@@ -24,13 +24,13 @@ export const divPlugin: PluginType = (node, opts) => {
24
24
  {domToReact(node.children, opts)}
25
25
  </RelatedArticleList>
26
26
  );
27
- } else if (node.attribs['data-type'] === 'file' && node.childNodes.length) {
27
+ } else if (node.attribs["data-type"] === "file" && node.childNodes.length) {
28
28
  const elements = node.childNodes.filter(
29
- (c): c is Element => c.type === 'tag' && c.name === 'ndlaembed' && c.attribs['data-resource'] === 'file',
29
+ (c): c is Element => c.type === "tag" && c.name === "ndlaembed" && c.attribs["data-resource"] === "file",
30
30
  );
31
31
  const [pdfs, files] = partition(
32
32
  elements,
33
- (el) => el.attribs['data-type'] === 'pdf' && el.attribs['data-display'] === 'block',
33
+ (el) => el.attribs["data-type"] === "pdf" && el.attribs["data-display"] === "block",
34
34
  );
35
35
 
36
36
  return (
@@ -39,19 +39,19 @@ export const divPlugin: PluginType = (node, opts) => {
39
39
  {domToReact(pdfs, opts)}
40
40
  </>
41
41
  );
42
- } else if (node.attribs['data-type'] === 'grid' && node.children.length > 0) {
42
+ } else if (node.attribs["data-type"] === "grid" && node.children.length > 0) {
43
43
  const props = attributesToProps(node.attribs);
44
- const columns = props['data-columns'] as GridType['columns'];
45
- const border = props['data-border'] as GridType['border'];
46
- const background = props['data-background'] as GridType['background'];
47
- const frontpage = !!props['data-size'] as GridType['size'];
44
+ const columns = props["data-columns"] as GridType["columns"];
45
+ const border = props["data-border"] as GridType["border"];
46
+ const background = props["data-background"] as GridType["background"];
47
+ const frontpage = !!props["data-size"] as GridType["size"];
48
48
  return (
49
49
  <Grid isFrontpage={frontpage} border={border} columns={columns} background={background} {...props}>
50
50
  {/* @ts-ignore */}
51
51
  {domToReact(node.children, opts)}
52
52
  </Grid>
53
53
  );
54
- } else if (node.attribs['data-parallax-cell'] === 'true' && node.children.length) {
54
+ } else if (node.attribs["data-parallax-cell"] === "true" && node.children.length) {
55
55
  return <GridParallaxItem>{domToReact(node.children, opts)}</GridParallaxItem>;
56
56
  }
57
57
  return null;
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { DefinitionTerm } from '@ndla/ui';
11
- import { PluginType } from './types';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { DefinitionTerm } from "@ndla/ui";
11
+ import { PluginType } from "./types";
12
12
 
13
13
  export const dtPlugin: PluginType = (node, converterOpts, opts) => {
14
14
  const props = attributesToProps(node.attribs);
@@ -6,24 +6,24 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { KeyFigureMetaData } from '@ndla/types-embed';
11
- import { KeyFigure } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { KeyFigureMetaData } from "@ndla/types-embed";
11
+ import { KeyFigure } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const keyFigureEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as KeyFigureMetaData;
16
+ const data = JSON.parse(props["data-json"]) as KeyFigureMetaData;
17
17
  const { title, subtitle, alt } = data.embedData;
18
18
  return (
19
19
  <KeyFigure
20
20
  title={title}
21
21
  subtitle={subtitle}
22
22
  image={
23
- data.status === 'success' && data.data.metaImage
23
+ data.status === "success" && data.data.metaImage
24
24
  ? {
25
25
  src: data.data.metaImage.image.imageUrl,
26
- alt: alt === undefined ? '' : alt,
26
+ alt: alt === undefined ? "" : alt,
27
27
  }
28
28
  : undefined
29
29
  }
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { AudioMetaData } from '@ndla/types-embed';
11
- import { AudioEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { AudioMetaData } from "@ndla/types-embed";
11
+ import { AudioEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const audioEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as AudioMetaData;
16
+ const data = JSON.parse(props["data-json"]) as AudioMetaData;
17
17
  return <AudioEmbed embed={data} heartButton={opts.components?.heartButton} lang={opts.articleLanguage} />;
18
18
  };
@@ -6,16 +6,16 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { BlogPostMetaData } from '@ndla/types-embed';
11
- import { BlogPostV2 } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { BlogPostMetaData } from "@ndla/types-embed";
11
+ import { BlogPostV2 } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  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`;
15
15
 
16
16
  export const blogPostEmbedPlugin: PluginType = (element, _, opts) => {
17
17
  const props = attributesToProps(element.attribs);
18
- const data = JSON.parse(props['data-json']) as BlogPostMetaData;
18
+ const data = JSON.parse(props["data-json"]) as BlogPostMetaData;
19
19
  const { title, author, url, size, language, alt } = data.embedData;
20
20
  return (
21
21
  <BlogPostV2
@@ -25,8 +25,8 @@ export const blogPostEmbedPlugin: PluginType = (element, _, opts) => {
25
25
  size={size}
26
26
  path={opts.path}
27
27
  metaImage={{
28
- alt: alt ? alt : '',
29
- url: data.status === 'success' ? data.data.metaImage?.image.imageUrl ?? errorSvgSrc : errorSvgSrc,
28
+ alt: alt ? alt : "",
29
+ url: data.status === "success" ? data.data.metaImage?.image.imageUrl ?? errorSvgSrc : errorSvgSrc,
30
30
  }}
31
31
  />
32
32
  );
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { BrightcoveMetaData } from '@ndla/types-embed';
11
- import { BrightcoveEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { BrightcoveMetaData } from "@ndla/types-embed";
11
+ import { BrightcoveEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const brightcoveEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as BrightcoveMetaData;
16
+ const data = JSON.parse(props["data-json"]) as BrightcoveMetaData;
17
17
  return <BrightcoveEmbed embed={data} heartButton={opts.components?.heartButton} renderContext={opts.renderContext} />;
18
18
  };
@@ -6,28 +6,31 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { CampaignBlockMetaData } from '@ndla/types-embed';
11
- import { CampaignBlock } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { CampaignBlockMetaData } from "@ndla/types-embed";
11
+ import { CampaignBlock } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const campaignBlockPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as CampaignBlockMetaData;
16
+ const data = JSON.parse(props["data-json"]) as CampaignBlockMetaData;
17
17
  const embed = data.embedData;
18
18
 
19
19
  return (
20
20
  <CampaignBlock
21
21
  title={{ title: embed.title, language: embed.titleLanguage }}
22
- description={{ text: embed.description, language: embed.descriptionLanguage }}
22
+ description={{
23
+ text: embed.description,
24
+ language: embed.descriptionLanguage,
25
+ }}
23
26
  url={{ url: embed.url, text: embed.urlText }}
24
27
  path={opts.path}
25
28
  imageSide={embed.imageSide}
26
29
  image={
27
- data.status === 'success' && data.data.image
30
+ data.status === "success" && data.data.image
28
31
  ? {
29
32
  src: data.data.image.image.imageUrl,
30
- alt: embed.alt === undefined ? '' : embed.alt,
33
+ alt: embed.alt === undefined ? "" : embed.alt,
31
34
  }
32
35
  : undefined
33
36
  }
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { CodeEmbed } from '@ndla/code';
11
- import { CodeMetaData } from '@ndla/types-embed';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { CodeEmbed } from "@ndla/code";
11
+ import { CodeMetaData } from "@ndla/types-embed";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const codeEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as CodeMetaData;
16
+ const data = JSON.parse(props["data-json"]) as CodeMetaData;
17
17
  return <CodeEmbed embed={data} />;
18
18
  };
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ConceptMetaData } from '@ndla/types-embed';
11
- import { ConceptEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ConceptMetaData } from "@ndla/types-embed";
11
+ import { ConceptEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const conceptEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as ConceptMetaData;
16
+ const data = JSON.parse(props["data-json"]) as ConceptMetaData;
17
17
  return <ConceptEmbed embed={data} fullWidth heartButton={opts.components?.heartButton} lang={opts.articleLanguage} />;
18
18
  };
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ConceptListMetaData } from '@ndla/types-embed';
11
- import { ConceptListEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ConceptListMetaData } from "@ndla/types-embed";
11
+ import { ConceptListEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const conceptListEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as ConceptListMetaData;
16
+ const data = JSON.parse(props["data-json"]) as ConceptListMetaData;
17
17
  return <ConceptListEmbed embed={data} lang={opts.articleLanguage} />;
18
18
  };
@@ -6,18 +6,18 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ContactBlockMetaData } from '@ndla/types-embed';
11
- import { ContactBlock } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ContactBlockMetaData } from "@ndla/types-embed";
11
+ import { ContactBlock } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const contactBlockEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const embedData = JSON.parse(props['data-json']) as ContactBlockMetaData;
16
+ const embedData = JSON.parse(props["data-json"]) as ContactBlockMetaData;
17
17
  const { name, email, description, blob, blobColor, jobTitle, alt } = embedData.embedData;
18
18
  return (
19
19
  <ContactBlock
20
- image={embedData.status === 'success' ? embedData.data.image : undefined}
20
+ image={embedData.status === "success" ? embedData.data.image : undefined}
21
21
  embedAlt={alt}
22
22
  description={description}
23
23
  email={email}
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { ContentLinkMetaData } from '@ndla/types-embed';
11
- import { ContentLinkEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { ContentLinkMetaData } from "@ndla/types-embed";
11
+ import { ContentLinkEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const contentLinkEmbedPlugin: PluginType = (element, _, { isOembed }) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as ContentLinkMetaData;
16
+ const data = JSON.parse(props["data-json"]) as ContentLinkMetaData;
17
17
  return <ContentLinkEmbed embed={data} isOembed={isOembed} />;
18
18
  };
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { OembedMetaData } from '@ndla/types-embed';
11
- import { ExternalEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { OembedMetaData } from "@ndla/types-embed";
11
+ import { ExternalEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const externalEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as OembedMetaData;
16
+ const data = JSON.parse(props["data-json"]) as OembedMetaData;
17
17
  return <ExternalEmbed embed={data} />;
18
18
  };
@@ -6,23 +6,23 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { FileMetaData } from '@ndla/types-embed';
11
- import { PdfFile, File } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { FileMetaData } from "@ndla/types-embed";
11
+ import { PdfFile, File } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const fileEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as FileMetaData;
16
+ const data = JSON.parse(props["data-json"]) as FileMetaData;
17
17
  const { type, title, url, display } = data.embedData;
18
- if (type === 'pdf' && display === 'block') {
18
+ if (type === "pdf" && display === "block") {
19
19
  return <PdfFile title={title} url={url} />;
20
20
  } else {
21
21
  return (
22
22
  <File
23
23
  url={url}
24
24
  title={title}
25
- fileExists={data.status === 'success' ? !!data.data.exists : false}
25
+ fileExists={data.status === "success" ? !!data.data.exists : false}
26
26
  fileType={type}
27
27
  />
28
28
  );
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { FootnoteMetaData } from '@ndla/types-embed';
11
- import { FootnoteEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { FootnoteMetaData } from "@ndla/types-embed";
11
+ import { FootnoteEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const footnoteEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as FootnoteMetaData;
16
+ const data = JSON.parse(props["data-json"]) as FootnoteMetaData;
17
17
  return <FootnoteEmbed embed={data} />;
18
18
  };
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { H5pMetaData } from '@ndla/types-embed';
11
- import { H5pEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { H5pMetaData } from "@ndla/types-embed";
11
+ import { H5pEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const h5pEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as H5pMetaData;
16
+ const data = JSON.parse(props["data-json"]) as H5pMetaData;
17
17
  return <H5pEmbed embed={data} />;
18
18
  };
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { IframeMetaData } from '@ndla/types-embed';
11
- import { IframeEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { IframeMetaData } from "@ndla/types-embed";
11
+ import { IframeEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const iframeEmbedPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as IframeMetaData;
16
+ const data = JSON.parse(props["data-json"]) as IframeMetaData;
17
17
  return <IframeEmbed embed={data} />;
18
18
  };
@@ -6,15 +6,15 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, Element } from 'html-react-parser';
10
- import { ImageMetaData } from '@ndla/types-embed';
11
- import { ImageEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps, Element } from "html-react-parser";
10
+ import { ImageMetaData } from "@ndla/types-embed";
11
+ import { ImageEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const imageEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as ImageMetaData;
17
- const inGrid = (element.parentNode?.parentNode as Element)?.attribs?.['data-type'] === 'grid';
16
+ const data = JSON.parse(props["data-json"]) as ImageMetaData;
17
+ const inGrid = (element.parentNode?.parentNode as Element)?.attribs?.["data-type"] === "grid";
18
18
 
19
19
  return (
20
20
  <ImageEmbed
@@ -6,43 +6,43 @@
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';
27
- import { PluginType } from '../types';
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
+ import { PluginType } from "../types";
28
28
 
29
29
  export const embedPlugins: Record<string, PluginType> = {
30
30
  image: imageEmbedPlugin,
31
31
  audio: audioEmbedPlugin,
32
32
  h5p: h5pEmbedPlugin,
33
- 'code-block': codeEmbedPlugin,
33
+ "code-block": codeEmbedPlugin,
34
34
  external: externalEmbedPlugin,
35
35
  iframe: iframeEmbedPlugin,
36
36
  footnote: footnoteEmbedPlugin,
37
37
  brightcove: brightcoveEmbedPlugin,
38
- 'related-content': relatedContentEmbedPlugin,
39
- 'content-link': contentLinkEmbedPlugin,
38
+ "related-content": relatedContentEmbedPlugin,
39
+ "content-link": contentLinkEmbedPlugin,
40
40
  concept: conceptEmbedPlugin,
41
- 'concept-list': conceptListEmbedPlugin,
42
- 'blog-post': blogPostEmbedPlugin,
41
+ "concept-list": conceptListEmbedPlugin,
42
+ "blog-post": blogPostEmbedPlugin,
43
43
  file: fileEmbedPlugin,
44
- 'key-figure': keyFigureEmbedPlugin,
45
- 'contact-block': contactBlockEmbedPlugin,
46
- 'campaign-block': campaignBlockPlugin,
47
- 'link-block': linkBlockPlugin,
44
+ "key-figure": keyFigureEmbedPlugin,
45
+ "contact-block": contactBlockEmbedPlugin,
46
+ "campaign-block": campaignBlockPlugin,
47
+ "link-block": linkBlockPlugin,
48
48
  };
@@ -6,14 +6,14 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { LinkBlockMetaData } from '@ndla/types-embed';
11
- import { LinkBlock } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { LinkBlockMetaData } from "@ndla/types-embed";
11
+ import { LinkBlock } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const linkBlockPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as LinkBlockMetaData;
16
+ const data = JSON.parse(props["data-json"]) as LinkBlockMetaData;
17
17
 
18
18
  return <LinkBlock {...data.embedData} path={opts.path} />;
19
19
  };
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
10
- import { RelatedContentMetaData } from '@ndla/types-embed';
11
- import { RelatedContentEmbed } from '@ndla/ui';
12
- import { PluginType } from '../types';
9
+ import { attributesToProps } from "html-react-parser";
10
+ import { RelatedContentMetaData } from "@ndla/types-embed";
11
+ import { RelatedContentEmbed } from "@ndla/ui";
12
+ import { PluginType } from "../types";
13
13
 
14
14
  export const relatedContentEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
- const data = JSON.parse(props['data-json']) as RelatedContentMetaData;
16
+ const data = JSON.parse(props["data-json"]) as RelatedContentMetaData;
17
17
  return <RelatedContentEmbed embed={data} subject={opts.subject} ndlaFrontendDomain={opts.frontendDomain} />;
18
18
  };
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { PluginType } from './types';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { PluginType } from "./types";
11
11
  export const h3Plugin: PluginType = (node, converterOpts, opts) => {
12
12
  const props = attributesToProps(node.attribs);
13
13
  return (