@ndla/article-converter 6.0.41 → 6.0.43

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.
Files changed (147) hide show
  1. package/es/extractEmbedMeta.js +8 -8
  2. package/es/index.js +2 -2
  3. package/es/plugins/anchorPlugin.js +3 -3
  4. package/es/plugins/asidePlugin.js +4 -4
  5. package/es/plugins/copyParagraphPlugin.js +4 -4
  6. package/es/plugins/ddPlugin.js +2 -2
  7. package/es/plugins/divPlugin.js +14 -14
  8. package/es/plugins/dtPlugin.js +2 -2
  9. package/es/plugins/embed/KeyFigureEmbedPlugin.js +5 -5
  10. package/es/plugins/embed/audioEmbedPlugin.js +3 -3
  11. package/es/plugins/embed/blogPostEmbedPlugin.js +5 -5
  12. package/es/plugins/embed/brightcoveEmbedPlugin.js +3 -3
  13. package/es/plugins/embed/campaignBlockPlugin.js +5 -5
  14. package/es/plugins/embed/codeEmbedPlugin.js +3 -3
  15. package/es/plugins/embed/conceptEmbedPlugin.js +3 -3
  16. package/es/plugins/embed/conceptListEmbedPlugin.js +3 -3
  17. package/es/plugins/embed/contactBlockEmbedPlugin.js +4 -4
  18. package/es/plugins/embed/contentLinkEmbedPlugin.js +3 -3
  19. package/es/plugins/embed/externalEmbedPlugin.js +3 -3
  20. package/es/plugins/embed/fileEmbedPlugin.js +5 -5
  21. package/es/plugins/embed/footnoteEmbedPlugin.js +3 -3
  22. package/es/plugins/embed/h5pEmbedPlugin.js +3 -3
  23. package/es/plugins/embed/iframeEmbedPlugin.js +3 -3
  24. package/es/plugins/embed/imageEmbedPlugin.js +4 -4
  25. package/es/plugins/embed/index.js +27 -27
  26. package/es/plugins/embed/linkBlockEmbedPlugin.js +3 -3
  27. package/es/plugins/embed/relatedContentEmbedPlugin.js +3 -3
  28. package/es/plugins/h3Plugin.js +1 -1
  29. package/es/plugins/index.js +15 -15
  30. package/es/plugins/mathPlugin.js +2 -2
  31. package/es/plugins/navPlugin.js +3 -3
  32. package/es/plugins/oembed/anchorPlugin.js +3 -3
  33. package/es/plugins/olPlugin.js +5 -5
  34. package/es/plugins/paragraphPlugin.js +3 -3
  35. package/es/plugins/spanPlugin.js +3 -3
  36. package/es/plugins/tablePlugin.js +2 -2
  37. package/es/plugins/ulPlugin.js +3 -3
  38. package/es/transform.js +9 -9
  39. package/lib/extractEmbedMeta.d.ts +1 -1
  40. package/lib/extractEmbedMeta.js +7 -7
  41. package/lib/index.d.ts +3 -3
  42. package/lib/plugins/anchorPlugin.d.ts +1 -1
  43. package/lib/plugins/asidePlugin.d.ts +1 -1
  44. package/lib/plugins/asidePlugin.js +2 -2
  45. package/lib/plugins/copyParagraphPlugin.d.ts +1 -1
  46. package/lib/plugins/copyParagraphPlugin.js +2 -2
  47. package/lib/plugins/ddPlugin.d.ts +1 -1
  48. package/lib/plugins/divPlugin.d.ts +1 -1
  49. package/lib/plugins/divPlugin.js +11 -11
  50. package/lib/plugins/dtPlugin.d.ts +1 -1
  51. package/lib/plugins/embed/KeyFigureEmbedPlugin.d.ts +1 -1
  52. package/lib/plugins/embed/KeyFigureEmbedPlugin.js +3 -3
  53. package/lib/plugins/embed/audioEmbedPlugin.d.ts +1 -1
  54. package/lib/plugins/embed/audioEmbedPlugin.js +1 -1
  55. package/lib/plugins/embed/blogPostEmbedPlugin.d.ts +1 -1
  56. package/lib/plugins/embed/blogPostEmbedPlugin.js +3 -3
  57. package/lib/plugins/embed/brightcoveEmbedPlugin.d.ts +1 -1
  58. package/lib/plugins/embed/brightcoveEmbedPlugin.js +1 -1
  59. package/lib/plugins/embed/campaignBlockPlugin.d.ts +1 -1
  60. package/lib/plugins/embed/campaignBlockPlugin.js +3 -3
  61. package/lib/plugins/embed/codeEmbedPlugin.d.ts +1 -1
  62. package/lib/plugins/embed/codeEmbedPlugin.js +1 -1
  63. package/lib/plugins/embed/conceptEmbedPlugin.d.ts +1 -1
  64. package/lib/plugins/embed/conceptEmbedPlugin.js +1 -1
  65. package/lib/plugins/embed/conceptListEmbedPlugin.d.ts +1 -1
  66. package/lib/plugins/embed/conceptListEmbedPlugin.js +1 -1
  67. package/lib/plugins/embed/contactBlockEmbedPlugin.d.ts +1 -1
  68. package/lib/plugins/embed/contactBlockEmbedPlugin.js +2 -2
  69. package/lib/plugins/embed/contentLinkEmbedPlugin.d.ts +1 -1
  70. package/lib/plugins/embed/contentLinkEmbedPlugin.js +1 -1
  71. package/lib/plugins/embed/externalEmbedPlugin.d.ts +1 -1
  72. package/lib/plugins/embed/externalEmbedPlugin.js +1 -1
  73. package/lib/plugins/embed/fileEmbedPlugin.d.ts +1 -1
  74. package/lib/plugins/embed/fileEmbedPlugin.js +3 -3
  75. package/lib/plugins/embed/footnoteEmbedPlugin.d.ts +1 -1
  76. package/lib/plugins/embed/footnoteEmbedPlugin.js +1 -1
  77. package/lib/plugins/embed/h5pEmbedPlugin.d.ts +1 -1
  78. package/lib/plugins/embed/h5pEmbedPlugin.js +1 -1
  79. package/lib/plugins/embed/iframeEmbedPlugin.d.ts +1 -1
  80. package/lib/plugins/embed/iframeEmbedPlugin.js +1 -1
  81. package/lib/plugins/embed/imageEmbedPlugin.d.ts +1 -1
  82. package/lib/plugins/embed/imageEmbedPlugin.js +2 -2
  83. package/lib/plugins/embed/index.d.ts +1 -1
  84. package/lib/plugins/embed/index.js +9 -9
  85. package/lib/plugins/embed/linkBlockEmbedPlugin.d.ts +1 -1
  86. package/lib/plugins/embed/linkBlockEmbedPlugin.js +1 -1
  87. package/lib/plugins/embed/relatedContentEmbedPlugin.d.ts +1 -1
  88. package/lib/plugins/embed/relatedContentEmbedPlugin.js +1 -1
  89. package/lib/plugins/h3Plugin.d.ts +1 -1
  90. package/lib/plugins/index.d.ts +1 -1
  91. package/lib/plugins/mathPlugin.d.ts +1 -1
  92. package/lib/plugins/mathPlugin.js +1 -1
  93. package/lib/plugins/navPlugin.d.ts +1 -1
  94. package/lib/plugins/navPlugin.js +1 -1
  95. package/lib/plugins/oembed/anchorPlugin.d.ts +1 -1
  96. package/lib/plugins/olPlugin.d.ts +1 -1
  97. package/lib/plugins/olPlugin.js +3 -3
  98. package/lib/plugins/paragraphPlugin.d.ts +1 -1
  99. package/lib/plugins/paragraphPlugin.js +2 -2
  100. package/lib/plugins/spanPlugin.d.ts +1 -1
  101. package/lib/plugins/spanPlugin.js +2 -2
  102. package/lib/plugins/tablePlugin.d.ts +1 -1
  103. package/lib/plugins/types.d.ts +2 -2
  104. package/lib/plugins/ulPlugin.d.ts +1 -1
  105. package/lib/plugins/ulPlugin.js +1 -1
  106. package/lib/transform.d.ts +1 -1
  107. package/lib/transform.js +5 -5
  108. package/package.json +5 -5
  109. package/src/extractEmbedMeta.ts +9 -9
  110. package/src/index.ts +3 -3
  111. package/src/plugins/anchorPlugin.tsx +4 -4
  112. package/src/plugins/asidePlugin.tsx +5 -5
  113. package/src/plugins/copyParagraphPlugin.tsx +5 -5
  114. package/src/plugins/ddPlugin.tsx +3 -3
  115. package/src/plugins/divPlugin.tsx +15 -15
  116. package/src/plugins/dtPlugin.tsx +3 -3
  117. package/src/plugins/embed/KeyFigureEmbedPlugin.tsx +7 -7
  118. package/src/plugins/embed/audioEmbedPlugin.tsx +5 -5
  119. package/src/plugins/embed/blogPostEmbedPlugin.tsx +7 -7
  120. package/src/plugins/embed/brightcoveEmbedPlugin.tsx +5 -5
  121. package/src/plugins/embed/campaignBlockPlugin.tsx +11 -8
  122. package/src/plugins/embed/codeEmbedPlugin.tsx +5 -5
  123. package/src/plugins/embed/conceptEmbedPlugin.tsx +5 -5
  124. package/src/plugins/embed/conceptListEmbedPlugin.tsx +5 -5
  125. package/src/plugins/embed/contactBlockEmbedPlugin.tsx +6 -6
  126. package/src/plugins/embed/contentLinkEmbedPlugin.tsx +5 -5
  127. package/src/plugins/embed/externalEmbedPlugin.tsx +5 -5
  128. package/src/plugins/embed/fileEmbedPlugin.tsx +7 -7
  129. package/src/plugins/embed/footnoteEmbedPlugin.tsx +5 -5
  130. package/src/plugins/embed/h5pEmbedPlugin.tsx +5 -5
  131. package/src/plugins/embed/iframeEmbedPlugin.tsx +5 -5
  132. package/src/plugins/embed/imageEmbedPlugin.tsx +6 -6
  133. package/src/plugins/embed/index.ts +28 -28
  134. package/src/plugins/embed/linkBlockEmbedPlugin.tsx +5 -5
  135. package/src/plugins/embed/relatedContentEmbedPlugin.tsx +5 -5
  136. package/src/plugins/h3Plugin.tsx +2 -2
  137. package/src/plugins/index.ts +16 -16
  138. package/src/plugins/mathPlugin.tsx +3 -3
  139. package/src/plugins/navPlugin.tsx +4 -4
  140. package/src/plugins/oembed/anchorPlugin.tsx +4 -4
  141. package/src/plugins/olPlugin.tsx +6 -6
  142. package/src/plugins/paragraphPlugin.tsx +4 -4
  143. package/src/plugins/spanPlugin.tsx +4 -4
  144. package/src/plugins/tablePlugin.tsx +3 -3
  145. package/src/plugins/types.ts +2 -2
  146. package/src/plugins/ulPlugin.tsx +5 -5
  147. package/src/transform.tsx +11 -11
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
11
  export const h3Plugin = (node, converterOpts, opts) => {
12
12
  const props = attributesToProps(node.attribs);
@@ -6,21 +6,21 @@
6
6
  *
7
7
  */
8
8
 
9
- import { anchorPlugin } from './anchorPlugin';
10
- import { asidePlugin } from './asidePlugin';
11
- import { copyParagraphPlugin } from './copyParagraphPlugin';
12
- import { ddPlugin } from './ddPlugin';
13
- import { divPlugin } from './divPlugin';
14
- import { dtPlugin } from './dtPlugin';
15
- import { h3Plugin } from './h3Plugin';
16
- import { mathPlugin } from './mathPlugin';
17
- import { navPlugin } from './navPlugin';
18
- import { anchorPlugin as oembedAnchorPlugin } from './oembed/anchorPlugin';
19
- import { olPlugin } from './olPlugin';
20
- import { paragraphPlugin } from './paragraphPlugin';
21
- import { spanPlugin } from './spanPlugin';
22
- import { tablePlugin } from './tablePlugin';
23
- import { ulPlugin } from './ulPlugin';
9
+ import { anchorPlugin } from "./anchorPlugin";
10
+ import { asidePlugin } from "./asidePlugin";
11
+ import { copyParagraphPlugin } from "./copyParagraphPlugin";
12
+ import { ddPlugin } from "./ddPlugin";
13
+ import { divPlugin } from "./divPlugin";
14
+ import { dtPlugin } from "./dtPlugin";
15
+ import { h3Plugin } from "./h3Plugin";
16
+ import { mathPlugin } from "./mathPlugin";
17
+ import { navPlugin } from "./navPlugin";
18
+ import { anchorPlugin as oembedAnchorPlugin } from "./oembed/anchorPlugin";
19
+ import { olPlugin } from "./olPlugin";
20
+ import { paragraphPlugin } from "./paragraphPlugin";
21
+ import { spanPlugin } from "./spanPlugin";
22
+ import { tablePlugin } from "./tablePlugin";
23
+ import { ulPlugin } from "./ulPlugin";
24
24
  export const basePlugins = {
25
25
  h2: copyParagraphPlugin,
26
26
  h3: h3Plugin,
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps } from 'html-react-parser';
9
+ import { attributesToProps } from "html-react-parser";
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
11
  export const mathPlugin = node => {
12
12
  const {
13
- 'data-math': mathContent,
13
+ "data-math": mathContent,
14
14
  ...props
15
15
  } = attributesToProps(node.attribs);
16
16
  // @ts-ignore
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { LinkBlockSection } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { LinkBlockSection } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const navPlugin = (node, opts) => {
13
- if (node.attribs['data-type'] === 'link-block-list') {
13
+ if (node.attribs["data-type"] === "link-block-list") {
14
14
  const props = attributesToProps(node.attribs);
15
15
  return _jsx(LinkBlockSection, {
16
16
  ...props,
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import SafeLink from '@ndla/safelink';
11
- import { getPossiblyRelativeUrl } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import SafeLink from "@ndla/safelink";
11
+ import { getPossiblyRelativeUrl } from "@ndla/ui";
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  export const anchorPlugin = (node, options, _ref) => {
14
14
  let {
@@ -6,15 +6,15 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { OrderedList } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { OrderedList } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const olPlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
14
- const letterClass = node.attribs['data-type'] === 'letters' ? 'ol-list--roman' : false;
15
- const num = node.attribs['start'];
14
+ const letterClass = node.attribs["data-type"] === "letters" ? "ol-list--roman" : false;
15
+ const num = node.attribs["start"];
16
16
  const numClass = num ? `ol-reset-${num}` : false;
17
- const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(' ');
17
+ const classes = [node.attribs.class ?? false, letterClass, numClass].filter(c => !!c).join(" ");
18
18
  return _jsx(OrderedList, {
19
19
  ...props,
20
20
  className: classes.length ? classes : undefined,
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
11
  export const paragraphPlugin = (node, converterOpts, opts) => {
12
12
  const props = attributesToProps(node.attribs);
13
- if (node.attribs['data-align'] === 'center') {
14
- const classes = [node.attribs.class ?? '', 'u-text-center'].filter(c => !!c).join(' ');
13
+ if (node.attribs["data-align"] === "center") {
14
+ const classes = [node.attribs.class ?? "", "u-text-center"].filter(c => !!c).join(" ");
15
15
  return _jsx("p", {
16
16
  ...props,
17
17
  lang: opts.articleLanguage,
@@ -6,15 +6,15 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
10
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
11
  export const spanPlugin = (node, opts) => {
12
- if (node.attribs['data-size'] === 'large') {
12
+ if (node.attribs["data-size"] === "large") {
13
13
  const props = attributesToProps(node.attribs);
14
14
  return _jsx("span", {
15
15
  ...props,
16
16
  "data-size": undefined,
17
- className: `${node.attribs.class ?? ''} u-large-body-text`,
17
+ className: `${node.attribs.class ?? ""} u-large-body-text`,
18
18
  children: domToReact(node.children, opts)
19
19
  });
20
20
  }
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { Table } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { Table } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const tablePlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { attributesToProps, domToReact } from 'html-react-parser';
10
- import { UnOrderedList } from '@ndla/ui';
9
+ import { attributesToProps, domToReact } from "html-react-parser";
10
+ import { UnOrderedList } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const ulPlugin = (node, converterOpts, opts) => {
13
13
  const props = attributesToProps(node.attribs);
14
- const classes = [node.attribs.class ?? '', node.attribs['data-type'] === 'two-column' ? 'o-list--two-columns' : ''].filter(c => !!c).join(' ');
14
+ const classes = [node.attribs.class ?? "", node.attribs["data-type"] === "two-column" ? "o-list--two-columns" : ""].filter(c => !!c).join(" ");
15
15
  return _jsx(UnOrderedList, {
16
16
  ...props,
17
17
  className: classes,
package/es/transform.js CHANGED
@@ -6,26 +6,26 @@
6
6
  *
7
7
  */
8
8
 
9
- import parse from 'html-react-parser';
10
- import { UnknownEmbed } from '@ndla/ui';
11
- import { basePlugins, oembedPlugins } from './plugins';
12
- import { embedPlugins } from './plugins/embed';
9
+ import parse from "html-react-parser";
10
+ import { UnknownEmbed } from "@ndla/ui";
11
+ import { basePlugins, oembedPlugins } from "./plugins";
12
+ import { embedPlugins } from "./plugins/embed";
13
13
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
14
14
  const transform = (content, opts) => {
15
15
  const plugins = opts?.isOembed ? oembedPlugins : basePlugins;
16
16
  const options = {
17
17
  replace: node => {
18
- if (!('attribs' in node)) {
18
+ if (!("attribs" in node)) {
19
19
  return;
20
20
  }
21
21
  if (plugins[node.name]) {
22
22
  return plugins[node.name](node, options, opts);
23
23
  }
24
- if (node.name === 'ndlaembed') {
25
- if (embedPlugins[node.attribs['data-resource']]) {
26
- return embedPlugins[node.attribs['data-resource']](node, options, opts);
24
+ if (node.name === "ndlaembed") {
25
+ if (embedPlugins[node.attribs["data-resource"]]) {
26
+ return embedPlugins[node.attribs["data-resource"]](node, options, opts);
27
27
  } else {
28
- const embed = JSON.parse(node.attribs['data-json']);
28
+ const embed = JSON.parse(node.attribs["data-json"]);
29
29
  return _jsx(UnknownEmbed, {
30
30
  embed: embed
31
31
  });
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { EmbedMetaData } from '@ndla/types-embed';
8
+ import { EmbedMetaData } from "@ndla/types-embed";
9
9
  declare const extractEmbedMeta: (embed: string) => EmbedMetaData | undefined;
10
10
  export declare const extractEmbedMetas: (embed: string) => EmbedMetaData[];
11
11
  export default extractEmbedMeta;
@@ -16,25 +16,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
16
16
 
17
17
  const extractEmbedMeta = embed => {
18
18
  const node = (0, _htmlReactParser.default)(embed);
19
- if (typeof node === 'string' || Array.isArray(node) || node.type !== 'ndlaembed' || !node.props['data-json']) {
19
+ if (typeof node === "string" || Array.isArray(node) || node.type !== "ndlaembed" || !node.props["data-json"]) {
20
20
  return;
21
21
  }
22
- return JSON.parse(node.props['data-json']);
22
+ return JSON.parse(node.props["data-json"]);
23
23
  };
24
24
  const extractEmbedMetas = embed => {
25
25
  const nodes = (0, _htmlReactParser.default)(embed);
26
26
 
27
27
  // There are no embeds in the string
28
- if (typeof nodes === 'string') {
28
+ if (typeof nodes === "string") {
29
29
  return [];
30
30
  }
31
31
  // There is only one embed in the string
32
- else if (!Array.isArray(nodes) && nodes.type === 'ndlaembed' && !!nodes.props['data-json']) {
33
- return [JSON.parse(nodes.props['data-json'])];
32
+ else if (!Array.isArray(nodes) && nodes.type === "ndlaembed" && !!nodes.props["data-json"]) {
33
+ return [JSON.parse(nodes.props["data-json"])];
34
34
  }
35
35
  // There are multiple embeds in the string
36
- else if (Array.isArray(nodes) && nodes.length && nodes.every(n => n.type === 'ndlaembed' && !!n.props['data-json'])) {
37
- return nodes.map(n => JSON.parse(n.props['data-json']));
36
+ else if (Array.isArray(nodes) && nodes.length && nodes.every(n => n.type === "ndlaembed" && !!n.props["data-json"])) {
37
+ return nodes.map(n => JSON.parse(n.props["data-json"]));
38
38
  } else {
39
39
  return [];
40
40
  }
package/lib/index.d.ts CHANGED
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export { default as transform } from './transform';
9
- export { default as extractEmbedMeta, extractEmbedMetas } from './extractEmbedMeta';
10
- export type { TransformOptions, DynamicComponents } from './plugins/types';
8
+ export { default as transform } from "./transform";
9
+ export { default as extractEmbedMeta, extractEmbedMetas } from "./extractEmbedMeta";
10
+ export type { TransformOptions, DynamicComponents } from "./plugins/types";
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const anchorPlugin: PluginType;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const asidePlugin: PluginType;
@@ -16,11 +16,11 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  const asidePlugin = (node, opts) => {
19
- if (node.attribs['data-type'] === 'factAside') {
19
+ if (node.attribs["data-type"] === "factAside") {
20
20
  return (0, _jsxRuntime.jsx)(_ui.FactBox, {
21
21
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
22
22
  });
23
- } else if (node.attribs['data-type'] === 'rightAside') {
23
+ } else if (node.attribs["data-type"] === "rightAside") {
24
24
  return (0, _jsxRuntime.jsx)(_ui.Aside, {
25
25
  wideScreen: true,
26
26
  alwaysShow: true,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const copyParagraphPlugin: PluginType;
@@ -17,9 +17,9 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const copyParagraphPlugin = (node, converterOpts, opts) => {
19
19
  const parent = node.parent;
20
- if (parent?.name === 'section' || parent?.name === 'div' && Object.keys(parent.attribs ?? {}).length === 0) {
20
+ if (parent?.name === "section" || parent?.name === "div" && Object.keys(parent.attribs ?? {}).length === 0) {
21
21
  return (0, _jsxRuntime.jsx)(_ui.CopyParagraphButton, {
22
- copyText: node.attribs['data-text'],
22
+ copyText: node.attribs["data-text"],
23
23
  lang: opts.articleLanguage,
24
24
  children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
25
25
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const ddPlugin: PluginType;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const divPlugin: PluginType;
@@ -18,32 +18,32 @@ 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') {
21
+ if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
22
22
  return (0, _jsxRuntime.jsx)(_ui.FramedContent, {
23
23
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
24
24
  });
25
25
  }
26
- if (node.attribs['data-type'] === 'related-content' && node.children.length) {
26
+ if (node.attribs["data-type"] === "related-content" && node.children.length) {
27
27
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
28
28
  return (0, _jsxRuntime.jsx)(_ui.RelatedArticleList, {
29
29
  ...props,
30
30
  headingLevel: "h3",
31
31
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
32
32
  });
33
- } else if (node.attribs['data-type'] === 'file' && node.childNodes.length) {
34
- const elements = node.childNodes.filter(c => c.type === 'tag' && c.name === 'ndlaembed' && c.attribs['data-resource'] === 'file');
35
- const [pdfs, files] = (0, _partition.default)(elements, el => el.attribs['data-type'] === 'pdf' && el.attribs['data-display'] === 'block');
33
+ } else if (node.attribs["data-type"] === "file" && node.childNodes.length) {
34
+ const elements = node.childNodes.filter(c => c.type === "tag" && c.name === "ndlaembed" && c.attribs["data-resource"] === "file");
35
+ const [pdfs, files] = (0, _partition.default)(elements, el => el.attribs["data-type"] === "pdf" && el.attribs["data-display"] === "block");
36
36
  return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
37
37
  children: [files.length ? (0, _jsxRuntime.jsx)(_ui.FileList, {
38
38
  children: (0, _htmlReactParser.domToReact)(files, opts)
39
39
  }) : undefined, (0, _htmlReactParser.domToReact)(pdfs, opts)]
40
40
  });
41
- } else if (node.attribs['data-type'] === 'grid' && node.children.length > 0) {
41
+ } else if (node.attribs["data-type"] === "grid" && node.children.length > 0) {
42
42
  const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
43
- const columns = props['data-columns'];
44
- const border = props['data-border'];
45
- const background = props['data-background'];
46
- const frontpage = !!props['data-size'];
43
+ const columns = props["data-columns"];
44
+ const border = props["data-border"];
45
+ const background = props["data-background"];
46
+ const frontpage = !!props["data-size"];
47
47
  return (0, _jsxRuntime.jsx)(_ui.Grid, {
48
48
  isFrontpage: frontpage,
49
49
  border: border,
@@ -52,7 +52,7 @@ const divPlugin = (node, opts) => {
52
52
  ...props,
53
53
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
54
54
  });
55
- } else if (node.attribs['data-parallax-cell'] === 'true' && node.children.length) {
55
+ } else if (node.attribs["data-parallax-cell"] === "true" && node.children.length) {
56
56
  return (0, _jsxRuntime.jsx)(_ui.GridParallaxItem, {
57
57
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
58
58
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from './types';
8
+ import { PluginType } from "./types";
9
9
  export declare const dtPlugin: PluginType;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const keyFigureEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const keyFigureEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  const {
22
22
  title,
23
23
  subtitle,
@@ -26,9 +26,9 @@ const keyFigureEmbedPlugin = (element, _, opts) => {
26
26
  return (0, _jsxRuntime.jsx)(_ui.KeyFigure, {
27
27
  title: title,
28
28
  subtitle: subtitle,
29
- image: data.status === 'success' && data.data.metaImage ? {
29
+ image: data.status === "success" && data.data.metaImage ? {
30
30
  src: data.data.metaImage.image.imageUrl,
31
- alt: alt === undefined ? '' : alt
31
+ alt: alt === undefined ? "" : alt
32
32
  } : undefined,
33
33
  lang: opts.articleLanguage
34
34
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const audioEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const audioEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.AudioEmbed, {
22
22
  embed: data,
23
23
  heartButton: opts.components?.heartButton,
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const errorSvgSrc = "data:image/svg+xml;charset=UTF-8,%3Csvg fill='%238A8888' height='400' viewBox='0 0 24 12' width='100%25' xmlns='http://www.w3.org/2000/svg' style='background-color: %23EFF0F2'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath transform='scale(0.3) translate(28, 8.5)' d='M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3E%3C/svg%3E";
10
10
  export declare const blogPostEmbedPlugin: PluginType;
@@ -18,7 +18,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
18
  const errorSvgSrc = exports.errorSvgSrc = `data:image/svg+xml;charset=UTF-8,%3Csvg fill='%238A8888' height='400' viewBox='0 0 24 12' width='100%25' xmlns='http://www.w3.org/2000/svg' style='background-color: %23EFF0F2'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath transform='scale(0.3) translate(28, 8.5)' d='M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3E%3C/svg%3E`;
19
19
  const blogPostEmbedPlugin = (element, _, opts) => {
20
20
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
21
- const data = JSON.parse(props['data-json']);
21
+ const data = JSON.parse(props["data-json"]);
22
22
  const {
23
23
  title,
24
24
  author,
@@ -37,8 +37,8 @@ const blogPostEmbedPlugin = (element, _, opts) => {
37
37
  size: size,
38
38
  path: opts.path,
39
39
  metaImage: {
40
- alt: alt ? alt : '',
41
- url: data.status === 'success' ? data.data.metaImage?.image.imageUrl ?? errorSvgSrc : errorSvgSrc
40
+ alt: alt ? alt : "",
41
+ url: data.status === "success" ? data.data.metaImage?.image.imageUrl ?? errorSvgSrc : errorSvgSrc
42
42
  }
43
43
  });
44
44
  };
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const brightcoveEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const brightcoveEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.BrightcoveEmbed, {
22
22
  embed: data,
23
23
  heartButton: opts.components?.heartButton,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const campaignBlockPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const campaignBlockPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  const embed = data.embedData;
22
22
  return (0, _jsxRuntime.jsx)(_ui.CampaignBlock, {
23
23
  title: {
@@ -34,9 +34,9 @@ const campaignBlockPlugin = (element, _, opts) => {
34
34
  },
35
35
  path: opts.path,
36
36
  imageSide: embed.imageSide,
37
- image: data.status === 'success' && data.data.image ? {
37
+ image: data.status === "success" && data.data.image ? {
38
38
  src: data.data.image.image.imageUrl,
39
- alt: embed.alt === undefined ? '' : embed.alt
39
+ alt: embed.alt === undefined ? "" : embed.alt
40
40
  } : undefined
41
41
  });
42
42
  };
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const codeEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const codeEmbedPlugin = element => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_code.CodeEmbed, {
22
22
  embed: data
23
23
  });
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const conceptEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const conceptEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.ConceptEmbed, {
22
22
  embed: data,
23
23
  fullWidth: true,
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const conceptListEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const conceptListEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const data = JSON.parse(props['data-json']);
20
+ const data = JSON.parse(props["data-json"]);
21
21
  return (0, _jsxRuntime.jsx)(_ui.ConceptListEmbed, {
22
22
  embed: data,
23
23
  lang: opts.articleLanguage
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { PluginType } from '../types';
8
+ import { PluginType } from "../types";
9
9
  export declare const contactBlockEmbedPlugin: PluginType;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  const contactBlockEmbedPlugin = (element, _, opts) => {
19
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
- const embedData = JSON.parse(props['data-json']);
20
+ const embedData = JSON.parse(props["data-json"]);
21
21
  const {
22
22
  name,
23
23
  email,
@@ -28,7 +28,7 @@ const contactBlockEmbedPlugin = (element, _, opts) => {
28
28
  alt
29
29
  } = embedData.embedData;
30
30
  return (0, _jsxRuntime.jsx)(_ui.ContactBlock, {
31
- image: embedData.status === 'success' ? embedData.data.image : undefined,
31
+ image: embedData.status === "success" ? embedData.data.image : undefined,
32
32
  embedAlt: alt,
33
33
  description: description,
34
34
  email: email,