@ndla/article-converter 5.1.6 → 5.1.8

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.
@@ -0,0 +1,27 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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
+ */
14
+
15
+ import { attributesToProps, domToReact } from 'html-react-parser';
16
+ import SafeLink from '@ndla/safelink';
17
+ import { getPossiblyRelativeUrl } from '@ndla/ui';
18
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
19
+ export var anchorPlugin = function anchorPlugin(node, opts, _ref) {
20
+ var path = _ref.path;
21
+ var props = attributesToProps(node.attribs);
22
+ var href = getPossiblyRelativeUrl(props.href, path);
23
+ return _jsx(SafeLink, _objectSpread(_objectSpread({}, props), {}, {
24
+ to: href,
25
+ children: domToReact(node.children, opts)
26
+ }));
27
+ };
@@ -7,11 +7,11 @@
7
7
  */
8
8
 
9
9
  import { domToReact } from 'html-react-parser';
10
- import { Aside, FactBoxV2 } from '@ndla/ui';
10
+ import { Aside, FactBox } from '@ndla/ui';
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export var asidePlugin = function asidePlugin(node, opts) {
13
13
  if (node.attribs['data-type'] === 'factAside') {
14
- return _jsx(FactBoxV2, {
14
+ return _jsx(FactBox, {
15
15
  children: domToReact(node.children, opts)
16
16
  });
17
17
  } else if (node.attribs['data-type'] === 'rightAside') {
@@ -6,14 +6,14 @@
6
6
  *
7
7
  */
8
8
 
9
- import { CopyParagraphButtonV2 } from '@ndla/ui';
9
+ import { CopyParagraphButton } from '@ndla/ui';
10
10
  import { domToReact } from 'html-react-parser';
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export var copyParagraphPlugin = function copyParagraphPlugin(node, converterOpts, opts) {
13
13
  var _parent$attribs;
14
14
  var parent = node.parent;
15
15
  if ((parent === null || parent === void 0 ? void 0 : parent.name) === 'section' || (parent === null || parent === void 0 ? void 0 : parent.name) === 'div' && Object.keys((_parent$attribs = parent.attribs) !== null && _parent$attribs !== void 0 ? _parent$attribs : {}).length === 0) {
16
- return _jsx(CopyParagraphButtonV2, {
16
+ return _jsx(CopyParagraphButton, {
17
17
  copyText: node.attribs['data-text'],
18
18
  lang: opts.articleLanguage,
19
19
  children: domToReact(node.children, converterOpts)
@@ -20,14 +20,14 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
20
20
 
21
21
  import partition from 'lodash/partition';
22
22
  import { domToReact, attributesToProps } from 'html-react-parser';
23
- import { FileListV2, RelatedArticleListV2, Grid, GridParallaxItem } from '@ndla/ui';
23
+ import { FileList, RelatedArticleList, Grid, GridParallaxItem } from '@ndla/ui';
24
24
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
25
25
  import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
26
26
  import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
27
27
  export var divPlugin = function divPlugin(node, opts) {
28
28
  if (node.attribs['data-type'] === 'related-content' && node.children.length) {
29
29
  var props = attributesToProps(node.attribs);
30
- return _jsx(RelatedArticleListV2, _objectSpread(_objectSpread({}, props), {}, {
30
+ return _jsx(RelatedArticleList, _objectSpread(_objectSpread({}, props), {}, {
31
31
  headingLevel: "h3",
32
32
  children: domToReact(node.children, opts)
33
33
  }));
@@ -42,7 +42,7 @@ export var divPlugin = function divPlugin(node, opts) {
42
42
  pdfs = _partition2[0],
43
43
  files = _partition2[1];
44
44
  return _jsxs(_Fragment, {
45
- children: [files.length ? _jsx(FileListV2, {
45
+ children: [files.length ? _jsx(FileList, {
46
46
  children: domToReact(files, opts)
47
47
  }) : undefined, domToReact(pdfs, opts)]
48
48
  });
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { attributesToProps } from 'html-react-parser';
10
- import { PdfFile, FileV2 } from '@ndla/ui';
10
+ import { PdfFile, File } from '@ndla/ui';
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export var fileEmbedPlugin = function fileEmbedPlugin(element) {
13
13
  var props = attributesToProps(element.attribs);
@@ -23,7 +23,7 @@ export var fileEmbedPlugin = function fileEmbedPlugin(element) {
23
23
  url: url
24
24
  });
25
25
  } else {
26
- return _jsx(FileV2, {
26
+ return _jsx(File, {
27
27
  url: url,
28
28
  title: title,
29
29
  fileExists: data.status === 'success' ? !!data.data.exists : false,
@@ -18,7 +18,7 @@ import { paragraphPlugin } from './paragraphPlugin';
18
18
  import { spanPlugin } from './spanPlugin';
19
19
  import { h3Plugin } from './h3Plugin';
20
20
  import { mathPlugin } from './mathPlugin';
21
- import { anchorPlugin } from './oembed/anchorPlugin';
21
+ import { anchorPlugin as oembedAnchorPlugin } from './oembed/anchorPlugin';
22
22
  import { divPlugin } from './divPlugin';
23
23
  import { tablePlugin } from './tablePlugin';
24
24
  import { asidePlugin } from './asidePlugin';
@@ -26,6 +26,7 @@ import { ulPlugin } from './ulPlugin';
26
26
  import { ddPlugin } from './ddPlugin';
27
27
  import { dtPlugin } from './dtPlugin';
28
28
  import { navPlugin } from './navPlugin';
29
+ import { anchorPlugin } from './anchorPlugin';
29
30
  export var basePlugins = {
30
31
  h2: copyParagraphPlugin,
31
32
  h3: h3Plugin,
@@ -39,8 +40,9 @@ export var basePlugins = {
39
40
  ul: ulPlugin,
40
41
  dd: ddPlugin,
41
42
  dt: dtPlugin,
42
- nav: navPlugin
43
+ nav: navPlugin,
44
+ a: anchorPlugin
43
45
  };
44
46
  export var oembedPlugins = _objectSpread(_objectSpread({}, basePlugins), {}, {
45
- a: anchorPlugin
47
+ a: oembedAnchorPlugin
46
48
  });
@@ -13,11 +13,17 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
13
13
  */
14
14
 
15
15
  import { attributesToProps, domToReact } from 'html-react-parser';
16
+ import { getPossiblyRelativeUrl } from '@ndla/ui';
17
+ import SafeLink from '@ndla/safelink';
16
18
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
- export var anchorPlugin = function anchorPlugin(node, options) {
19
+ export var anchorPlugin = function anchorPlugin(node, options, _ref) {
20
+ var path = _ref.path;
18
21
  var props = attributesToProps(node.attribs);
19
- return _jsx("a", _objectSpread(_objectSpread({}, props), {}, {
22
+ var href = getPossiblyRelativeUrl(props.href, path);
23
+ return _jsx(SafeLink, _objectSpread(_objectSpread({}, props), {}, {
20
24
  target: "_blank",
25
+ to: href,
26
+ rel: "noreferrer",
21
27
  children: domToReact(node.children, options)
22
28
  }));
23
29
  };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2023-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { PluginType } from './types';
9
+ export declare const anchorPlugin: PluginType;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.anchorPlugin = void 0;
7
+ var _htmlReactParser = require("html-react-parser");
8
+ var _safelink = _interopRequireDefault(require("@ndla/safelink"));
9
+ var _ui = require("@ndla/ui");
10
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
18
+ * Copyright (c) 2023-present, NDLA.
19
+ *
20
+ * This source code is licensed under the GPLv3 license found in the
21
+ * LICENSE file in the root directory of this source tree.
22
+ *
23
+ */
24
+ var anchorPlugin = function anchorPlugin(node, opts, _ref) {
25
+ var path = _ref.path;
26
+ var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
27
+ var href = (0, _ui.getPossiblyRelativeUrl)(props.href, path);
28
+ return (0, _jsxRuntime.jsx)(_safelink.default, _objectSpread(_objectSpread({}, props), {}, {
29
+ to: href,
30
+ children: (0, _htmlReactParser.domToReact)(node.children, opts)
31
+ }));
32
+ };
33
+ exports.anchorPlugin = anchorPlugin;
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
17
 
18
18
  var asidePlugin = function asidePlugin(node, opts) {
19
19
  if (node.attribs['data-type'] === 'factAside') {
20
- return (0, _jsxRuntime.jsx)(_ui.FactBoxV2, {
20
+ return (0, _jsxRuntime.jsx)(_ui.FactBox, {
21
21
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
22
22
  });
23
23
  } else if (node.attribs['data-type'] === 'rightAside') {
@@ -19,7 +19,7 @@ var copyParagraphPlugin = function copyParagraphPlugin(node, converterOpts, opts
19
19
  var _parent$attribs;
20
20
  var parent = node.parent;
21
21
  if ((parent === null || parent === void 0 ? void 0 : parent.name) === 'section' || (parent === null || parent === void 0 ? void 0 : parent.name) === 'div' && Object.keys((_parent$attribs = parent.attribs) !== null && _parent$attribs !== void 0 ? _parent$attribs : {}).length === 0) {
22
- return (0, _jsxRuntime.jsx)(_ui.CopyParagraphButtonV2, {
22
+ return (0, _jsxRuntime.jsx)(_ui.CopyParagraphButton, {
23
23
  copyText: node.attribs['data-text'],
24
24
  lang: opts.articleLanguage,
25
25
  children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
@@ -30,7 +30,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
30
30
  var divPlugin = function divPlugin(node, opts) {
31
31
  if (node.attribs['data-type'] === 'related-content' && node.children.length) {
32
32
  var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
33
- return (0, _jsxRuntime.jsx)(_ui.RelatedArticleListV2, _objectSpread(_objectSpread({}, props), {}, {
33
+ return (0, _jsxRuntime.jsx)(_ui.RelatedArticleList, _objectSpread(_objectSpread({}, props), {}, {
34
34
  headingLevel: "h3",
35
35
  children: (0, _htmlReactParser.domToReact)(node.children, opts)
36
36
  }));
@@ -45,7 +45,7 @@ var divPlugin = function divPlugin(node, opts) {
45
45
  pdfs = _partition2[0],
46
46
  files = _partition2[1];
47
47
  return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
48
- children: [files.length ? (0, _jsxRuntime.jsx)(_ui.FileListV2, {
48
+ children: [files.length ? (0, _jsxRuntime.jsx)(_ui.FileList, {
49
49
  children: (0, _htmlReactParser.domToReact)(files, opts)
50
50
  }) : undefined, (0, _htmlReactParser.domToReact)(pdfs, opts)]
51
51
  });
@@ -29,7 +29,7 @@ var fileEmbedPlugin = function fileEmbedPlugin(element) {
29
29
  url: url
30
30
  });
31
31
  } else {
32
- return (0, _jsxRuntime.jsx)(_ui.FileV2, {
32
+ return (0, _jsxRuntime.jsx)(_ui.File, {
33
33
  url: url,
34
34
  title: title,
35
35
  fileExists: data.status === 'success' ? !!data.data.exists : false,
@@ -18,6 +18,7 @@ var _ulPlugin = require("./ulPlugin");
18
18
  var _ddPlugin = require("./ddPlugin");
19
19
  var _dtPlugin = require("./dtPlugin");
20
20
  var _navPlugin = require("./navPlugin");
21
+ var _anchorPlugin2 = require("./anchorPlugin");
21
22
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
22
23
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
24
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -43,7 +44,8 @@ var basePlugins = {
43
44
  ul: _ulPlugin.ulPlugin,
44
45
  dd: _ddPlugin.ddPlugin,
45
46
  dt: _dtPlugin.dtPlugin,
46
- nav: _navPlugin.navPlugin
47
+ nav: _navPlugin.navPlugin,
48
+ a: _anchorPlugin2.anchorPlugin
47
49
  };
48
50
  exports.basePlugins = basePlugins;
49
51
  var oembedPlugins = _objectSpread(_objectSpread({}, basePlugins), {}, {
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.anchorPlugin = void 0;
7
7
  var _htmlReactParser = require("html-react-parser");
8
+ var _ui = require("@ndla/ui");
9
+ var _safelink = _interopRequireDefault(require("@ndla/safelink"));
8
10
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
12
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -18,10 +21,14 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
18
21
  * LICENSE file in the root directory of this source tree.
19
22
  *
20
23
  */
21
- var anchorPlugin = function anchorPlugin(node, options) {
24
+ var anchorPlugin = function anchorPlugin(node, options, _ref) {
25
+ var path = _ref.path;
22
26
  var props = (0, _htmlReactParser.attributesToProps)(node.attribs);
23
- return (0, _jsxRuntime.jsx)("a", _objectSpread(_objectSpread({}, props), {}, {
27
+ var href = (0, _ui.getPossiblyRelativeUrl)(props.href, path);
28
+ return (0, _jsxRuntime.jsx)(_safelink.default, _objectSpread(_objectSpread({}, props), {}, {
24
29
  target: "_blank",
30
+ to: href,
31
+ rel: "noreferrer",
25
32
  children: (0, _htmlReactParser.domToReact)(node.children, options)
26
33
  }));
27
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "5.1.6",
3
+ "version": "5.1.8",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -30,8 +30,8 @@
30
30
  "@ndla/types-embed": "^4.0.5"
31
31
  },
32
32
  "dependencies": {
33
- "@ndla/code": "^5.0.8",
34
- "@ndla/ui": "^47.4.1",
33
+ "@ndla/code": "^5.0.9",
34
+ "@ndla/ui": "^49.0.0",
35
35
  "html-react-parser": "^4.2.2",
36
36
  "lodash": "^4.17.20"
37
37
  },
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "de410ca8c4f83133def88e9ed04eb4984d9b0896"
47
+ "gitHead": "654c24de8eb48a35d6f3127c3f373091d7350de0"
48
48
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) 2023-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { attributesToProps, domToReact } from 'html-react-parser';
10
+ import SafeLink from '@ndla/safelink';
11
+ import { getPossiblyRelativeUrl } from '@ndla/ui';
12
+ import { PluginType } from './types';
13
+
14
+ export const anchorPlugin: PluginType = (node, opts, { path }) => {
15
+ const props = attributesToProps(node.attribs);
16
+ const href = getPossiblyRelativeUrl(props.href, path);
17
+
18
+ return (
19
+ <SafeLink {...props} to={href}>
20
+ {domToReact(node.children, opts)}
21
+ </SafeLink>
22
+ );
23
+ };
@@ -7,11 +7,11 @@
7
7
  */
8
8
 
9
9
  import { domToReact } from 'html-react-parser';
10
- import { Aside, FactBoxV2 } from '@ndla/ui';
10
+ import { Aside, FactBox } from '@ndla/ui';
11
11
  import { PluginType } from './types';
12
12
  export const asidePlugin: PluginType = (node, opts) => {
13
13
  if (node.attribs['data-type'] === 'factAside') {
14
- return <FactBoxV2>{domToReact(node.children, opts)}</FactBoxV2>;
14
+ return <FactBox>{domToReact(node.children, opts)}</FactBox>;
15
15
  } else if (node.attribs['data-type'] === 'rightAside') {
16
16
  return (
17
17
  <Aside wideScreen alwaysShow>
@@ -6,16 +6,16 @@
6
6
  *
7
7
  */
8
8
 
9
- import { CopyParagraphButtonV2 } from '@ndla/ui';
9
+ import { CopyParagraphButton } from '@ndla/ui';
10
10
  import { Element, domToReact } from 'html-react-parser';
11
11
  import { PluginType } from './types';
12
12
  export const copyParagraphPlugin: PluginType = (node, converterOpts, opts) => {
13
13
  const parent = node.parent as Element | undefined;
14
14
  if (parent?.name === 'section' || (parent?.name === 'div' && Object.keys(parent.attribs ?? {}).length === 0)) {
15
15
  return (
16
- <CopyParagraphButtonV2 copyText={node.attribs['data-text']} lang={opts.articleLanguage}>
16
+ <CopyParagraphButton copyText={node.attribs['data-text']} lang={opts.articleLanguage}>
17
17
  {domToReact(node.children, converterOpts)}
18
- </CopyParagraphButtonV2>
18
+ </CopyParagraphButton>
19
19
  );
20
20
  }
21
21
  return null;
@@ -8,7 +8,7 @@
8
8
 
9
9
  import partition from 'lodash/partition';
10
10
  import { domToReact, attributesToProps, Element } from 'html-react-parser';
11
- import { FileListV2, RelatedArticleListV2, Grid, GridType, GridParallaxItem } from '@ndla/ui';
11
+ import { FileList, RelatedArticleList, Grid, GridType, GridParallaxItem } from '@ndla/ui';
12
12
  import { PluginType } from './types';
13
13
 
14
14
  export const divPlugin: PluginType = (node, opts) => {
@@ -16,10 +16,10 @@ export const divPlugin: PluginType = (node, opts) => {
16
16
  const props = attributesToProps(node.attribs);
17
17
 
18
18
  return (
19
- <RelatedArticleListV2 {...props} headingLevel="h3">
19
+ <RelatedArticleList {...props} headingLevel="h3">
20
20
  {/* @ts-ignore */}
21
21
  {domToReact(node.children, opts)}
22
- </RelatedArticleListV2>
22
+ </RelatedArticleList>
23
23
  );
24
24
  } else if (node.attribs['data-type'] === 'file' && node.childNodes.length) {
25
25
  const elements = node.childNodes.filter(
@@ -32,7 +32,7 @@ export const divPlugin: PluginType = (node, opts) => {
32
32
 
33
33
  return (
34
34
  <>
35
- {files.length ? <FileListV2>{domToReact(files, opts)}</FileListV2> : undefined}
35
+ {files.length ? <FileList>{domToReact(files, opts)}</FileList> : undefined}
36
36
  {domToReact(pdfs, opts)}
37
37
  </>
38
38
  );
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { attributesToProps } from 'html-react-parser';
10
10
  import { FileMetaData } from '@ndla/types-embed';
11
- import { PdfFile, FileV2 } from '@ndla/ui';
11
+ import { PdfFile, File } from '@ndla/ui';
12
12
  import { PluginType } from '../types';
13
13
 
14
14
  export const fileEmbedPlugin: PluginType = (element) => {
@@ -19,7 +19,7 @@ export const fileEmbedPlugin: PluginType = (element) => {
19
19
  return <PdfFile title={title} url={url} />;
20
20
  } else {
21
21
  return (
22
- <FileV2
22
+ <File
23
23
  url={url}
24
24
  title={title}
25
25
  fileExists={data.status === 'success' ? !!data.data.exists : false}
@@ -13,7 +13,7 @@ import { paragraphPlugin } from './paragraphPlugin';
13
13
  import { spanPlugin } from './spanPlugin';
14
14
  import { h3Plugin } from './h3Plugin';
15
15
  import { mathPlugin } from './mathPlugin';
16
- import { anchorPlugin } from './oembed/anchorPlugin';
16
+ import { anchorPlugin as oembedAnchorPlugin } from './oembed/anchorPlugin';
17
17
  import { divPlugin } from './divPlugin';
18
18
  import { tablePlugin } from './tablePlugin';
19
19
  import { asidePlugin } from './asidePlugin';
@@ -21,6 +21,7 @@ import { ulPlugin } from './ulPlugin';
21
21
  import { ddPlugin } from './ddPlugin';
22
22
  import { dtPlugin } from './dtPlugin';
23
23
  import { navPlugin } from './navPlugin';
24
+ import { anchorPlugin } from './anchorPlugin';
24
25
 
25
26
  export const basePlugins: Record<string, PluginType> = {
26
27
  h2: copyParagraphPlugin,
@@ -36,9 +37,10 @@ export const basePlugins: Record<string, PluginType> = {
36
37
  dd: ddPlugin,
37
38
  dt: dtPlugin,
38
39
  nav: navPlugin,
40
+ a: anchorPlugin,
39
41
  };
40
42
 
41
43
  export const oembedPlugins: Record<string, PluginType> = {
42
44
  ...basePlugins,
43
- a: anchorPlugin,
45
+ a: oembedAnchorPlugin,
44
46
  };
@@ -7,12 +7,16 @@
7
7
  */
8
8
 
9
9
  import { attributesToProps, domToReact } from 'html-react-parser';
10
+ import { getPossiblyRelativeUrl } from '@ndla/ui';
11
+ import SafeLink from '@ndla/safelink';
10
12
  import { PluginType } from '../types';
11
- export const anchorPlugin: PluginType = (node, options) => {
13
+
14
+ export const anchorPlugin: PluginType = (node, options, { path }) => {
12
15
  const props = attributesToProps(node.attribs);
16
+ const href = getPossiblyRelativeUrl(props.href, path);
13
17
  return (
14
- <a {...props} target="_blank">
18
+ <SafeLink {...props} target="_blank" to={href} rel="noreferrer">
15
19
  {domToReact(node.children, options)}
16
- </a>
20
+ </SafeLink>
17
21
  );
18
22
  };