@ndla/article-converter 10.0.158-alpha.0 → 10.0.159-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/extractEmbedMeta.mjs +7 -0
- package/es/extractEmbedMeta.mjs.map +1 -1
- package/es/plugins/anchorPlugin.mjs +7 -0
- package/es/plugins/anchorPlugin.mjs.map +1 -1
- package/es/plugins/asidePlugin.mjs +7 -0
- package/es/plugins/asidePlugin.mjs.map +1 -1
- package/es/plugins/blockquotePlugin.mjs +7 -0
- package/es/plugins/blockquotePlugin.mjs.map +1 -1
- package/es/plugins/copyParagraphPlugin.mjs +7 -0
- package/es/plugins/copyParagraphPlugin.mjs.map +1 -1
- package/es/plugins/detailsPlugin.mjs +7 -0
- package/es/plugins/detailsPlugin.mjs.map +1 -1
- package/es/plugins/divPlugin.mjs +7 -0
- package/es/plugins/divPlugin.mjs.map +1 -1
- package/es/plugins/dlPlugin.mjs +7 -0
- package/es/plugins/dlPlugin.mjs.map +1 -1
- package/es/plugins/embed/KeyFigureEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/KeyFigureEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/audioEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/audioEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/brightcoveEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/brightcoveEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/campaignBlockPlugin.mjs +7 -0
- package/es/plugins/embed/campaignBlockPlugin.mjs.map +1 -1
- package/es/plugins/embed/codeEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/codeEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/conceptEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/conceptEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/contactBlockEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/contactBlockEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/contentLinkEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/contentLinkEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/copyrightEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/copyrightEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/externalEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/externalEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/fileEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/fileEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/footnoteEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/footnoteEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/h5pEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/h5pEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/iframeEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/iframeEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/imageEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/imageEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/index.mjs +7 -0
- package/es/plugins/embed/index.mjs.map +1 -1
- package/es/plugins/embed/linkBlockEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/linkBlockEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/pitchEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/pitchEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/relatedContentEmbedPlugin.mjs +8 -2
- package/es/plugins/embed/relatedContentEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/symbolEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/symbolEmbedPlugin.mjs.map +1 -1
- package/es/plugins/embed/uuDisclaimerEmbedPlugin.mjs +7 -0
- package/es/plugins/embed/uuDisclaimerEmbedPlugin.mjs.map +1 -1
- package/es/plugins/h3Plugin.mjs +7 -0
- package/es/plugins/h3Plugin.mjs.map +1 -1
- package/es/plugins/index.mjs +7 -0
- package/es/plugins/index.mjs.map +1 -1
- package/es/plugins/mathPlugin.mjs +7 -0
- package/es/plugins/mathPlugin.mjs.map +1 -1
- package/es/plugins/navPlugin.mjs +7 -0
- package/es/plugins/navPlugin.mjs.map +1 -1
- package/es/plugins/olPlugin.mjs +7 -0
- package/es/plugins/olPlugin.mjs.map +1 -1
- package/es/plugins/paragraphPlugin.mjs +7 -0
- package/es/plugins/paragraphPlugin.mjs.map +1 -1
- package/es/plugins/summaryPlugin.mjs +7 -0
- package/es/plugins/summaryPlugin.mjs.map +1 -1
- package/es/plugins/tablePlugin.mjs +7 -0
- package/es/plugins/tablePlugin.mjs.map +1 -1
- package/es/plugins/ulPlugin.mjs +7 -0
- package/es/plugins/ulPlugin.mjs.map +1 -1
- package/es/transform.mjs +7 -0
- package/es/transform.mjs.map +1 -1
- package/lib/extractEmbedMeta.js +7 -0
- package/lib/extractEmbedMeta.js.map +1 -1
- package/lib/plugins/anchorPlugin.js +7 -4
- package/lib/plugins/anchorPlugin.js.map +1 -1
- package/lib/plugins/asidePlugin.js +7 -3
- package/lib/plugins/asidePlugin.js.map +1 -1
- package/lib/plugins/blockquotePlugin.js +7 -3
- package/lib/plugins/blockquotePlugin.js.map +1 -1
- package/lib/plugins/copyParagraphPlugin.js +7 -3
- package/lib/plugins/copyParagraphPlugin.js.map +1 -1
- package/lib/plugins/detailsPlugin.js +7 -3
- package/lib/plugins/detailsPlugin.js.map +1 -1
- package/lib/plugins/divPlugin.js +7 -4
- package/lib/plugins/divPlugin.js.map +1 -1
- package/lib/plugins/dlPlugin.js +7 -3
- package/lib/plugins/dlPlugin.js.map +1 -1
- package/lib/plugins/embed/KeyFigureEmbedPlugin.js +7 -3
- package/lib/plugins/embed/KeyFigureEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/audioEmbedPlugin.js +7 -3
- package/lib/plugins/embed/audioEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/brightcoveEmbedPlugin.js +7 -3
- package/lib/plugins/embed/brightcoveEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/campaignBlockPlugin.js +7 -3
- package/lib/plugins/embed/campaignBlockPlugin.js.map +1 -1
- package/lib/plugins/embed/codeEmbedPlugin.js +7 -3
- package/lib/plugins/embed/codeEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/conceptEmbedPlugin.js +7 -3
- package/lib/plugins/embed/conceptEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/contactBlockEmbedPlugin.js +7 -3
- package/lib/plugins/embed/contactBlockEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/contentLinkEmbedPlugin.js +7 -3
- package/lib/plugins/embed/contentLinkEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/copyrightEmbedPlugin.js +7 -3
- package/lib/plugins/embed/copyrightEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/externalEmbedPlugin.js +7 -3
- package/lib/plugins/embed/externalEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/fileEmbedPlugin.js +7 -3
- package/lib/plugins/embed/fileEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/footnoteEmbedPlugin.js +7 -3
- package/lib/plugins/embed/footnoteEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/h5pEmbedPlugin.js +7 -3
- package/lib/plugins/embed/h5pEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/iframeEmbedPlugin.js +7 -3
- package/lib/plugins/embed/iframeEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/imageEmbedPlugin.js +7 -3
- package/lib/plugins/embed/imageEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/index.js +7 -1
- package/lib/plugins/embed/index.js.map +1 -1
- package/lib/plugins/embed/linkBlockEmbedPlugin.js +7 -3
- package/lib/plugins/embed/linkBlockEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/pitchEmbedPlugin.js +7 -3
- package/lib/plugins/embed/pitchEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/relatedContentEmbedPlugin.js +8 -5
- package/lib/plugins/embed/relatedContentEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/symbolEmbedPlugin.js +7 -2
- package/lib/plugins/embed/symbolEmbedPlugin.js.map +1 -1
- package/lib/plugins/embed/uuDisclaimerEmbedPlugin.js +7 -3
- package/lib/plugins/embed/uuDisclaimerEmbedPlugin.js.map +1 -1
- package/lib/plugins/h3Plugin.js +7 -2
- package/lib/plugins/h3Plugin.js.map +1 -1
- package/lib/plugins/index.js +7 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/mathPlugin.js +7 -2
- package/lib/plugins/mathPlugin.js.map +1 -1
- package/lib/plugins/navPlugin.js +7 -3
- package/lib/plugins/navPlugin.js.map +1 -1
- package/lib/plugins/olPlugin.js +7 -3
- package/lib/plugins/olPlugin.js.map +1 -1
- package/lib/plugins/paragraphPlugin.js +7 -2
- package/lib/plugins/paragraphPlugin.js.map +1 -1
- package/lib/plugins/summaryPlugin.js +7 -3
- package/lib/plugins/summaryPlugin.js.map +1 -1
- package/lib/plugins/tablePlugin.js +7 -3
- package/lib/plugins/tablePlugin.js.map +1 -1
- package/lib/plugins/ulPlugin.js +7 -3
- package/lib/plugins/ulPlugin.js.map +1 -1
- package/lib/transform.js +7 -2
- package/lib/transform.js.map +1 -1
- package/package.json +7 -7
- package/src/plugins/embed/relatedContentEmbedPlugin.tsx +1 -8
package/es/extractEmbedMeta.mjs
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import parse from "html-react-parser";
|
|
2
2
|
|
|
3
3
|
//#region src/extractEmbedMeta.ts
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) 2023-present, NDLA.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
4
11
|
const extractEmbedMeta = (embed) => {
|
|
5
12
|
const node = parse(embed);
|
|
6
13
|
if (typeof node === "string" || Array.isArray(node) || node.type !== "ndlaembed" || !node.props["data-json"]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractEmbedMeta.mjs","names":[],"sources":["../src/extractEmbedMeta.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { type EmbedMetaData } from \"@ndla/types-embed\";\n\nexport const extractEmbedMeta = (embed: string): EmbedMetaData | undefined => {\n const node = parse(embed);\n if (typeof node === \"string\" || Array.isArray(node) || node.type !== \"ndlaembed\" || !node.props[\"data-json\"]) {\n return;\n }\n\n return JSON.parse(node.props[\"data-json\"]) as EmbedMetaData;\n};\n\nexport const extractEmbedMetas = (embed: string): EmbedMetaData[] => {\n const nodes = parse(embed);\n\n // There are no embeds in the string\n if (typeof nodes === \"string\") {\n return [];\n }\n // There is only one embed in the string\n else if (!Array.isArray(nodes) && nodes.type === \"ndlaembed\" && !!nodes.props[\"data-json\"]) {\n return [JSON.parse(nodes.props[\"data-json\"]) as EmbedMetaData];\n }\n // There are multiple embeds in the string\n else if (\n Array.isArray(nodes) &&\n nodes.length &&\n nodes.every((n) => n.type === \"ndlaembed\" && !!n.props[\"data-json\"])\n ) {\n return nodes.map((n) => JSON.parse(n.props[\"data-json\"]) as EmbedMetaData);\n } else {\n return [];\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"extractEmbedMeta.mjs","names":[],"sources":["../src/extractEmbedMeta.ts"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { type EmbedMetaData } from \"@ndla/types-embed\";\n\nexport const extractEmbedMeta = (embed: string): EmbedMetaData | undefined => {\n const node = parse(embed);\n if (typeof node === \"string\" || Array.isArray(node) || node.type !== \"ndlaembed\" || !node.props[\"data-json\"]) {\n return;\n }\n\n return JSON.parse(node.props[\"data-json\"]) as EmbedMetaData;\n};\n\nexport const extractEmbedMetas = (embed: string): EmbedMetaData[] => {\n const nodes = parse(embed);\n\n // There are no embeds in the string\n if (typeof nodes === \"string\") {\n return [];\n }\n // There is only one embed in the string\n else if (!Array.isArray(nodes) && nodes.type === \"ndlaembed\" && !!nodes.props[\"data-json\"]) {\n return [JSON.parse(nodes.props[\"data-json\"]) as EmbedMetaData];\n }\n // There are multiple embeds in the string\n else if (\n Array.isArray(nodes) &&\n nodes.length &&\n nodes.every((n) => n.type === \"ndlaembed\" && !!n.props[\"data-json\"])\n ) {\n return nodes.map((n) => JSON.parse(n.props[\"data-json\"]) as EmbedMetaData);\n } else {\n return [];\n }\n};\n"],"mappings":";;;;;;;;;;AAWA,MAAa,oBAAoB,UAA6C;CAC5E,MAAM,OAAO,MAAM,MAAM;AACzB,KAAI,OAAO,SAAS,YAAY,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,eAAe,CAAC,KAAK,MAAM,aAC9F;AAGF,QAAO,KAAK,MAAM,KAAK,MAAM,aAAa;;AAG5C,MAAa,qBAAqB,UAAmC;CACnE,MAAM,QAAQ,MAAM,MAAM;AAG1B,KAAI,OAAO,UAAU,SACnB,QAAO,EAAE;UAGF,CAAC,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,eAAe,CAAC,CAAC,MAAM,MAAM,aAC5E,QAAO,CAAC,KAAK,MAAM,MAAM,MAAM,aAAa,CAAkB;UAI9D,MAAM,QAAQ,MAAM,IACpB,MAAM,UACN,MAAM,OAAO,MAAM,EAAE,SAAS,eAAe,CAAC,CAAC,EAAE,MAAM,aAAa,CAEpE,QAAO,MAAM,KAAK,MAAM,KAAK,MAAM,EAAE,MAAM,aAAa,CAAkB;KAE1E,QAAO,EAAE"}
|
|
@@ -4,6 +4,13 @@ import { SafeLink } from "@ndla/safelink";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/plugins/anchorPlugin.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) 2023-present, NDLA.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
7
14
|
const anchorPlugin = (node, opts, { path, isOembed }) => {
|
|
8
15
|
const props = attributesToProps(node.attribs);
|
|
9
16
|
const href = getPossiblyRelativeUrl(props.href, path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchorPlugin.mjs","names":["anchorPlugin: PluginType","oembedProps: AnchorHTMLAttributes<HTMLAnchorElement>"],"sources":["../../src/plugins/anchorPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport type { AnchorHTMLAttributes } from \"react\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { getPossiblyRelativeUrl } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const anchorPlugin: PluginType = (node, opts, { path, isOembed }) => {\n const props = attributesToProps(node.attribs);\n const href = getPossiblyRelativeUrl(props.href as string, path);\n\n const oembedProps: AnchorHTMLAttributes<HTMLAnchorElement> = isOembed ? { target: \"_blank\", rel: \"noreferrer\" } : {};\n\n return (\n <SafeLink {...props} to={href} {...oembedProps} target=\"\">\n {domToReact(node.children as DOMNode[], opts)}\n </SafeLink>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"anchorPlugin.mjs","names":["anchorPlugin: PluginType","oembedProps: AnchorHTMLAttributes<HTMLAnchorElement>"],"sources":["../../src/plugins/anchorPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport type { AnchorHTMLAttributes } from \"react\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { getPossiblyRelativeUrl } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const anchorPlugin: PluginType = (node, opts, { path, isOembed }) => {\n const props = attributesToProps(node.attribs);\n const href = getPossiblyRelativeUrl(props.href as string, path);\n\n const oembedProps: AnchorHTMLAttributes<HTMLAnchorElement> = isOembed ? { target: \"_blank\", rel: \"noreferrer\" } : {};\n\n return (\n <SafeLink {...props} to={href} {...oembedProps} target=\"\">\n {domToReact(node.children as DOMNode[], opts)}\n </SafeLink>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAaA,gBAA4B,MAAM,MAAM,EAAE,MAAM,eAAe;CAC1E,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;CAC7C,MAAM,OAAO,uBAAuB,MAAM,MAAgB,KAAK;CAE/D,MAAMC,cAAuD,WAAW;EAAE,QAAQ;EAAU,KAAK;EAAc,GAAG,EAAE;AAEpH,QACE,oBAAC;EAAS,GAAI;EAAO,IAAI;EAAM,GAAI;EAAa,QAAO;YACpD,WAAW,KAAK,UAAuB,KAAK;GACpC"}
|
|
@@ -3,6 +3,13 @@ import { FactBox } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/asidePlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const asidePlugin = (node, opts) => {
|
|
7
14
|
if (node.attribs["data-type"] === "factAside") return /* @__PURE__ */ jsx(FactBox, { children: domToReact(node.children, opts) });
|
|
8
15
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asidePlugin.mjs","names":["asidePlugin: PluginType"],"sources":["../../src/plugins/asidePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, domToReact } from \"html-react-parser\";\nimport { FactBox } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\nexport const asidePlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"factAside\") {\n return <FactBox>{domToReact(node.children as DOMNode[], opts)}</FactBox>;\n }\n return null;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"asidePlugin.mjs","names":["asidePlugin: PluginType"],"sources":["../../src/plugins/asidePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, domToReact } from \"html-react-parser\";\nimport { FactBox } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\nexport const asidePlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"factAside\") {\n return <FactBox>{domToReact(node.children as DOMNode[], opts)}</FactBox>;\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAaA,eAA2B,MAAM,SAAS;AACrD,KAAI,KAAK,QAAQ,iBAAiB,YAChC,QAAO,oBAAC,qBAAS,WAAW,KAAK,UAAuB,KAAK,GAAW;AAE1E,QAAO"}
|
|
@@ -3,6 +3,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { BlockQuote } from "@ndla/primitives";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/blockquotePlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2024-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const blockquotePlugin = (node, opts) => {
|
|
7
14
|
const { "data-variant": variant,...props } = attributesToProps(node.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(BlockQuote, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockquotePlugin.mjs","names":["blockquotePlugin: PluginType"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { BlockQuote } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <BlockQuote {...props} variant={variant === \"colored\" ? \"brand1\" : undefined}>\n {domToReact(node.children as DOMNode[], opts)}\n </BlockQuote>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"blockquotePlugin.mjs","names":["blockquotePlugin: PluginType"],"sources":["../../src/plugins/blockquotePlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { BlockQuote } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const blockquotePlugin: PluginType = (node, opts) => {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <BlockQuote {...props} variant={variant === \"colored\" ? \"brand1\" : undefined}>\n {domToReact(node.children as DOMNode[], opts)}\n </BlockQuote>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAaA,oBAAgC,MAAM,SAAS;CAC1D,MAAM,EAAE,gBAAgB,QAAS,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC7E,QACE,oBAAC;EAAW,GAAI;EAAO,SAAS,YAAY,YAAY,WAAW;YAChE,WAAW,KAAK,UAAuB,KAAK;GAClC"}
|
|
@@ -3,6 +3,13 @@ import { CopyParagraphButton } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/copyParagraphPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const copyParagraphPlugin = (node, converterOpts, opts) => {
|
|
7
14
|
const parent = node.parent;
|
|
8
15
|
if (parent?.name === "section" || parent?.name === "div" && Object.keys(parent.attribs ?? {}).length === 0 || parent?.name === "ndlaembed" && parent.attribs["data-resource"] === "uu-disclaimer") return /* @__PURE__ */ jsx(CopyParagraphButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyParagraphPlugin.mjs","names":["copyParagraphPlugin: PluginType"],"sources":["../../src/plugins/copyParagraphPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, Element, domToReact } from \"html-react-parser\";\nimport { CopyParagraphButton } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\nexport const copyParagraphPlugin: PluginType = (node, converterOpts, opts) => {\n const parent = node.parent as Element | undefined;\n if (\n parent?.name === \"section\" ||\n (parent?.name === \"div\" && Object.keys(parent.attribs ?? {}).length === 0) ||\n (parent?.name === \"ndlaembed\" && parent.attribs[\"data-resource\"] === \"uu-disclaimer\")\n ) {\n return (\n <CopyParagraphButton copyText={node.attribs[\"data-text\"]} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </CopyParagraphButton>\n );\n }\n return null;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyParagraphPlugin.mjs","names":["copyParagraphPlugin: PluginType"],"sources":["../../src/plugins/copyParagraphPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, Element, domToReact } from \"html-react-parser\";\nimport { CopyParagraphButton } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\nexport const copyParagraphPlugin: PluginType = (node, converterOpts, opts) => {\n const parent = node.parent as Element | undefined;\n if (\n parent?.name === \"section\" ||\n (parent?.name === \"div\" && Object.keys(parent.attribs ?? {}).length === 0) ||\n (parent?.name === \"ndlaembed\" && parent.attribs[\"data-resource\"] === \"uu-disclaimer\")\n ) {\n return (\n <CopyParagraphButton copyText={node.attribs[\"data-text\"]} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </CopyParagraphButton>\n );\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAaA,uBAAmC,MAAM,eAAe,SAAS;CAC5E,MAAM,SAAS,KAAK;AACpB,KACE,QAAQ,SAAS,aAChB,QAAQ,SAAS,SAAS,OAAO,KAAK,OAAO,WAAW,EAAE,CAAC,CAAC,WAAW,KACvE,QAAQ,SAAS,eAAe,OAAO,QAAQ,qBAAqB,gBAErE,QACE,oBAAC;EAAoB,UAAU,KAAK,QAAQ;EAAc,MAAM,KAAK;YAClE,WAAW,KAAK,UAAuB,cAAc;GAClC;AAG1B,QAAO"}
|
|
@@ -3,6 +3,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { ExpandableBox } from "@ndla/primitives";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/detailsPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2024-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const detailsPlugin = (node, converterOpts) => {
|
|
7
14
|
return /* @__PURE__ */ jsx(ExpandableBox, {
|
|
8
15
|
...attributesToProps(node.attribs),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detailsPlugin.mjs","names":["detailsPlugin: PluginType"],"sources":["../../src/plugins/detailsPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { ExpandableBox } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const detailsPlugin: PluginType = (node, converterOpts) => {\n const props = attributesToProps(node.attribs);\n\n return <ExpandableBox {...props}>{domToReact(node.children as DOMNode[], converterOpts)}</ExpandableBox>;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"detailsPlugin.mjs","names":["detailsPlugin: PluginType"],"sources":["../../src/plugins/detailsPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { ExpandableBox } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const detailsPlugin: PluginType = (node, converterOpts) => {\n const props = attributesToProps(node.attribs);\n\n return <ExpandableBox {...props}>{domToReact(node.children as DOMNode[], converterOpts)}</ExpandableBox>;\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAaA,iBAA6B,MAAM,kBAAkB;AAGhE,QAAO,oBAAC;EAAc,GAFR,kBAAkB,KAAK,QAAQ;YAEX,WAAW,KAAK,UAAuB,cAAc;GAAiB"}
|
package/es/plugins/divPlugin.mjs
CHANGED
|
@@ -4,6 +4,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import { FramedContent } from "@ndla/primitives";
|
|
5
5
|
|
|
6
6
|
//#region src/plugins/divPlugin.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) 2023-present, NDLA.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
7
14
|
const divPlugin = (node, opts) => {
|
|
8
15
|
if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
|
|
9
16
|
const { "data-variant": variant,...props } = attributesToProps(node.attribs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divPlugin.mjs","names":["divPlugin: PluginType"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport { FramedContent } from \"@ndla/primitives\";\nimport { FileListEmbed, RelatedArticleList, Grid, type GridType, GridParallaxItem } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <FramedContent colorTheme={variant === \"colored\" ? \"brand1\" : undefined} {...props}>\n {domToReact(node.children as DOMNode[], opts)}\n </FramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"divPlugin.mjs","names":["divPlugin: PluginType"],"sources":["../../src/plugins/divPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { domToReact, attributesToProps, Element, type DOMNode } from \"html-react-parser\";\nimport { FramedContent } from \"@ndla/primitives\";\nimport { FileListEmbed, RelatedArticleList, Grid, type GridType, GridParallaxItem } from \"@ndla/ui\";\nimport { type PluginType } from \"./types\";\n\nexport const divPlugin: PluginType = (node, opts) => {\n if (node.attribs[\"data-type\"] === \"framed-content\" || node.attribs.class === \"c-bodybox\") {\n const { \"data-variant\": variant, ...props } = attributesToProps(node.attribs);\n return (\n <FramedContent colorTheme={variant === \"colored\" ? \"brand1\" : undefined} {...props}>\n {domToReact(node.children as DOMNode[], opts)}\n </FramedContent>\n );\n }\n if (node.attribs[\"data-type\"] === \"related-content\" && node.children.length) {\n const props = attributesToProps(node.attribs);\n\n return (\n <RelatedArticleList {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </RelatedArticleList>\n );\n }\n if (node.attribs[\"data-type\"] === \"file\" && node.childNodes.length) {\n const elements = node.childNodes.filter(\n (c): c is Element => c.type === \"tag\" && c.name === \"ndlaembed\" && c.attribs[\"data-resource\"] === \"file\",\n );\n const [pdfs, files] = elements.reduce<[Element[], Element[]]>(\n (acc, el) => {\n const arr = el.attribs[\"data-type\"] === \"pdf\" && el.attribs[\"data-display\"] === \"block\" ? acc[0] : acc[1];\n arr.push(el);\n return acc;\n },\n [[], []],\n );\n\n return (\n <>\n {files.length ? <FileListEmbed>{domToReact(files, opts)}</FileListEmbed> : undefined}\n {domToReact(pdfs, opts)}\n </>\n );\n }\n if (node.attribs[\"data-type\"] === \"grid\" && node.children.length > 0) {\n const props = attributesToProps(node.attribs);\n const columns = props[\"data-columns\"] as GridType[\"columns\"];\n const border = props[\"data-border\"] as GridType[\"border\"];\n const background = props[\"data-background\"] as GridType[\"background\"];\n return (\n <Grid border={border} columns={columns} background={background} {...props}>\n {/* @ts-expect-error - This works, the types just won't match entirely */}\n {domToReact(node.children, opts)}\n </Grid>\n );\n }\n if (node.attribs[\"data-parallax-cell\"] === \"true\" && node.children.length) {\n return <GridParallaxItem>{domToReact(node.children as DOMNode[], opts)}</GridParallaxItem>;\n }\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAaA,aAAyB,MAAM,SAAS;AACnD,KAAI,KAAK,QAAQ,iBAAiB,oBAAoB,KAAK,QAAQ,UAAU,aAAa;EACxF,MAAM,EAAE,gBAAgB,QAAS,GAAG,UAAU,kBAAkB,KAAK,QAAQ;AAC7E,SACE,oBAAC;GAAc,YAAY,YAAY,YAAY,WAAW;GAAW,GAAI;aAC1E,WAAW,KAAK,UAAuB,KAAK;IAC/B;;AAGpB,KAAI,KAAK,QAAQ,iBAAiB,qBAAqB,KAAK,SAAS,OAGnE,QACE,oBAAC;EAAmB,GAHR,kBAAkB,KAAK,QAAQ;YAKxC,WAAW,KAAK,UAAU,KAAK;GACb;AAGzB,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,WAAW,QAAQ;EAIlE,MAAM,CAAC,MAAM,SAHI,KAAK,WAAW,QAC9B,MAAoB,EAAE,SAAS,SAAS,EAAE,SAAS,eAAe,EAAE,QAAQ,qBAAqB,OACnG,CAC8B,QAC5B,KAAK,OAAO;AAEX,IADY,GAAG,QAAQ,iBAAiB,SAAS,GAAG,QAAQ,oBAAoB,UAAU,IAAI,KAAK,IAAI,IACnG,KAAK,GAAG;AACZ,UAAO;KAET,CAAC,EAAE,EAAE,EAAE,CAAC,CACT;AAED,SACE,4CACG,MAAM,SAAS,oBAAC,2BAAe,WAAW,OAAO,KAAK,GAAiB,GAAG,QAC1E,WAAW,MAAM,KAAK,IACtB;;AAGP,KAAI,KAAK,QAAQ,iBAAiB,UAAU,KAAK,SAAS,SAAS,GAAG;EACpE,MAAM,QAAQ,kBAAkB,KAAK,QAAQ;EAC7C,MAAM,UAAU,MAAM;EACtB,MAAM,SAAS,MAAM;EACrB,MAAM,aAAa,MAAM;AACzB,SACE,oBAAC;GAAa;GAAiB;GAAqB;GAAY,GAAI;aAEjE,WAAW,KAAK,UAAU,KAAK;IAC3B;;AAGX,KAAI,KAAK,QAAQ,0BAA0B,UAAU,KAAK,SAAS,OACjE,QAAO,oBAAC,8BAAkB,WAAW,KAAK,UAAuB,KAAK,GAAoB;AAE5F,QAAO"}
|
package/es/plugins/dlPlugin.mjs
CHANGED
|
@@ -3,6 +3,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { DefinitionList } from "@ndla/primitives";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/dlPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const dlPlugin = (node, converterOpts, opts) => {
|
|
7
14
|
return /* @__PURE__ */ jsx(DefinitionList, {
|
|
8
15
|
...attributesToProps(node.attribs),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlPlugin.mjs","names":["dlPlugin: PluginType"],"sources":["../../src/plugins/dlPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { DefinitionList } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const dlPlugin: PluginType = (node, converterOpts, opts) => {\n const props = attributesToProps(node.attribs);\n\n return (\n <DefinitionList {...props} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </DefinitionList>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dlPlugin.mjs","names":["dlPlugin: PluginType"],"sources":["../../src/plugins/dlPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { DefinitionList } from \"@ndla/primitives\";\nimport { type PluginType } from \"./types\";\n\nexport const dlPlugin: PluginType = (node, converterOpts, opts) => {\n const props = attributesToProps(node.attribs);\n\n return (\n <DefinitionList {...props} lang={opts.articleLanguage}>\n {domToReact(node.children as DOMNode[], converterOpts)}\n </DefinitionList>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAaA,YAAwB,MAAM,eAAe,SAAS;AAGjE,QACE,oBAAC;EAAe,GAHJ,kBAAkB,KAAK,QAAQ;EAGhB,MAAM,KAAK;YACnC,WAAW,KAAK,UAAuB,cAAc;GACvC"}
|
|
@@ -3,6 +3,13 @@ import { KeyFigure } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/KeyFigureEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const keyFigureEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
const data = JSON.parse(props["data-json"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyFigureEmbedPlugin.mjs","names":["keyFigureEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/KeyFigureEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type KeyFigureMetaData } from \"@ndla/types-embed\";\nimport { KeyFigure } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const keyFigureEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as KeyFigureMetaData;\n const { title, subtitle, alt } = data.embedData;\n return (\n <KeyFigure\n title={title}\n subtitle={subtitle}\n image={\n data.status === \"success\" && data.data.metaImage\n ? {\n src: data.data.metaImage.image.imageUrl,\n alt: alt === undefined ? \"\" : alt,\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"KeyFigureEmbedPlugin.mjs","names":["keyFigureEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/KeyFigureEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type KeyFigureMetaData } from \"@ndla/types-embed\";\nimport { KeyFigure } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const keyFigureEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as KeyFigureMetaData;\n const { title, subtitle, alt } = data.embedData;\n return (\n <KeyFigure\n title={title}\n subtitle={subtitle}\n image={\n data.status === \"success\" && data.data.metaImage\n ? {\n src: data.data.metaImage.image.imageUrl,\n alt: alt === undefined ? \"\" : alt,\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,wBAAoC,YAAY;CAC3D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,EAAE,OAAO,UAAU,QAAQ,KAAK;AACtC,QACE,oBAAC;EACQ;EACG;EACV,OACE,KAAK,WAAW,aAAa,KAAK,KAAK,YACnC;GACE,KAAK,KAAK,KAAK,UAAU,MAAM;GAC/B,KAAK,QAAQ,SAAY,KAAK;GAC/B,GACD;GAEN"}
|
|
@@ -3,6 +3,13 @@ import { AudioEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/audioEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const audioEmbedPlugin = (element, _, opts) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(AudioEmbed, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audioEmbedPlugin.mjs","names":["audioEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/audioEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type AudioMetaData } from \"@ndla/types-embed\";\nimport { AudioEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const audioEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as AudioMetaData;\n return <AudioEmbed embed={data} lang={opts.articleLanguage} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"audioEmbedPlugin.mjs","names":["audioEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/audioEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type AudioMetaData } from \"@ndla/types-embed\";\nimport { AudioEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const audioEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as AudioMetaData;\n return <AudioEmbed embed={data} lang={opts.articleLanguage} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,oBAAgC,SAAS,GAAG,SAAS;CAChE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC;EAAW,OADN,KAAK,MAAM,MAAM,aAAuB;EACrB,MAAM,KAAK;GAAmB"}
|
|
@@ -3,6 +3,13 @@ import { BrightcoveEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/brightcoveEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const brightcoveEmbedPlugin = (element, _, opts) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(BrightcoveEmbed, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brightcoveEmbedPlugin.mjs","names":["brightcoveEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/brightcoveEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type BrightcoveMetaData } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const brightcoveEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as BrightcoveMetaData;\n return <BrightcoveEmbed embed={data} renderContext={opts.renderContext} lang={opts.articleLanguage} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"brightcoveEmbedPlugin.mjs","names":["brightcoveEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/brightcoveEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type BrightcoveMetaData } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const brightcoveEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as BrightcoveMetaData;\n return <BrightcoveEmbed embed={data} renderContext={opts.renderContext} lang={opts.articleLanguage} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,yBAAqC,SAAS,GAAG,SAAS;CACrE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC;EAAgB,OADX,KAAK,MAAM,MAAM,aAAuB;EAChB,eAAe,KAAK;EAAe,MAAM,KAAK;GAAmB"}
|
|
@@ -3,6 +3,13 @@ import { CampaignBlock } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/campaignBlockPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const campaignBlockPlugin = (element, _, opts) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
const data = JSON.parse(props["data-json"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaignBlockPlugin.mjs","names":["campaignBlockPlugin: PluginType"],"sources":["../../../src/plugins/embed/campaignBlockPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type CampaignBlockMetaData } from \"@ndla/types-embed\";\nimport { CampaignBlock } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const campaignBlockPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CampaignBlockMetaData;\n const embed = data.embedData;\n\n return (\n <CampaignBlock\n title={embed.title}\n description={embed.description}\n url={{ url: embed.url, text: embed.urlText }}\n path={opts.path}\n imageSide={embed.imageSide}\n image={\n data.status === \"success\" && data.data.image\n ? {\n src: data.data.image.image.imageUrl,\n alt: embed.alt === undefined ? \"\" : embed.alt,\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"campaignBlockPlugin.mjs","names":["campaignBlockPlugin: PluginType"],"sources":["../../../src/plugins/embed/campaignBlockPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type CampaignBlockMetaData } from \"@ndla/types-embed\";\nimport { CampaignBlock } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const campaignBlockPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CampaignBlockMetaData;\n const embed = data.embedData;\n\n return (\n <CampaignBlock\n title={embed.title}\n description={embed.description}\n url={{ url: embed.url, text: embed.urlText }}\n path={opts.path}\n imageSide={embed.imageSide}\n image={\n data.status === \"success\" && data.data.image\n ? {\n src: data.data.image.image.imageUrl,\n alt: embed.alt === undefined ? \"\" : embed.alt,\n }\n : undefined\n }\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,uBAAmC,SAAS,GAAG,SAAS;CACnE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,QAAQ,KAAK;AAEnB,QACE,oBAAC;EACC,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,KAAK;GAAE,KAAK,MAAM;GAAK,MAAM,MAAM;GAAS;EAC5C,MAAM,KAAK;EACX,WAAW,MAAM;EACjB,OACE,KAAK,WAAW,aAAa,KAAK,KAAK,QACnC;GACE,KAAK,KAAK,KAAK,MAAM,MAAM;GAC3B,KAAK,MAAM,QAAQ,SAAY,KAAK,MAAM;GAC3C,GACD;GAEN"}
|
|
@@ -3,6 +3,13 @@ import { CodeEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/codeEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const codeEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(CodeEmbed, { embed: JSON.parse(props["data-json"]) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeEmbedPlugin.mjs","names":["codeEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/codeEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type CodeMetaData } from \"@ndla/types-embed\";\nimport { CodeEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const codeEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CodeMetaData;\n return <CodeEmbed embed={data} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"codeEmbedPlugin.mjs","names":["codeEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/codeEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type CodeMetaData } from \"@ndla/types-embed\";\nimport { CodeEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const codeEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CodeMetaData;\n return <CodeEmbed embed={data} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,mBAA+B,YAAY;CACtD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC,aAAU,OADL,KAAK,MAAM,MAAM,aAAuB,GACpB"}
|
|
@@ -3,6 +3,13 @@ import { ConceptEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/conceptEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const conceptEmbedPlugin = (element, parserOpts, transformOpts) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(ConceptEmbed, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conceptEmbedPlugin.mjs","names":["conceptEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/conceptEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps, domToReact, type DOMNode } from \"html-react-parser\";\nimport { type ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const conceptEmbedPlugin: PluginType = (element, parserOpts, transformOpts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ConceptMetaData;\n return (\n <ConceptEmbed\n embed={data}\n lang={transformOpts.articleLanguage}\n renderContext={transformOpts.renderContext}\n previewAlt={transformOpts.previewAlt}\n >\n {domToReact(element.children as DOMNode[], parserOpts)}\n </ConceptEmbed>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"conceptEmbedPlugin.mjs","names":["conceptEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/conceptEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps, domToReact, type DOMNode } from \"html-react-parser\";\nimport { type ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const conceptEmbedPlugin: PluginType = (element, parserOpts, transformOpts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ConceptMetaData;\n return (\n <ConceptEmbed\n embed={data}\n lang={transformOpts.articleLanguage}\n renderContext={transformOpts.renderContext}\n previewAlt={transformOpts.previewAlt}\n >\n {domToReact(element.children as DOMNode[], parserOpts)}\n </ConceptEmbed>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,sBAAkC,SAAS,YAAY,kBAAkB;CACpF,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QACE,oBAAC;EACC,OAHS,KAAK,MAAM,MAAM,aAAuB;EAIjD,MAAM,cAAc;EACpB,eAAe,cAAc;EAC7B,YAAY,cAAc;YAEzB,WAAW,QAAQ,UAAuB,WAAW;GACzC"}
|
|
@@ -3,6 +3,13 @@ import { ContactBlock, contactBlockBackgrounds } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/contactBlockEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
function isBackground(background) {
|
|
7
14
|
return contactBlockBackgrounds.includes(background ?? "");
|
|
8
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactBlockEmbedPlugin.mjs","names":["contactBlockEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/contactBlockEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type ContactBlockMetaData } from \"@ndla/types-embed\";\nimport { ContactBlock, contactBlockBackgrounds, type ContactBlockBackground } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport function isBackground(background?: string): background is ContactBlockBackground {\n return (contactBlockBackgrounds as readonly string[]).includes(background ?? \"\");\n}\nconst parseBackground = (background: string | undefined): ContactBlockBackground | undefined => {\n if (isBackground(background)) return background;\n};\n\nexport const contactBlockEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const embedData = JSON.parse(props[\"data-json\"] as string) as ContactBlockMetaData;\n const { name, email, description, background, jobTitle, alt } = embedData.embedData;\n const parsedBackground = parseBackground(background);\n\n return (\n <ContactBlock\n image={embedData.status === \"success\" ? embedData.data.image : undefined}\n embedAlt={alt}\n description={description}\n email={email}\n jobTitle={jobTitle}\n name={name}\n lang={opts.articleLanguage}\n backgroundColor={parsedBackground}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"contactBlockEmbedPlugin.mjs","names":["contactBlockEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/contactBlockEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type ContactBlockMetaData } from \"@ndla/types-embed\";\nimport { ContactBlock, contactBlockBackgrounds, type ContactBlockBackground } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport function isBackground(background?: string): background is ContactBlockBackground {\n return (contactBlockBackgrounds as readonly string[]).includes(background ?? \"\");\n}\nconst parseBackground = (background: string | undefined): ContactBlockBackground | undefined => {\n if (isBackground(background)) return background;\n};\n\nexport const contactBlockEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const embedData = JSON.parse(props[\"data-json\"] as string) as ContactBlockMetaData;\n const { name, email, description, background, jobTitle, alt } = embedData.embedData;\n const parsedBackground = parseBackground(background);\n\n return (\n <ContactBlock\n image={embedData.status === \"success\" ? embedData.data.image : undefined}\n embedAlt={alt}\n description={description}\n email={email}\n jobTitle={jobTitle}\n name={name}\n lang={opts.articleLanguage}\n backgroundColor={parsedBackground}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,aAAa,YAA2D;AACtF,QAAQ,wBAA8C,SAAS,cAAc,GAAG;;AAElF,MAAM,mBAAmB,eAAuE;AAC9F,KAAI,aAAa,WAAW,CAAE,QAAO;;AAGvC,MAAaA,2BAAuC,SAAS,GAAG,SAAS;CACvE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,YAAY,KAAK,MAAM,MAAM,aAAuB;CAC1D,MAAM,EAAE,MAAM,OAAO,aAAa,YAAY,UAAU,QAAQ,UAAU;CAC1E,MAAM,mBAAmB,gBAAgB,WAAW;AAEpD,QACE,oBAAC;EACC,OAAO,UAAU,WAAW,YAAY,UAAU,KAAK,QAAQ;EAC/D,UAAU;EACG;EACN;EACG;EACJ;EACN,MAAM,KAAK;EACX,iBAAiB;GACjB"}
|
|
@@ -3,6 +3,13 @@ import { ContentLinkEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/contentLinkEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const contentLinkEmbedPlugin = (element, opts, { isOembed }) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(ContentLinkEmbed, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentLinkEmbedPlugin.mjs","names":["contentLinkEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/contentLinkEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type ContentLinkMetaData } from \"@ndla/types-embed\";\nimport { ContentLinkEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const contentLinkEmbedPlugin: PluginType = (element, opts, { isOembed }) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ContentLinkMetaData;\n return (\n <ContentLinkEmbed embed={data} isOembed={isOembed}>\n {domToReact(element.children as DOMNode[], opts)}\n </ContentLinkEmbed>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"contentLinkEmbedPlugin.mjs","names":["contentLinkEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/contentLinkEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type ContentLinkMetaData } from \"@ndla/types-embed\";\nimport { ContentLinkEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const contentLinkEmbedPlugin: PluginType = (element, opts, { isOembed }) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ContentLinkMetaData;\n return (\n <ContentLinkEmbed embed={data} isOembed={isOembed}>\n {domToReact(element.children as DOMNode[], opts)}\n </ContentLinkEmbed>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,0BAAsC,SAAS,MAAM,EAAE,eAAe;CACjF,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QACE,oBAAC;EAAiB,OAFP,KAAK,MAAM,MAAM,aAAuB;EAEV;YACtC,WAAW,QAAQ,UAAuB,KAAK;GAC/B"}
|
|
@@ -3,6 +3,13 @@ import { CopyrightEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/copyrightEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2024-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const copyrightEmbedPlugin = (element, opts) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(CopyrightEmbed, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyrightEmbedPlugin.mjs","names":["copyrightEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/copyrightEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type CopyrightMetaData } from \"@ndla/types-embed\";\nimport { CopyrightEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const copyrightEmbedPlugin: PluginType = (element, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CopyrightMetaData;\n return <CopyrightEmbed embed={data}>{domToReact(element.children as DOMNode[], opts)}</CopyrightEmbed>;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyrightEmbedPlugin.mjs","names":["copyrightEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/copyrightEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type DOMNode, attributesToProps, domToReact } from \"html-react-parser\";\nimport { type CopyrightMetaData } from \"@ndla/types-embed\";\nimport { CopyrightEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const copyrightEmbedPlugin: PluginType = (element, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as CopyrightMetaData;\n return <CopyrightEmbed embed={data}>{domToReact(element.children as DOMNode[], opts)}</CopyrightEmbed>;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,wBAAoC,SAAS,SAAS;CACjE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC;EAAe,OADV,KAAK,MAAM,MAAM,aAAuB;YAChB,WAAW,QAAQ,UAAuB,KAAK;GAAkB"}
|
|
@@ -3,6 +3,13 @@ import { ExternalEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/externalEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const externalEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(ExternalEmbed, { embed: JSON.parse(props["data-json"]) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalEmbedPlugin.mjs","names":["externalEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/externalEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type OembedMetaData } from \"@ndla/types-embed\";\nimport { ExternalEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const externalEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as OembedMetaData;\n return <ExternalEmbed embed={data} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"externalEmbedPlugin.mjs","names":["externalEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/externalEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type OembedMetaData } from \"@ndla/types-embed\";\nimport { ExternalEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const externalEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as OembedMetaData;\n return <ExternalEmbed embed={data} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,uBAAmC,YAAY;CAC1D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC,iBAAc,OADT,KAAK,MAAM,MAAM,aAAuB,GAChB"}
|
|
@@ -3,6 +3,13 @@ import { FileListElement, PdfFile } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/fileEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const fileEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
const data = JSON.parse(props["data-json"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileEmbedPlugin.mjs","names":["fileEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/fileEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type FileMetaData } from \"@ndla/types-embed\";\nimport { PdfFile, FileListElement } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const fileEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as FileMetaData;\n const { type, title, url, display } = data.embedData;\n if (type === \"pdf\" && display === \"block\") {\n return <PdfFile title={title} url={url} />;\n }\n return (\n <FileListElement\n url={url}\n title={title}\n fileExists={data.status === \"success\" ? !!data.data.exists : false}\n fileType={type}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fileEmbedPlugin.mjs","names":["fileEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/fileEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type FileMetaData } from \"@ndla/types-embed\";\nimport { PdfFile, FileListElement } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const fileEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as FileMetaData;\n const { type, title, url, display } = data.embedData;\n if (type === \"pdf\" && display === \"block\") {\n return <PdfFile title={title} url={url} />;\n }\n return (\n <FileListElement\n url={url}\n title={title}\n fileExists={data.status === \"success\" ? !!data.data.exists : false}\n fileType={type}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,mBAA+B,YAAY;CACtD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;CAChD,MAAM,OAAO,KAAK,MAAM,MAAM,aAAuB;CACrD,MAAM,EAAE,MAAM,OAAO,KAAK,YAAY,KAAK;AAC3C,KAAI,SAAS,SAAS,YAAY,QAChC,QAAO,oBAAC;EAAe;EAAY;GAAO;AAE5C,QACE,oBAAC;EACM;EACE;EACP,YAAY,KAAK,WAAW,YAAY,CAAC,CAAC,KAAK,KAAK,SAAS;EAC7D,UAAU;GACV"}
|
|
@@ -3,6 +3,13 @@ import { FootnoteEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/footnoteEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const footnoteEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(FootnoteEmbed, { embed: JSON.parse(props["data-json"]) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footnoteEmbedPlugin.mjs","names":["footnoteEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/footnoteEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type FootnoteMetaData } from \"@ndla/types-embed\";\nimport { FootnoteEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const footnoteEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as FootnoteMetaData;\n return <FootnoteEmbed embed={data} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"footnoteEmbedPlugin.mjs","names":["footnoteEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/footnoteEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type FootnoteMetaData } from \"@ndla/types-embed\";\nimport { FootnoteEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const footnoteEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as FootnoteMetaData;\n return <FootnoteEmbed embed={data} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,uBAAmC,YAAY;CAC1D,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC,iBAAc,OADT,KAAK,MAAM,MAAM,aAAuB,GAChB"}
|
|
@@ -3,6 +3,13 @@ import { H5pEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/h5pEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const h5pEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(H5pEmbed, { embed: JSON.parse(props["data-json"]) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h5pEmbedPlugin.mjs","names":["h5pEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/h5pEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type H5pMetaData } from \"@ndla/types-embed\";\nimport { H5pEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const h5pEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as H5pMetaData;\n return <H5pEmbed embed={data} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"h5pEmbedPlugin.mjs","names":["h5pEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/h5pEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type H5pMetaData } from \"@ndla/types-embed\";\nimport { H5pEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const h5pEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as H5pMetaData;\n return <H5pEmbed embed={data} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,kBAA8B,YAAY;CACrD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC,YAAS,OADJ,KAAK,MAAM,MAAM,aAAuB,GACrB"}
|
|
@@ -3,6 +3,13 @@ import { IframeEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/iframeEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const iframeEmbedPlugin = (element) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(IframeEmbed, { embed: JSON.parse(props["data-json"]) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframeEmbedPlugin.mjs","names":["iframeEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/iframeEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type IframeMetaData } from \"@ndla/types-embed\";\nimport { IframeEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const iframeEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as IframeMetaData;\n return <IframeEmbed embed={data} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"iframeEmbedPlugin.mjs","names":["iframeEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/iframeEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type IframeMetaData } from \"@ndla/types-embed\";\nimport { IframeEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const iframeEmbedPlugin: PluginType = (element) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as IframeMetaData;\n return <IframeEmbed embed={data} />;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,qBAAiC,YAAY;CACxD,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAEhD,QAAO,oBAAC,eAAY,OADP,KAAK,MAAM,MAAM,aAAuB,GAClB"}
|
|
@@ -3,6 +3,13 @@ import { ImageEmbed } from "@ndla/ui";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/embed/imageEmbedPlugin.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Copyright (c) 2023-present, NDLA.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
6
13
|
const imageEmbedPlugin = (element, _, opts) => {
|
|
7
14
|
const props = attributesToProps(element.attribs);
|
|
8
15
|
return /* @__PURE__ */ jsx(ImageEmbed, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageEmbedPlugin.mjs","names":["imageEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/imageEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type ImageMetaData } from \"@ndla/types-embed\";\nimport { ImageEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const imageEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ImageMetaData;\n\n return (\n <ImageEmbed\n embed={data}\n previewAlt={opts.previewAlt}\n lang={opts.articleLanguage}\n renderContext={opts.renderContext}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"imageEmbedPlugin.mjs","names":["imageEmbedPlugin: PluginType"],"sources":["../../../src/plugins/embed/imageEmbedPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { attributesToProps } from \"html-react-parser\";\nimport { type ImageMetaData } from \"@ndla/types-embed\";\nimport { ImageEmbed } from \"@ndla/ui\";\nimport { type PluginType } from \"../types\";\n\nexport const imageEmbedPlugin: PluginType = (element, _, opts) => {\n const props = attributesToProps(element.attribs);\n const data = JSON.parse(props[\"data-json\"] as string) as ImageMetaData;\n\n return (\n <ImageEmbed\n embed={data}\n previewAlt={opts.previewAlt}\n lang={opts.articleLanguage}\n renderContext={opts.renderContext}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAaA,oBAAgC,SAAS,GAAG,SAAS;CAChE,MAAM,QAAQ,kBAAkB,QAAQ,QAAQ;AAGhD,QACE,oBAAC;EACC,OAJS,KAAK,MAAM,MAAM,aAAuB;EAKjD,YAAY,KAAK;EACjB,MAAM,KAAK;EACX,eAAe,KAAK;GACpB"}
|
|
@@ -20,6 +20,13 @@ import { symbolEmbedPlugin } from "./symbolEmbedPlugin.mjs";
|
|
|
20
20
|
import { uuDisclaimerEmbedPlugin } from "./uuDisclaimerEmbedPlugin.mjs";
|
|
21
21
|
|
|
22
22
|
//#region src/plugins/embed/index.ts
|
|
23
|
+
/**
|
|
24
|
+
* Copyright (c) 2023-present, NDLA.
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
23
30
|
const embedPlugins = {
|
|
24
31
|
image: imageEmbedPlugin,
|
|
25
32
|
audio: audioEmbedPlugin,
|