@ndla/article-converter 6.0.67 → 6.1.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.
- package/es/plugins/embed/copyrightEmbedPlugin.js +19 -0
- package/es/plugins/embed/index.js +3 -1
- package/lib/plugins/embed/copyrightEmbedPlugin.d.ts +9 -0
- package/lib/plugins/embed/copyrightEmbedPlugin.js +26 -0
- package/lib/plugins/embed/index.js +3 -1
- package/package.json +5 -5
- package/src/plugins/embed/copyrightEmbedPlugin.tsx +18 -0
- package/src/plugins/embed/index.ts +2 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
+
import { CopyrightEmbed } from "@ndla/ui";
|
|
11
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
|
+
export const copyrightEmbedPlugin = (element, opts) => {
|
|
13
|
+
const props = attributesToProps(element.attribs);
|
|
14
|
+
const data = JSON.parse(props["data-json"]);
|
|
15
|
+
return _jsx(CopyrightEmbed, {
|
|
16
|
+
embed: data,
|
|
17
|
+
children: domToReact(element.children, opts)
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -15,6 +15,7 @@ import { conceptEmbedPlugin } from "./conceptEmbedPlugin";
|
|
|
15
15
|
import { conceptListEmbedPlugin } from "./conceptListEmbedPlugin";
|
|
16
16
|
import { contactBlockEmbedPlugin } from "./contactBlockEmbedPlugin";
|
|
17
17
|
import { contentLinkEmbedPlugin } from "./contentLinkEmbedPlugin";
|
|
18
|
+
import { copyrightEmbedPlugin } from "./copyrightEmbedPlugin";
|
|
18
19
|
import { externalEmbedPlugin } from "./externalEmbedPlugin";
|
|
19
20
|
import { fileEmbedPlugin } from "./fileEmbedPlugin";
|
|
20
21
|
import { footnoteEmbedPlugin } from "./footnoteEmbedPlugin";
|
|
@@ -44,5 +45,6 @@ export const embedPlugins = {
|
|
|
44
45
|
"contact-block": contactBlockEmbedPlugin,
|
|
45
46
|
"campaign-block": campaignBlockPlugin,
|
|
46
47
|
"link-block": linkBlockPlugin,
|
|
47
|
-
"uu-disclaimer": uuDisclaimerEmbedPlugin
|
|
48
|
+
"uu-disclaimer": uuDisclaimerEmbedPlugin,
|
|
49
|
+
copyright: copyrightEmbedPlugin
|
|
48
50
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { PluginType } from "../types";
|
|
9
|
+
export declare const copyrightEmbedPlugin: PluginType;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.copyrightEmbedPlugin = void 0;
|
|
7
|
+
var _htmlReactParser = require("html-react-parser");
|
|
8
|
+
var _ui = require("@ndla/ui");
|
|
9
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2024-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const copyrightEmbedPlugin = (element, opts) => {
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
|
|
20
|
+
const data = JSON.parse(props["data-json"]);
|
|
21
|
+
return (0, _jsxRuntime.jsx)(_ui.CopyrightEmbed, {
|
|
22
|
+
embed: data,
|
|
23
|
+
children: (0, _htmlReactParser.domToReact)(element.children, opts)
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.copyrightEmbedPlugin = copyrightEmbedPlugin;
|
|
@@ -13,6 +13,7 @@ var _conceptEmbedPlugin = require("./conceptEmbedPlugin");
|
|
|
13
13
|
var _conceptListEmbedPlugin = require("./conceptListEmbedPlugin");
|
|
14
14
|
var _contactBlockEmbedPlugin = require("./contactBlockEmbedPlugin");
|
|
15
15
|
var _contentLinkEmbedPlugin = require("./contentLinkEmbedPlugin");
|
|
16
|
+
var _copyrightEmbedPlugin = require("./copyrightEmbedPlugin");
|
|
16
17
|
var _externalEmbedPlugin = require("./externalEmbedPlugin");
|
|
17
18
|
var _fileEmbedPlugin = require("./fileEmbedPlugin");
|
|
18
19
|
var _footnoteEmbedPlugin = require("./footnoteEmbedPlugin");
|
|
@@ -50,5 +51,6 @@ const embedPlugins = exports.embedPlugins = {
|
|
|
50
51
|
"contact-block": _contactBlockEmbedPlugin.contactBlockEmbedPlugin,
|
|
51
52
|
"campaign-block": _campaignBlockPlugin.campaignBlockPlugin,
|
|
52
53
|
"link-block": _linkBlockEmbedPlugin.linkBlockPlugin,
|
|
53
|
-
"uu-disclaimer": _uuDisclaimerEmbedPlugin.uuDisclaimerEmbedPlugin
|
|
54
|
+
"uu-disclaimer": _uuDisclaimerEmbedPlugin.uuDisclaimerEmbedPlugin,
|
|
55
|
+
copyright: _copyrightEmbedPlugin.copyrightEmbedPlugin
|
|
54
56
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/article-converter",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.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.21",
|
|
31
|
-
"@ndla/types-embed": "^4.0
|
|
31
|
+
"@ndla/types-embed": "^4.1.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/code": "^5.0.
|
|
35
|
-
"@ndla/ui": "^50.
|
|
34
|
+
"@ndla/code": "^5.0.45",
|
|
35
|
+
"@ndla/ui": "^50.10.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": "6d5e717f95c71a9548584cf88493e22ed51f77b4"
|
|
52
52
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
+
import { CopyrightMetaData } from "@ndla/types-embed";
|
|
11
|
+
import { CopyrightEmbed } from "@ndla/ui";
|
|
12
|
+
import { PluginType } from "../types";
|
|
13
|
+
|
|
14
|
+
export const copyrightEmbedPlugin: PluginType = (element, opts) => {
|
|
15
|
+
const props = attributesToProps(element.attribs);
|
|
16
|
+
const data = JSON.parse(props["data-json"]) as CopyrightMetaData;
|
|
17
|
+
return <CopyrightEmbed embed={data}>{domToReact(element.children, opts)}</CopyrightEmbed>;
|
|
18
|
+
};
|
|
@@ -15,6 +15,7 @@ import { conceptEmbedPlugin } from "./conceptEmbedPlugin";
|
|
|
15
15
|
import { conceptListEmbedPlugin } from "./conceptListEmbedPlugin";
|
|
16
16
|
import { contactBlockEmbedPlugin } from "./contactBlockEmbedPlugin";
|
|
17
17
|
import { contentLinkEmbedPlugin } from "./contentLinkEmbedPlugin";
|
|
18
|
+
import { copyrightEmbedPlugin } from "./copyrightEmbedPlugin";
|
|
18
19
|
import { externalEmbedPlugin } from "./externalEmbedPlugin";
|
|
19
20
|
import { fileEmbedPlugin } from "./fileEmbedPlugin";
|
|
20
21
|
import { footnoteEmbedPlugin } from "./footnoteEmbedPlugin";
|
|
@@ -47,4 +48,5 @@ export const embedPlugins: Record<string, PluginType> = {
|
|
|
47
48
|
"campaign-block": campaignBlockPlugin,
|
|
48
49
|
"link-block": linkBlockPlugin,
|
|
49
50
|
"uu-disclaimer": uuDisclaimerEmbedPlugin,
|
|
51
|
+
copyright: copyrightEmbedPlugin,
|
|
50
52
|
};
|