@ndla/article-converter 10.0.30-alpha.0 → 10.0.32-alpha.0
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.
- package/README.md +1 -1
- package/es/plugins/anchorPlugin.js +2 -2
- package/es/plugins/asidePlugin.js +2 -2
- package/es/plugins/blockquotePlugin.js +2 -2
- package/es/plugins/copyParagraphPlugin.js +2 -2
- package/es/plugins/detailsPlugin.js +2 -2
- package/es/plugins/divPlugin.js +7 -7
- package/es/plugins/dlPlugin.js +2 -2
- package/es/plugins/embed/KeyFigureEmbedPlugin.js +2 -2
- package/es/plugins/embed/audioEmbedPlugin.js +2 -2
- package/es/plugins/embed/blogPostEmbedPlugin.js +2 -2
- package/es/plugins/embed/brightcoveEmbedPlugin.js +2 -2
- package/es/plugins/embed/campaignBlockPlugin.js +2 -2
- package/es/plugins/embed/codeEmbedPlugin.js +2 -2
- package/es/plugins/embed/conceptEmbedPlugin.js +2 -2
- package/es/plugins/embed/contactBlockEmbedPlugin.js +2 -2
- package/es/plugins/embed/contentLinkEmbedPlugin.js +2 -2
- package/es/plugins/embed/copyrightEmbedPlugin.js +2 -2
- package/es/plugins/embed/externalEmbedPlugin.js +2 -2
- package/es/plugins/embed/fileEmbedPlugin.js +3 -3
- package/es/plugins/embed/footnoteEmbedPlugin.js +2 -2
- package/es/plugins/embed/h5pEmbedPlugin.js +2 -2
- package/es/plugins/embed/iframeEmbedPlugin.js +2 -2
- package/es/plugins/embed/imageEmbedPlugin.js +2 -2
- package/es/plugins/embed/linkBlockEmbedPlugin.js +2 -2
- package/es/plugins/embed/relatedContentEmbedPlugin.js +2 -2
- package/es/plugins/embed/uuDisclaimerEmbedPlugin.js +2 -2
- package/es/plugins/h3Plugin.js +2 -1
- package/es/plugins/mathPlugin.js +2 -2
- package/es/plugins/navPlugin.js +2 -2
- package/es/plugins/oembed/anchorPlugin.js +2 -2
- package/es/plugins/olPlugin.js +2 -2
- package/es/plugins/paragraphPlugin.js +2 -2
- package/es/plugins/summaryPlugin.js +2 -2
- package/es/plugins/tablePlugin.js +2 -2
- package/es/plugins/ulPlugin.js +2 -2
- package/es/transform.js +2 -2
- package/lib/plugins/anchorPlugin.js +2 -2
- package/lib/plugins/asidePlugin.js +2 -2
- package/lib/plugins/blockquotePlugin.js +2 -2
- package/lib/plugins/copyParagraphPlugin.js +2 -2
- package/lib/plugins/detailsPlugin.js +2 -2
- package/lib/plugins/divPlugin.js +7 -7
- package/lib/plugins/dlPlugin.js +2 -2
- package/lib/plugins/embed/KeyFigureEmbedPlugin.js +2 -2
- package/lib/plugins/embed/audioEmbedPlugin.js +2 -2
- package/lib/plugins/embed/blogPostEmbedPlugin.js +2 -2
- package/lib/plugins/embed/brightcoveEmbedPlugin.js +2 -2
- package/lib/plugins/embed/campaignBlockPlugin.js +2 -2
- package/lib/plugins/embed/codeEmbedPlugin.js +2 -2
- package/lib/plugins/embed/conceptEmbedPlugin.js +2 -2
- package/lib/plugins/embed/contactBlockEmbedPlugin.js +2 -2
- package/lib/plugins/embed/contentLinkEmbedPlugin.js +2 -2
- package/lib/plugins/embed/copyrightEmbedPlugin.js +2 -2
- package/lib/plugins/embed/externalEmbedPlugin.js +2 -2
- package/lib/plugins/embed/fileEmbedPlugin.js +3 -3
- package/lib/plugins/embed/footnoteEmbedPlugin.js +2 -2
- package/lib/plugins/embed/h5pEmbedPlugin.js +2 -2
- package/lib/plugins/embed/iframeEmbedPlugin.js +2 -2
- package/lib/plugins/embed/imageEmbedPlugin.js +2 -2
- package/lib/plugins/embed/linkBlockEmbedPlugin.js +2 -2
- package/lib/plugins/embed/relatedContentEmbedPlugin.js +2 -2
- package/lib/plugins/embed/uuDisclaimerEmbedPlugin.js +2 -2
- package/lib/plugins/h3Plugin.js +2 -1
- package/lib/plugins/mathPlugin.js +2 -2
- package/lib/plugins/navPlugin.js +2 -2
- package/lib/plugins/oembed/anchorPlugin.js +2 -2
- package/lib/plugins/olPlugin.js +2 -2
- package/lib/plugins/paragraphPlugin.js +2 -2
- package/lib/plugins/summaryPlugin.js +2 -2
- package/lib/plugins/tablePlugin.js +2 -2
- package/lib/plugins/ulPlugin.js +2 -2
- package/lib/transform.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { SafeLink } from "@ndla/safelink";
|
|
11
11
|
import { getPossiblyRelativeUrl } from "@ndla/ui";
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
export const anchorPlugin = (node, opts, _ref) => {
|
|
14
14
|
let {
|
|
15
15
|
path
|
|
16
16
|
} = _ref;
|
|
17
17
|
const props = attributesToProps(node.attribs);
|
|
18
18
|
const href = getPossiblyRelativeUrl(props.href, path);
|
|
19
|
-
return _jsx(SafeLink, {
|
|
19
|
+
return /*#__PURE__*/_jsx(SafeLink, {
|
|
20
20
|
...props,
|
|
21
21
|
to: href,
|
|
22
22
|
children: domToReact(node.children, opts)
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { domToReact } from "html-react-parser";
|
|
10
10
|
import { FactBox } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const asidePlugin = (node, opts) => {
|
|
13
13
|
if (node.attribs["data-type"] === "factAside") {
|
|
14
|
-
return _jsx(FactBox, {
|
|
14
|
+
return /*#__PURE__*/_jsx(FactBox, {
|
|
15
15
|
children: domToReact(node.children, opts)
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { BlockQuote } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const blockquotePlugin = (node, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(BlockQuote, {
|
|
14
|
+
return /*#__PURE__*/_jsx(BlockQuote, {
|
|
15
15
|
...props,
|
|
16
16
|
children: domToReact(node.children, opts)
|
|
17
17
|
});
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { domToReact } from "html-react-parser";
|
|
10
10
|
import { CopyParagraphButton } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const copyParagraphPlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const parent = node.parent;
|
|
14
14
|
if (parent?.name === "section" || parent?.name === "div" && Object.keys(parent.attribs ?? {}).length === 0 || parent?.name === "ndlaembed" && parent.attribs["data-resource"] === "uu-disclaimer") {
|
|
15
|
-
return _jsx(CopyParagraphButton, {
|
|
15
|
+
return /*#__PURE__*/_jsx(CopyParagraphButton, {
|
|
16
16
|
copyText: node.attribs["data-text"],
|
|
17
17
|
lang: opts.articleLanguage,
|
|
18
18
|
children: domToReact(node.children, converterOpts)
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { ExpandableBox } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const detailsPlugin = (node, converterOpts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(ExpandableBox, {
|
|
14
|
+
return /*#__PURE__*/_jsx(ExpandableBox, {
|
|
15
15
|
...props,
|
|
16
16
|
children: domToReact(node.children, converterOpts)
|
|
17
17
|
});
|
package/es/plugins/divPlugin.js
CHANGED
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
import { domToReact, attributesToProps } from "html-react-parser";
|
|
10
10
|
import { FramedContent } from "@ndla/primitives";
|
|
11
11
|
import { FileListEmbed, RelatedArticleList, Grid, GridParallaxItem } from "@ndla/ui";
|
|
12
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
export const divPlugin = (node, opts) => {
|
|
14
14
|
if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
|
|
15
|
-
return _jsx(FramedContent, {
|
|
15
|
+
return /*#__PURE__*/_jsx(FramedContent, {
|
|
16
16
|
children: domToReact(node.children, opts)
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
if (node.attribs["data-type"] === "related-content" && node.children.length) {
|
|
20
20
|
const props = attributesToProps(node.attribs);
|
|
21
|
-
return _jsx(RelatedArticleList, {
|
|
21
|
+
return /*#__PURE__*/_jsx(RelatedArticleList, {
|
|
22
22
|
...props,
|
|
23
23
|
children: domToReact(node.children, opts)
|
|
24
24
|
});
|
|
@@ -30,8 +30,8 @@ export const divPlugin = (node, opts) => {
|
|
|
30
30
|
arr.push(el);
|
|
31
31
|
return acc;
|
|
32
32
|
}, [[], []]);
|
|
33
|
-
return _jsxs(_Fragment, {
|
|
34
|
-
children: [files.length ? _jsx(FileListEmbed, {
|
|
33
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
34
|
+
children: [files.length ? /*#__PURE__*/_jsx(FileListEmbed, {
|
|
35
35
|
children: domToReact(files, opts)
|
|
36
36
|
}) : undefined, domToReact(pdfs, opts)]
|
|
37
37
|
});
|
|
@@ -41,7 +41,7 @@ export const divPlugin = (node, opts) => {
|
|
|
41
41
|
const columns = props["data-columns"];
|
|
42
42
|
const border = props["data-border"];
|
|
43
43
|
const background = props["data-background"];
|
|
44
|
-
return _jsx(Grid, {
|
|
44
|
+
return /*#__PURE__*/_jsx(Grid, {
|
|
45
45
|
border: border,
|
|
46
46
|
columns: columns,
|
|
47
47
|
background: background,
|
|
@@ -50,7 +50,7 @@ export const divPlugin = (node, opts) => {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
if (node.attribs["data-parallax-cell"] === "true" && node.children.length) {
|
|
53
|
-
return _jsx(GridParallaxItem, {
|
|
53
|
+
return /*#__PURE__*/_jsx(GridParallaxItem, {
|
|
54
54
|
children: domToReact(node.children, opts)
|
|
55
55
|
});
|
|
56
56
|
}
|
package/es/plugins/dlPlugin.js
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { DefinitionList } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const dlPlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(DefinitionList, {
|
|
14
|
+
return /*#__PURE__*/_jsx(DefinitionList, {
|
|
15
15
|
...props,
|
|
16
16
|
lang: opts.articleLanguage,
|
|
17
17
|
children: domToReact(node.children, converterOpts)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { KeyFigure } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const keyFigureEmbedPlugin = (element, _) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
@@ -17,7 +17,7 @@ export const keyFigureEmbedPlugin = (element, _) => {
|
|
|
17
17
|
subtitle,
|
|
18
18
|
alt
|
|
19
19
|
} = data.embedData;
|
|
20
|
-
return _jsx(KeyFigure, {
|
|
20
|
+
return /*#__PURE__*/_jsx(KeyFigure, {
|
|
21
21
|
title: title,
|
|
22
22
|
subtitle: subtitle,
|
|
23
23
|
image: data.status === "success" && data.data.metaImage ? {
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { AudioEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const audioEmbedPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(AudioEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(AudioEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
lang: opts.articleLanguage
|
|
18
18
|
});
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { BlogPostV2 } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "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);
|
|
@@ -20,7 +20,7 @@ export const blogPostEmbedPlugin = (element, _, opts) => {
|
|
|
20
20
|
size,
|
|
21
21
|
alt
|
|
22
22
|
} = data.embedData;
|
|
23
|
-
return _jsx(BlogPostV2, {
|
|
23
|
+
return /*#__PURE__*/_jsx(BlogPostV2, {
|
|
24
24
|
title: title,
|
|
25
25
|
author: author,
|
|
26
26
|
url: url,
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { BrightcoveEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const brightcoveEmbedPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(BrightcoveEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(BrightcoveEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
renderContext: opts.renderContext,
|
|
18
18
|
lang: opts.articleLanguage
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { CampaignBlock } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const campaignBlockPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
15
|
const embed = data.embedData;
|
|
16
|
-
return _jsx(CampaignBlock, {
|
|
16
|
+
return /*#__PURE__*/_jsx(CampaignBlock, {
|
|
17
17
|
title: embed.title,
|
|
18
18
|
description: embed.description,
|
|
19
19
|
url: {
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { CodeEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const codeEmbedPlugin = element => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(CodeEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(CodeEmbed, {
|
|
16
16
|
embed: data
|
|
17
17
|
});
|
|
18
18
|
};
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { ConceptEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const conceptEmbedPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(ConceptEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(ConceptEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
lang: opts.articleLanguage,
|
|
18
18
|
renderContext: opts.renderContext,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { ContactBlock, contactBlockBackgrounds } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export function isBackground(background) {
|
|
13
13
|
return contactBlockBackgrounds.includes(background ?? "");
|
|
14
14
|
}
|
|
@@ -27,7 +27,7 @@ export const contactBlockEmbedPlugin = (element, _, opts) => {
|
|
|
27
27
|
alt
|
|
28
28
|
} = embedData.embedData;
|
|
29
29
|
const parsedBackground = parseBackground(background);
|
|
30
|
-
return _jsx(ContactBlock, {
|
|
30
|
+
return /*#__PURE__*/_jsx(ContactBlock, {
|
|
31
31
|
image: embedData.status === "success" ? embedData.data.image : undefined,
|
|
32
32
|
embedAlt: alt,
|
|
33
33
|
description: description,
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { ContentLinkEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const contentLinkEmbedPlugin = (element, opts, _ref) => {
|
|
13
13
|
let {
|
|
14
14
|
isOembed
|
|
15
15
|
} = _ref;
|
|
16
16
|
const props = attributesToProps(element.attribs);
|
|
17
17
|
const data = JSON.parse(props["data-json"]);
|
|
18
|
-
return _jsx(ContentLinkEmbed, {
|
|
18
|
+
return /*#__PURE__*/_jsx(ContentLinkEmbed, {
|
|
19
19
|
embed: data,
|
|
20
20
|
isOembed: isOembed,
|
|
21
21
|
children: domToReact(element.children, opts)
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { CopyrightEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const copyrightEmbedPlugin = (element, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(CopyrightEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(CopyrightEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
children: domToReact(element.children, opts)
|
|
18
18
|
});
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { ExternalEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const externalEmbedPlugin = element => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(ExternalEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(ExternalEmbed, {
|
|
16
16
|
embed: data
|
|
17
17
|
});
|
|
18
18
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { PdfFile, FileListElement } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const fileEmbedPlugin = element => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
@@ -19,12 +19,12 @@ export const fileEmbedPlugin = element => {
|
|
|
19
19
|
display
|
|
20
20
|
} = data.embedData;
|
|
21
21
|
if (type === "pdf" && display === "block") {
|
|
22
|
-
return _jsx(PdfFile, {
|
|
22
|
+
return /*#__PURE__*/_jsx(PdfFile, {
|
|
23
23
|
title: title,
|
|
24
24
|
url: url
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
return _jsx(FileListElement, {
|
|
27
|
+
return /*#__PURE__*/_jsx(FileListElement, {
|
|
28
28
|
url: url,
|
|
29
29
|
title: title,
|
|
30
30
|
fileExists: data.status === "success" ? !!data.data.exists : false,
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { FootnoteEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const footnoteEmbedPlugin = element => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(FootnoteEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(FootnoteEmbed, {
|
|
16
16
|
embed: data
|
|
17
17
|
});
|
|
18
18
|
};
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { H5pEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const h5pEmbedPlugin = element => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(H5pEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(H5pEmbed, {
|
|
16
16
|
embed: data
|
|
17
17
|
});
|
|
18
18
|
};
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { IframeEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const iframeEmbedPlugin = element => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(IframeEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(IframeEmbed, {
|
|
16
16
|
embed: data
|
|
17
17
|
});
|
|
18
18
|
};
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { ImageEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const imageEmbedPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(ImageEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(ImageEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
previewAlt: opts.previewAlt,
|
|
18
18
|
lang: opts.articleLanguage,
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { LinkBlock } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const linkBlockPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(LinkBlock, {
|
|
15
|
+
return /*#__PURE__*/_jsx(LinkBlock, {
|
|
16
16
|
...data.embedData,
|
|
17
17
|
path: opts.path,
|
|
18
18
|
articleLanguage: opts.articleLanguage
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { RelatedContentEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const relatedContentEmbedPlugin = (element, _, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(RelatedContentEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(RelatedContentEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
subject: opts.subject,
|
|
18
18
|
ndlaFrontendDomain: opts.frontendDomain
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { UuDisclaimerEmbed } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const uuDisclaimerEmbedPlugin = (element, opts) => {
|
|
13
13
|
const props = attributesToProps(element.attribs);
|
|
14
14
|
const data = JSON.parse(props["data-json"]);
|
|
15
|
-
return _jsx(UuDisclaimerEmbed, {
|
|
15
|
+
return /*#__PURE__*/_jsx(UuDisclaimerEmbed, {
|
|
16
16
|
embed: data,
|
|
17
17
|
children: domToReact(element.children, opts)
|
|
18
18
|
});
|
package/es/plugins/h3Plugin.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import { jsx as _jsx } from "
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
export const h3Plugin = (node, converterOpts, opts) => {
|
|
12
12
|
const props = attributesToProps(node.attribs);
|
|
13
13
|
return (
|
|
14
|
+
/*#__PURE__*/
|
|
14
15
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
15
16
|
_jsx("h3", {
|
|
16
17
|
...props,
|
package/es/plugins/mathPlugin.js
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
|
-
import { jsx as _jsx } from "
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
export const mathPlugin = node => {
|
|
12
12
|
const {
|
|
13
13
|
"data-math": mathContent,
|
|
14
14
|
...props
|
|
15
15
|
} = attributesToProps(node.attribs);
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
return _jsx("math", {
|
|
17
|
+
return /*#__PURE__*/_jsx("math", {
|
|
18
18
|
...props,
|
|
19
19
|
dangerouslySetInnerHTML: {
|
|
20
20
|
__html: mathContent
|
package/es/plugins/navPlugin.js
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { LinkBlockSection } from "@ndla/ui";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const navPlugin = (node, opts) => {
|
|
13
13
|
if (node.attribs["data-type"] === "link-block-list") {
|
|
14
14
|
const props = attributesToProps(node.attribs);
|
|
15
|
-
return _jsx(LinkBlockSection, {
|
|
15
|
+
return /*#__PURE__*/_jsx(LinkBlockSection, {
|
|
16
16
|
...props,
|
|
17
17
|
children: domToReact(node.children, opts)
|
|
18
18
|
});
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { SafeLink } from "@ndla/safelink";
|
|
11
11
|
import { getPossiblyRelativeUrl } from "@ndla/ui";
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
export const anchorPlugin = (node, options, _ref) => {
|
|
14
14
|
let {
|
|
15
15
|
path
|
|
16
16
|
} = _ref;
|
|
17
17
|
const props = attributesToProps(node.attribs);
|
|
18
18
|
const href = getPossiblyRelativeUrl(props.href, path);
|
|
19
|
-
return _jsx(SafeLink, {
|
|
19
|
+
return /*#__PURE__*/_jsx(SafeLink, {
|
|
20
20
|
...props,
|
|
21
21
|
target: "_blank",
|
|
22
22
|
to: href,
|
package/es/plugins/olPlugin.js
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { OrderedList } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const olPlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
14
|
const variantProp = node.attribs["data-type"] === "letters" ? {
|
|
15
15
|
variant: "letters"
|
|
16
16
|
} : {};
|
|
17
|
-
return _jsx(OrderedList, {
|
|
17
|
+
return /*#__PURE__*/_jsx(OrderedList, {
|
|
18
18
|
...props,
|
|
19
19
|
...variantProp,
|
|
20
20
|
lang: opts.articleLanguage,
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import { jsx as _jsx } from "
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
export const paragraphPlugin = (node, converterOpts, opts) => {
|
|
12
12
|
const props = attributesToProps(node.attribs);
|
|
13
|
-
return _jsx("p", {
|
|
13
|
+
return /*#__PURE__*/_jsx("p", {
|
|
14
14
|
...props,
|
|
15
15
|
lang: opts.articleLanguage,
|
|
16
16
|
children: domToReact(node.children, converterOpts)
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { ExpandableBoxSummary } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const summaryPlugin = (node, converterOpts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(ExpandableBoxSummary, {
|
|
14
|
+
return /*#__PURE__*/_jsx(ExpandableBoxSummary, {
|
|
15
15
|
...props,
|
|
16
16
|
children: domToReact(node.children, converterOpts)
|
|
17
17
|
});
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { Table } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const tablePlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(Table, {
|
|
14
|
+
return /*#__PURE__*/_jsx(Table, {
|
|
15
15
|
...props,
|
|
16
16
|
lang: opts.articleLanguage,
|
|
17
17
|
children: domToReact(node.children, converterOpts)
|
package/es/plugins/ulPlugin.js
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
10
|
import { UnOrderedList } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx } from "
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
export const ulPlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(UnOrderedList, {
|
|
14
|
+
return /*#__PURE__*/_jsx(UnOrderedList, {
|
|
15
15
|
...props,
|
|
16
16
|
className: node.attribs.class,
|
|
17
17
|
lang: opts.articleLanguage,
|
package/es/transform.js
CHANGED
|
@@ -10,7 +10,7 @@ import parse from "html-react-parser";
|
|
|
10
10
|
import { UnknownEmbed } from "@ndla/ui";
|
|
11
11
|
import { basePlugins, oembedPlugins } from "./plugins";
|
|
12
12
|
import { embedPlugins } from "./plugins/embed";
|
|
13
|
-
import { jsx as _jsx } from "
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const transform = (content, opts) => {
|
|
15
15
|
const plugins = opts?.isOembed ? oembedPlugins : basePlugins;
|
|
16
16
|
const options = {
|
|
@@ -26,7 +26,7 @@ const transform = (content, opts) => {
|
|
|
26
26
|
return embedPlugins[node.attribs["data-resource"]](node, options, opts);
|
|
27
27
|
}
|
|
28
28
|
const embed = JSON.parse(node.attribs["data-json"]);
|
|
29
|
-
return _jsx(UnknownEmbed, {
|
|
29
|
+
return /*#__PURE__*/_jsx(UnknownEmbed, {
|
|
30
30
|
embed: embed
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -7,7 +7,7 @@ exports.anchorPlugin = void 0;
|
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
8
|
var _safelink = require("@ndla/safelink");
|
|
9
9
|
var _ui = require("@ndla/ui");
|
|
10
|
-
var _jsxRuntime = require("
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
/**
|
|
12
12
|
* Copyright (c) 2023-present, NDLA.
|
|
13
13
|
*
|
|
@@ -22,7 +22,7 @@ const anchorPlugin = (node, opts, _ref) => {
|
|
|
22
22
|
} = _ref;
|
|
23
23
|
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
24
24
|
const href = (0, _ui.getPossiblyRelativeUrl)(props.href, path);
|
|
25
|
-
return (0, _jsxRuntime.jsx)(_safelink.SafeLink, {
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
|
|
26
26
|
...props,
|
|
27
27
|
to: href,
|
|
28
28
|
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|