@ndla/article-converter 10.0.3-alpha.0 → 10.0.4-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/es/plugins/divPlugin.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { domToReact, attributesToProps } from "html-react-parser";
|
|
10
10
|
import { FramedContent } from "@ndla/primitives";
|
|
11
|
-
import {
|
|
11
|
+
import { FileListEmbed, RelatedArticleList, Grid, GridParallaxItem } from "@ndla/ui";
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
13
13
|
export const divPlugin = (node, opts) => {
|
|
14
14
|
if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
|
|
@@ -31,7 +31,7 @@ export const divPlugin = (node, opts) => {
|
|
|
31
31
|
return acc;
|
|
32
32
|
}, [[], []]);
|
|
33
33
|
return _jsxs(_Fragment, {
|
|
34
|
-
children: [files.length ? _jsx(
|
|
34
|
+
children: [files.length ? _jsx(FileListEmbed, {
|
|
35
35
|
children: domToReact(files, opts)
|
|
36
36
|
}) : undefined, domToReact(pdfs, opts)]
|
|
37
37
|
});
|
|
@@ -41,9 +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
|
-
const frontpage = !!props["data-size"];
|
|
45
44
|
return _jsx(Grid, {
|
|
46
|
-
isFrontpage: frontpage,
|
|
47
45
|
border: border,
|
|
48
46
|
columns: columns,
|
|
49
47
|
background: background,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
|
-
import { PdfFile,
|
|
10
|
+
import { PdfFile, FileListElement } 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);
|
|
@@ -24,7 +24,7 @@ export const fileEmbedPlugin = element => {
|
|
|
24
24
|
url: url
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
return _jsx(
|
|
27
|
+
return _jsx(FileListElement, {
|
|
28
28
|
url: url,
|
|
29
29
|
title: title,
|
|
30
30
|
fileExists: data.status === "success" ? !!data.data.exists : false,
|
package/lib/plugins/divPlugin.js
CHANGED
|
@@ -37,7 +37,7 @@ const divPlugin = (node, opts) => {
|
|
|
37
37
|
return acc;
|
|
38
38
|
}, [[], []]);
|
|
39
39
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
40
|
-
children: [files.length ? (0, _jsxRuntime.jsx)(_ui.
|
|
40
|
+
children: [files.length ? (0, _jsxRuntime.jsx)(_ui.FileListEmbed, {
|
|
41
41
|
children: (0, _htmlReactParser.domToReact)(files, opts)
|
|
42
42
|
}) : undefined, (0, _htmlReactParser.domToReact)(pdfs, opts)]
|
|
43
43
|
});
|
|
@@ -47,9 +47,7 @@ const divPlugin = (node, opts) => {
|
|
|
47
47
|
const columns = props["data-columns"];
|
|
48
48
|
const border = props["data-border"];
|
|
49
49
|
const background = props["data-background"];
|
|
50
|
-
const frontpage = !!props["data-size"];
|
|
51
50
|
return (0, _jsxRuntime.jsx)(_ui.Grid, {
|
|
52
|
-
isFrontpage: frontpage,
|
|
53
51
|
border: border,
|
|
54
52
|
columns: columns,
|
|
55
53
|
background: background,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/article-converter",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.4-alpha.0",
|
|
4
4
|
"description": "Transforms NDLA articles into extended html versions",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@ndla/types-embed": "^5.0.0-alpha.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/primitives": "^1.0.
|
|
35
|
-
"@ndla/ui": "^56.0.
|
|
34
|
+
"@ndla/primitives": "^1.0.4-alpha.0",
|
|
35
|
+
"@ndla/ui": "^56.0.4-alpha.0",
|
|
36
36
|
"html-react-parser": "^5.1.8"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "0fdd094fea36baa5ee2bdfe5b2bc6c423d304f22"
|
|
51
51
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { domToReact, attributesToProps, Element, DOMNode } from "html-react-parser";
|
|
10
10
|
import { FramedContent } from "@ndla/primitives";
|
|
11
|
-
import {
|
|
11
|
+
import { FileListEmbed, RelatedArticleList, Grid, GridType, GridParallaxItem } from "@ndla/ui";
|
|
12
12
|
import { PluginType } from "./types";
|
|
13
13
|
|
|
14
14
|
export const divPlugin: PluginType = (node, opts) => {
|
|
@@ -40,7 +40,7 @@ export const divPlugin: PluginType = (node, opts) => {
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<>
|
|
43
|
-
{files.length ? <
|
|
43
|
+
{files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}
|
|
44
44
|
{domToReact(pdfs, opts)}
|
|
45
45
|
</>
|
|
46
46
|
);
|
|
@@ -50,9 +50,8 @@ export const divPlugin: PluginType = (node, opts) => {
|
|
|
50
50
|
const columns = props["data-columns"] as GridType["columns"];
|
|
51
51
|
const border = props["data-border"] as GridType["border"];
|
|
52
52
|
const background = props["data-background"] as GridType["background"];
|
|
53
|
-
const frontpage = !!props["data-size"] as GridType["size"];
|
|
54
53
|
return (
|
|
55
|
-
<Grid
|
|
54
|
+
<Grid border={border} columns={columns} background={background} {...props}>
|
|
56
55
|
{/* @ts-ignore */}
|
|
57
56
|
{domToReact(node.children, opts)}
|
|
58
57
|
</Grid>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { attributesToProps } from "html-react-parser";
|
|
10
10
|
import { FileMetaData } from "@ndla/types-embed";
|
|
11
|
-
import { PdfFile,
|
|
11
|
+
import { PdfFile, FileListElement } from "@ndla/ui";
|
|
12
12
|
import { PluginType } from "../types";
|
|
13
13
|
|
|
14
14
|
export const fileEmbedPlugin: PluginType = (element) => {
|
|
@@ -19,6 +19,11 @@ export const fileEmbedPlugin: PluginType = (element) => {
|
|
|
19
19
|
return <PdfFile title={title} url={url} />;
|
|
20
20
|
}
|
|
21
21
|
return (
|
|
22
|
-
<
|
|
22
|
+
<FileListElement
|
|
23
|
+
url={url}
|
|
24
|
+
title={title}
|
|
25
|
+
fileExists={data.status === "success" ? !!data.data.exists : false}
|
|
26
|
+
fileType={type}
|
|
27
|
+
/>
|
|
23
28
|
);
|
|
24
29
|
};
|