@ndla/article-converter 6.2.2 → 6.3.1

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.
@@ -9,7 +9,7 @@
9
9
  import { attributesToProps } from "html-react-parser";
10
10
  import { KeyFigure } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
- export const keyFigureEmbedPlugin = (element, _, opts) => {
12
+ export const keyFigureEmbedPlugin = (element, _) => {
13
13
  const props = attributesToProps(element.attribs);
14
14
  const data = JSON.parse(props["data-json"]);
15
15
  const {
@@ -23,7 +23,6 @@ export const keyFigureEmbedPlugin = (element, _, opts) => {
23
23
  image: data.status === "success" && data.data.metaImage ? {
24
24
  src: data.data.metaImage.image.imageUrl,
25
25
  alt: alt === undefined ? "" : alt
26
- } : undefined,
27
- lang: opts.articleLanguage
26
+ } : undefined
28
27
  });
29
28
  };
@@ -18,14 +18,10 @@ export const blogPostEmbedPlugin = (element, _, opts) => {
18
18
  author,
19
19
  url,
20
20
  size,
21
- language,
22
21
  alt
23
22
  } = data.embedData;
24
23
  return _jsx(BlogPostV2, {
25
- title: {
26
- title,
27
- language
28
- },
24
+ title: title,
29
25
  author: author,
30
26
  url: url,
31
27
  size: size,
@@ -14,14 +14,8 @@ export const campaignBlockPlugin = (element, _, opts) => {
14
14
  const data = JSON.parse(props["data-json"]);
15
15
  const embed = data.embedData;
16
16
  return _jsx(CampaignBlock, {
17
- title: {
18
- title: embed.title,
19
- language: embed.titleLanguage
20
- },
21
- description: {
22
- text: embed.description,
23
- language: embed.descriptionLanguage
24
- },
17
+ title: embed.title,
18
+ description: embed.description,
25
19
  url: {
26
20
  url: embed.url,
27
21
  text: embed.urlText
@@ -14,6 +14,7 @@ export const linkBlockPlugin = (element, _, opts) => {
14
14
  const data = JSON.parse(props["data-json"]);
15
15
  return _jsx(LinkBlock, {
16
16
  ...data.embedData,
17
- path: opts.path
17
+ path: opts.path,
18
+ articleLanguage: opts.articleLanguage
18
19
  });
19
20
  };
@@ -15,7 +15,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
15
  *
16
16
  */
17
17
 
18
- const keyFigureEmbedPlugin = (element, _, opts) => {
18
+ const keyFigureEmbedPlugin = (element, _) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
20
  const data = JSON.parse(props["data-json"]);
21
21
  const {
@@ -29,8 +29,7 @@ const keyFigureEmbedPlugin = (element, _, opts) => {
29
29
  image: data.status === "success" && data.data.metaImage ? {
30
30
  src: data.data.metaImage.image.imageUrl,
31
31
  alt: alt === undefined ? "" : alt
32
- } : undefined,
33
- lang: opts.articleLanguage
32
+ } : undefined
34
33
  });
35
34
  };
36
35
  exports.keyFigureEmbedPlugin = keyFigureEmbedPlugin;
@@ -24,14 +24,10 @@ const blogPostEmbedPlugin = (element, _, opts) => {
24
24
  author,
25
25
  url,
26
26
  size,
27
- language,
28
27
  alt
29
28
  } = data.embedData;
30
29
  return (0, _jsxRuntime.jsx)(_ui.BlogPostV2, {
31
- title: {
32
- title,
33
- language
34
- },
30
+ title: title,
35
31
  author: author,
36
32
  url: url,
37
33
  size: size,
@@ -20,14 +20,8 @@ const campaignBlockPlugin = (element, _, opts) => {
20
20
  const data = JSON.parse(props["data-json"]);
21
21
  const embed = data.embedData;
22
22
  return (0, _jsxRuntime.jsx)(_ui.CampaignBlock, {
23
- title: {
24
- title: embed.title,
25
- language: embed.titleLanguage
26
- },
27
- description: {
28
- text: embed.description,
29
- language: embed.descriptionLanguage
30
- },
23
+ title: embed.title,
24
+ description: embed.description,
31
25
  url: {
32
26
  url: embed.url,
33
27
  text: embed.urlText
@@ -20,7 +20,8 @@ const linkBlockPlugin = (element, _, opts) => {
20
20
  const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.LinkBlock, {
22
22
  ...data.embedData,
23
- path: opts.path
23
+ path: opts.path,
24
+ articleLanguage: opts.articleLanguage
24
25
  });
25
26
  };
26
27
  exports.linkBlockPlugin = linkBlockPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "6.2.2",
3
+ "version": "6.3.1",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -28,11 +28,11 @@
28
28
  ],
29
29
  "devDependencies": {
30
30
  "@ndla/types-backend": "^0.2.64",
31
- "@ndla/types-embed": "^4.1.1"
31
+ "@ndla/types-embed": "^4.1.3"
32
32
  },
33
33
  "dependencies": {
34
- "@ndla/code": "^5.0.50",
35
- "@ndla/ui": "^50.12.2",
34
+ "@ndla/code": "^5.0.52",
35
+ "@ndla/ui": "^50.13.1",
36
36
  "html-react-parser": "^5.1.8",
37
37
  "lodash": "^4.17.20"
38
38
  },
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "21b9014880a040dbb995448eb196299753d5be4b"
51
+ "gitHead": "6d16e6667d0dcbfd42280eb2f9929ee3f93fa64b"
52
52
  }
@@ -11,7 +11,7 @@ import { KeyFigureMetaData } from "@ndla/types-embed";
11
11
  import { KeyFigure } from "@ndla/ui";
12
12
  import { PluginType } from "../types";
13
13
 
14
- export const keyFigureEmbedPlugin: PluginType = (element, _, opts) => {
14
+ export const keyFigureEmbedPlugin: PluginType = (element, _) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props["data-json"] as string) as KeyFigureMetaData;
17
17
  const { title, subtitle, alt } = data.embedData;
@@ -27,7 +27,6 @@ export const keyFigureEmbedPlugin: PluginType = (element, _, opts) => {
27
27
  }
28
28
  : undefined
29
29
  }
30
- lang={opts.articleLanguage}
31
30
  />
32
31
  );
33
32
  };
@@ -16,10 +16,10 @@ export const errorSvgSrc = `data:image/svg+xml;charset=UTF-8,%3Csvg fill='%238A8
16
16
  export const blogPostEmbedPlugin: PluginType = (element, _, opts) => {
17
17
  const props = attributesToProps(element.attribs);
18
18
  const data = JSON.parse(props["data-json"] as string) as BlogPostMetaData;
19
- const { title, author, url, size, language, alt } = data.embedData;
19
+ const { title, author, url, size, alt } = data.embedData;
20
20
  return (
21
21
  <BlogPostV2
22
- title={{ title, language }}
22
+ title={title}
23
23
  author={author}
24
24
  url={url}
25
25
  size={size}
@@ -18,11 +18,8 @@ export const campaignBlockPlugin: PluginType = (element, _, opts) => {
18
18
 
19
19
  return (
20
20
  <CampaignBlock
21
- title={{ title: embed.title, language: embed.titleLanguage }}
22
- description={{
23
- text: embed.description,
24
- language: embed.descriptionLanguage,
25
- }}
21
+ title={embed.title}
22
+ description={embed.description}
26
23
  url={{ url: embed.url, text: embed.urlText }}
27
24
  path={opts.path}
28
25
  imageSide={embed.imageSide}
@@ -15,5 +15,5 @@ export const linkBlockPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props["data-json"] as string) as LinkBlockMetaData;
17
17
 
18
- return <LinkBlock {...data.embedData} path={opts.path} />;
18
+ return <LinkBlock {...data.embedData} path={opts.path} articleLanguage={opts.articleLanguage} />;
19
19
  };