@ndla/article-converter 2.5.0 → 2.5.3

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.
@@ -23,6 +23,7 @@ import { blogPostEmbedPlugin } from './blogPostEmbedPlugin';
23
23
  import { keyFigureEmbedPlugin } from './KeyFigureEmbedPlugin';
24
24
  import { contactBlockEmbedPlugin } from './contactBlockEmbedPlugin';
25
25
  import { campaignBlockPlugin } from './campaignBlockPlugin';
26
+ import { linkBlockPlugin } from './linkBlockEmbedPlugin';
26
27
  export var embedPlugins = {
27
28
  image: imageEmbedPlugin,
28
29
  audio: audioEmbedPlugin,
@@ -40,5 +41,6 @@ export var embedPlugins = {
40
41
  file: fileEmbedPlugin,
41
42
  'key-figure': keyFigureEmbedPlugin,
42
43
  'contact-block': contactBlockEmbedPlugin,
43
- 'campaign-block': campaignBlockPlugin
44
+ 'campaign-block': campaignBlockPlugin,
45
+ 'link-block': linkBlockPlugin
44
46
  };
@@ -15,7 +15,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
15
15
  import { LinkBlock } from '@ndla/ui';
16
16
  import { attributesToProps } from 'html-react-parser';
17
17
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
18
- export var imageEmbedPlugin = function imageEmbedPlugin(element) {
18
+ export var linkBlockPlugin = function linkBlockPlugin(element) {
19
19
  var props = attributesToProps(element.attribs);
20
20
  var data = JSON.parse(props['data-json']);
21
21
  return _jsx(LinkBlock, _objectSpread({}, data.embedData));
@@ -16,7 +16,7 @@ import { attributesToProps, domToReact } from 'html-react-parser';
16
16
  import { LinkBlockSection } from '@ndla/ui';
17
17
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
18
18
  export var navPlugin = function navPlugin(node, opts) {
19
- if (node.attribs['data-type'] === 'link-block') {
19
+ if (node.attribs['data-type'] === 'link-block-list') {
20
20
  var props = attributesToProps(node.attribs);
21
21
  return _jsx(LinkBlockSection, _objectSpread(_objectSpread({}, props), {}, {
22
22
  children: domToReact(node.children, opts)
@@ -21,6 +21,7 @@ var _blogPostEmbedPlugin = require("./blogPostEmbedPlugin");
21
21
  var _KeyFigureEmbedPlugin = require("./KeyFigureEmbedPlugin");
22
22
  var _contactBlockEmbedPlugin = require("./contactBlockEmbedPlugin");
23
23
  var _campaignBlockPlugin = require("./campaignBlockPlugin");
24
+ var _linkBlockEmbedPlugin = require("./linkBlockEmbedPlugin");
24
25
  /**
25
26
  * Copyright (c) 2023-present, NDLA.
26
27
  *
@@ -46,6 +47,7 @@ var embedPlugins = {
46
47
  file: _fileEmbedPlugin.fileEmbedPlugin,
47
48
  'key-figure': _KeyFigureEmbedPlugin.keyFigureEmbedPlugin,
48
49
  'contact-block': _contactBlockEmbedPlugin.contactBlockEmbedPlugin,
49
- 'campaign-block': _campaignBlockPlugin.campaignBlockPlugin
50
+ 'campaign-block': _campaignBlockPlugin.campaignBlockPlugin,
51
+ 'link-block': _linkBlockEmbedPlugin.linkBlockPlugin
50
52
  };
51
53
  exports.embedPlugins = embedPlugins;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
  import { PluginType } from '../types';
9
- export declare const imageEmbedPlugin: PluginType;
9
+ export declare const linkBlockPlugin: PluginType;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.imageEmbedPlugin = void 0;
6
+ exports.linkBlockPlugin = void 0;
7
7
  var _ui = require("@ndla/ui");
8
8
  var _htmlReactParser = require("html-react-parser");
9
9
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
@@ -19,9 +19,9 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  *
21
21
  */
22
- var imageEmbedPlugin = function imageEmbedPlugin(element) {
22
+ var linkBlockPlugin = function linkBlockPlugin(element) {
23
23
  var props = (0, _htmlReactParser.attributesToProps)(element.attribs);
24
24
  var data = JSON.parse(props['data-json']);
25
25
  return (0, _jsxRuntime.jsx)(_ui.LinkBlock, _objectSpread({}, data.embedData));
26
26
  };
27
- exports.imageEmbedPlugin = imageEmbedPlugin;
27
+ exports.linkBlockPlugin = linkBlockPlugin;
@@ -20,7 +20,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
20
20
  *
21
21
  */
22
22
  var navPlugin = function navPlugin(node, opts) {
23
- if (node.attribs['data-type'] === 'link-block') {
23
+ if (node.attribs['data-type'] === 'link-block-list') {
24
24
  var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
25
25
  return (0, _jsxRuntime.jsx)(_ui.LinkBlockSection, _objectSpread(_objectSpread({}, props), {}, {
26
26
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "2.5.0",
3
+ "version": "2.5.3",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ndla/code": "^2.2.22",
34
- "@ndla/ui": "^44.0.0",
34
+ "@ndla/ui": "^44.0.3",
35
35
  "html-react-parser": "^3.0.8",
36
36
  "lodash": "^4.17.20"
37
37
  },
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "dfd245ca3261ca1209556b43c6185220e2fd7639"
47
+ "gitHead": "385848abebc45b3984cbd6ba700d121799570c9c"
48
48
  }
@@ -24,6 +24,7 @@ import { blogPostEmbedPlugin } from './blogPostEmbedPlugin';
24
24
  import { keyFigureEmbedPlugin } from './KeyFigureEmbedPlugin';
25
25
  import { contactBlockEmbedPlugin } from './contactBlockEmbedPlugin';
26
26
  import { campaignBlockPlugin } from './campaignBlockPlugin';
27
+ import { linkBlockPlugin } from './linkBlockEmbedPlugin';
27
28
 
28
29
  export const embedPlugins: Record<string, PluginType> = {
29
30
  image: imageEmbedPlugin,
@@ -43,4 +44,5 @@ export const embedPlugins: Record<string, PluginType> = {
43
44
  'key-figure': keyFigureEmbedPlugin,
44
45
  'contact-block': contactBlockEmbedPlugin,
45
46
  'campaign-block': campaignBlockPlugin,
47
+ 'link-block': linkBlockPlugin,
46
48
  };
@@ -11,7 +11,7 @@ import { attributesToProps } from 'html-react-parser';
11
11
  import { LinkBlockMetaData } from '@ndla/types-embed';
12
12
  import { PluginType } from '../types';
13
13
 
14
- export const imageEmbedPlugin: PluginType = (element) => {
14
+ export const linkBlockPlugin: PluginType = (element) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props['data-json']) as LinkBlockMetaData;
17
17
 
@@ -11,7 +11,7 @@ import { LinkBlockSection } from '@ndla/ui';
11
11
  import { PluginType } from './types';
12
12
 
13
13
  export const navPlugin: PluginType = (node, opts) => {
14
- if (node.attribs['data-type'] === 'link-block') {
14
+ if (node.attribs['data-type'] === 'link-block-list') {
15
15
  const props = attributesToProps(node.attribs);
16
16
  return <LinkBlockSection {...props}>{domToReact(node.children, opts)}</LinkBlockSection>;
17
17
  }