@ndla/article-converter 6.0.27 → 6.0.28
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,11 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
import { domToReact, attributesToProps } from 'html-react-parser';
|
|
10
10
|
import partition from 'lodash/partition';
|
|
11
|
-
import { FileList, RelatedArticleList, Grid, GridParallaxItem } from '@ndla/ui';
|
|
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') {
|
|
17
|
+
return _jsx(FramedContent, {
|
|
18
|
+
children: domToReact(node.children, opts)
|
|
19
|
+
});
|
|
20
|
+
}
|
|
16
21
|
if (node.attribs['data-type'] === 'related-content' && node.children.length) {
|
|
17
22
|
const props = attributesToProps(node.attribs);
|
|
18
23
|
return _jsx(RelatedArticleList, {
|
package/lib/plugins/divPlugin.js
CHANGED
|
@@ -18,6 +18,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
const divPlugin = (node, opts) => {
|
|
21
|
+
if (node.attribs['data-type'] === 'framed-content' || node.attribs.class === 'c-bodybox') {
|
|
22
|
+
return (0, _jsxRuntime.jsx)(_ui.FramedContent, {
|
|
23
|
+
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
21
26
|
if (node.attribs['data-type'] === 'related-content' && node.children.length) {
|
|
22
27
|
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
23
28
|
return (0, _jsxRuntime.jsx)(_ui.RelatedArticleList, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/article-converter",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.28",
|
|
4
4
|
"description": "Transforms NDLA articles into extended html versions",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ndla/code": "^5.0.22",
|
|
35
|
-
"@ndla/ui": "^50.5.
|
|
35
|
+
"@ndla/ui": "^50.5.1",
|
|
36
36
|
"html-react-parser": "^4.2.2",
|
|
37
37
|
"lodash": "^4.17.20"
|
|
38
38
|
},
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e2746547c6056cd97e80ced58fe8a3be9edf3c4b"
|
|
52
52
|
}
|
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
import { domToReact, attributesToProps, Element } from 'html-react-parser';
|
|
10
10
|
import partition from 'lodash/partition';
|
|
11
|
-
import { FileList, RelatedArticleList, Grid, GridType, GridParallaxItem } from '@ndla/ui';
|
|
11
|
+
import { FileList, RelatedArticleList, Grid, GridType, GridParallaxItem, FramedContent } from '@ndla/ui';
|
|
12
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') {
|
|
16
|
+
return <FramedContent>{domToReact(node.children, opts)}</FramedContent>;
|
|
17
|
+
}
|
|
15
18
|
if (node.attribs['data-type'] === 'related-content' && node.children.length) {
|
|
16
19
|
const props = attributesToProps(node.attribs);
|
|
17
20
|
|