@frontkom/block-react-parser 0.1.0 → 1.1.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/.eslintrc.js ADDED
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es2021: true,
5
+ node: true,
6
+ },
7
+ extends: ['airbnb', 'plugin:prettier/recommended', 'plugin:react/recommended'],
8
+ overrides: [],
9
+ parserOptions: {
10
+ ecmaVersion: 'latest',
11
+ sourceType: 'module',
12
+ },
13
+ plugins: ['react'],
14
+ rules: {},
15
+ };
@@ -0,0 +1,4 @@
1
+ .cache
2
+ package.json
3
+ package-lock.json
4
+ dist
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "arrowParens": "avoid",
3
+ "printWidth": 100,
4
+ "singleQuote": true,
5
+ "tabWidth": 2,
6
+ "trailingComma": "all"
7
+ }
8
+
@@ -0,0 +1,41 @@
1
+ ## [1.0.0](https://github.com/frontkom/block-react-parser/compare/v0.1.0...v1.0.0) (2024-03-06)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * cleanup changelog
7
+
8
+ ### Features
9
+
10
+ * cleanup changelog ([31e66b9](https://github.com/frontkom/block-react-parser/commit/31e66b900b5994959569784ce04c85150c0f88e6))
11
+
12
+
13
+ ### Documentation
14
+
15
+ * cleanup changelog ([834ab23](https://github.com/frontkom/block-react-parser/commit/834ab23d057090ccaf8f179b386f6aee684ced90))
16
+
17
+
18
+ ### Miscellaneous Chores
19
+
20
+ * **DEVOPS-506:** add $schema and contributors to package.json ([8dc9883](https://github.com/frontkom/block-react-parser/commit/8dc98834c25dfdb0321c2ae41e3c877733466d5a))
21
+ * **DEVOPS-506:** add id-token to permissions in GitHub actions ([8901401](https://github.com/frontkom/block-react-parser/commit/8901401a3d092c6ea18d8f5129c826a78f10225b))
22
+ * **DEVOPS-506:** change build package action ([42c2035](https://github.com/frontkom/block-react-parser/commit/42c20356a96a6f664f46b4946bddf70a2838d8e0))
23
+ * **DEVOPS-506:** change place of contributors in package.json (for test github actions ) ([ccb2b38](https://github.com/frontkom/block-react-parser/commit/ccb2b3818c10f6a7a861fcc93923dac699ffc1ee))
24
+ * **DEVOPS-506:** cleanup semantic-release.yaml ([8775be9](https://github.com/frontkom/block-react-parser/commit/8775be980af665d4db3403ab80af9c642464a01f))
25
+ * **DEVOPS-506:** fix build package action config ([0a99ae0](https://github.com/frontkom/block-react-parser/commit/0a99ae08358445e3e6f48e6621ed58f2f8d2e6a5))
26
+ * **DEVOPS-506:** fix build package action config ([d9559e0](https://github.com/frontkom/block-react-parser/commit/d9559e015dfaffaee3590a5002cd6f540c6c850a))
27
+ * **DEVOPS-506:** merge develop to beta ([637317e](https://github.com/frontkom/block-react-parser/commit/637317e40ba319374f162eb2d2b1b4f330649d7a))
28
+ * **DEVOPS-506:** remove dist folder ([390ece7](https://github.com/frontkom/block-react-parser/commit/390ece75eb8bb66e789fa841e71ad6a309b7f5d7))
29
+ * **DEVOPS-506:** remove dist folder from assets in @semantic-release/git ([ab67ce1](https://github.com/frontkom/block-react-parser/commit/ab67ce113828e7b4f471ef399740b4e64dd171c9))
30
+ * **release:** 0.1.1 [skip ci] ([011f395](https://github.com/frontkom/block-react-parser/commit/011f39599ca5b94a5c3448aada36bd6d76d3f7ab))
31
+ * **release:** 0.1.2 [skip ci] ([05be598](https://github.com/frontkom/block-react-parser/commit/05be59829e35a321b4bddbc4e0fd7789bcd36522))
32
+ * **release:** 1.0.0 [skip ci] ([d6bea1a](https://github.com/frontkom/block-react-parser/commit/d6bea1a940a70b737c4dc9bd99d739bb8ce4fd63))
33
+ * **release:** 1.0.0-beta.10 [skip ci] ([d69454f](https://github.com/frontkom/block-react-parser/commit/d69454f6b8c5e81ce32b6824fbc10747e8fe3476))
34
+ * **release:** 1.0.0-beta.2 [skip ci] ([7e54ad1](https://github.com/frontkom/block-react-parser/commit/7e54ad166b46ada37a3865361ae7aa3d5bbd6164))
35
+ * **release:** 1.0.0-beta.3 [skip ci] ([00ca556](https://github.com/frontkom/block-react-parser/commit/00ca556807d918ece4fbca575f402de3dd268d42))
36
+ * **release:** 1.0.0-beta.4 [skip ci] ([89bfee0](https://github.com/frontkom/block-react-parser/commit/89bfee00d3841df58e59e2e86731d9d50fb72d57))
37
+ * **release:** 1.0.0-beta.5 [skip ci] ([e475522](https://github.com/frontkom/block-react-parser/commit/e4755228758e91590431add3406743eff619a2bf))
38
+ * **release:** 1.0.0-beta.6 [skip ci] ([be22f32](https://github.com/frontkom/block-react-parser/commit/be22f32c5082071d91a919f1e2149857c7a27c67))
39
+ * **release:** 1.0.0-beta.7 [skip ci] ([dcd4a9b](https://github.com/frontkom/block-react-parser/commit/dcd4a9b9722a45174e2abd2e10df58860305819a))
40
+ * **release:** 1.0.0-beta.8 [skip ci] ([8f5d9e1](https://github.com/frontkom/block-react-parser/commit/8f5d9e187b11e8fc90ed58ac38ebd12282f3c952))
41
+ * **release:** 1.0.0-beta.9 [skip ci] ([63b7c61](https://github.com/frontkom/block-react-parser/commit/63b7c616db3145a15c4d80d871df3ed8dff7b5ba))
@@ -0,0 +1,6 @@
1
+ ## [1.1.0-beta.1](https://github.com/frontkom/block-react-parser/compare/v1.0.0...v1.1.0-beta.1) (2024-03-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * add dist folder to .gitignore ([15422a5](https://github.com/frontkom/block-react-parser/commit/15422a58a7a9c39bc450607b3fd8c46eb10e6d0e))
@@ -0,0 +1,11 @@
1
+ ## [1.1.0](https://github.com/frontkom/block-react-parser/compare/v1.0.0...v1.1.0) (2024-03-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * add dist folder to .gitignore ([15422a5](https://github.com/frontkom/block-react-parser/commit/15422a58a7a9c39bc450607b3fd8c46eb10e6d0e))
7
+
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * **release:** 1.1.0-beta.1 [skip ci] ([44a44a7](https://github.com/frontkom/block-react-parser/commit/44a44a7d90f2253118239681916ae26ba604113b))
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Block;
7
+ var _react = _interopRequireDefault(require("react"));
7
8
  var _Tree = _interopRequireDefault(require("./Tree"));
8
9
  var _innerNode = _interopRequireDefault(require("../utils/innerNode"));
9
10
  var _Context = require("./Context");
11
+ var _htmlAttribs = _interopRequireDefault(require("../utils/htmlAttribs"));
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
  /**
12
14
  * Block element.
@@ -24,9 +26,14 @@ function Block(_ref) {
24
26
  innerBlocks
25
27
  } = block;
26
28
  const CustomBlock = (0, _Context.useBlockComponent)(blockName);
29
+ const htmlAttrs = (0, _htmlAttribs.default)(innerContent[0]);
30
+ const blockExtended = {
31
+ ...block,
32
+ htmlAttrs
33
+ };
27
34
  if (CustomBlock) {
28
- return /*#__PURE__*/React.createElement(CustomBlock, {
29
- block: block
35
+ return /*#__PURE__*/_react.default.createElement(CustomBlock, {
36
+ block: blockExtended
30
37
  });
31
38
  }
32
39
 
@@ -35,14 +42,14 @@ function Block(_ref) {
35
42
  return null;
36
43
  }
37
44
  // Filter out empty lines and orphaned closing tags.
38
- if (innerContent.length === 1 && (innerContent[0] === "\n" || innerContent[0].substring(0, 2) === "</")) {
45
+ if (innerContent.length === 1 && (innerContent[0] === '\n' || innerContent[0].substring(0, 2) === '</')) {
39
46
  return null;
40
47
  }
41
48
  const node = (0, _innerNode.default)(innerBlocks, innerContent);
42
49
  if (node) {
43
- return /*#__PURE__*/React.createElement(_Tree.default, {
50
+ return /*#__PURE__*/_react.default.createElement(_Tree.default, {
44
51
  node: node,
45
- block: block
52
+ block: blockExtended
46
53
  });
47
54
  }
48
55
  return null;
@@ -4,23 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Tree;
7
+ var _react = _interopRequireDefault(require("react"));
7
8
  var _Context = require("./Context");
8
9
  var _Block = _interopRequireDefault(require("./Block"));
9
10
  var _attribsProps = _interopRequireDefault(require("../utils/attribsProps"));
10
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12
  function Tree(_ref) {
12
- var _node$children;
13
+ var _node$children2;
13
14
  let {
14
15
  node,
15
16
  block
16
17
  } = _ref;
17
18
  const CustomTag = (0, _Context.useTagComponent)(node.name);
18
19
  (0, _attribsProps.default)(node.attribs);
19
- if (node.type === "text") {
20
- if (node.data === "[innerBlocks]") {
20
+ if (node.type === 'text') {
21
+ if (node.data === '[innerBlocks]') {
21
22
  var _block$innerBlocks;
22
23
  // eslint-disable-next-line react/no-array-index-key
23
- return (_block$innerBlocks = block.innerBlocks) === null || _block$innerBlocks === void 0 ? void 0 : _block$innerBlocks.map((inner, index) => /*#__PURE__*/React.createElement(_Block.default, {
24
+ return (_block$innerBlocks = block.innerBlocks) === null || _block$innerBlocks === void 0 ? void 0 : _block$innerBlocks.map((inner, index) => /*#__PURE__*/_react.default.createElement(_Block.default, {
24
25
  block: inner,
25
26
  key: index
26
27
  }));
@@ -30,16 +31,26 @@ function Tree(_ref) {
30
31
 
31
32
  // Handle selfclosed elements (???)
32
33
  if (CustomTag) {
33
- return /*#__PURE__*/React.createElement(CustomTag, {
34
+ var _node$children;
35
+ const tagChildren = (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.map((child, index) =>
36
+ /*#__PURE__*/
37
+ // eslint-disable-next-line react/no-array-index-key
38
+ _react.default.createElement(Tree, {
39
+ node: child,
40
+ block: block,
41
+ key: index
42
+ }));
43
+ return /*#__PURE__*/_react.default.createElement(CustomTag, {
44
+ node: tagChildren,
34
45
  attribs: node.attribs
35
46
  });
36
47
  }
37
48
  const Component = node.name;
38
49
  const attrs = (0, _attribsProps.default)(node.attribs);
39
- return /*#__PURE__*/React.createElement(Component, attrs, (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.map((child, index) =>
50
+ return /*#__PURE__*/_react.default.createElement(Component, attrs, (_node$children2 = node.children) === null || _node$children2 === void 0 ? void 0 : _node$children2.map((child, index) =>
40
51
  /*#__PURE__*/
41
52
  // eslint-disable-next-line react/no-array-index-key
42
- React.createElement(Tree, {
53
+ _react.default.createElement(Tree, {
43
54
  node: child,
44
55
  block: block,
45
56
  key: index
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.customTags = exports.customBlocks = exports.coreTags = exports.coreBlocks = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
7
8
  var _img = _interopRequireDefault(require("./tags/img"));
8
9
  var _selfClosing = _interopRequireDefault(require("./tags/selfClosing"));
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -12,7 +13,7 @@ const coreTags = exports.coreTags = {
12
13
  let {
13
14
  attribs
14
15
  } = _ref;
15
- return /*#__PURE__*/React.createElement(_img.default, {
16
+ return /*#__PURE__*/_react.default.createElement(_img.default, {
16
17
  attribs: attribs
17
18
  });
18
19
  },
@@ -20,7 +21,7 @@ const coreTags = exports.coreTags = {
20
21
  let {
21
22
  attribs
22
23
  } = _ref2;
23
- return /*#__PURE__*/React.createElement(_selfClosing.default, {
24
+ return /*#__PURE__*/_react.default.createElement(_selfClosing.default, {
24
25
  attribs: attribs,
25
26
  tag: "br"
26
27
  });
@@ -29,7 +30,7 @@ const coreTags = exports.coreTags = {
29
30
  let {
30
31
  attribs
31
32
  } = _ref3;
32
- return /*#__PURE__*/React.createElement(_selfClosing.default, {
33
+ return /*#__PURE__*/_react.default.createElement(_selfClosing.default, {
33
34
  attribs: attribs,
34
35
  tag: "hr"
35
36
  });
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _htmlparser = require("htmlparser2");
8
+ var _attribsProps2 = _interopRequireDefault(require("./attribsProps"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const htmlAttribs = html => {
11
+ const htmlFragment = html === null || html === void 0 ? void 0 : html.trim();
12
+ if (htmlFragment && htmlFragment.length > 1) {
13
+ var _parsedFragment$child;
14
+ const parsedFragment = (0, _htmlparser.parseDocument)(htmlFragment, {
15
+ lowerCaseTags: true,
16
+ recognizeSelfClosing: true
17
+ });
18
+ const attribs = parsedFragment === null || parsedFragment === void 0 || (_parsedFragment$child = parsedFragment.children[0]) === null || _parsedFragment$child === void 0 ? void 0 : _parsedFragment$child.attribs;
19
+ if (Object.keys(attribs).length !== 0) {
20
+ var _attribsProps;
21
+ return (_attribsProps = (0, _attribsProps2.default)(attribs)) !== null && _attribsProps !== void 0 ? _attribsProps : {};
22
+ }
23
+ }
24
+ return {};
25
+ };
26
+ var _default = exports.default = htmlAttribs;
@@ -10,7 +10,7 @@ const innerNode = (innerBlocks, innerContent) => {
10
10
  // If no inner blocks, return the block markup.
11
11
  // If inner blocks, return the wrapping markup.
12
12
  const innerHtml = !innerBlocks.length ? innerContent[0] : "".concat(innerContent[0], "[innerBlocks]").concat(innerContent[innerContent.length - 1]);
13
- const html = innerHtml ? innerHtml.trim() : "";
13
+ const html = innerHtml ? innerHtml.trim() : '';
14
14
  const tree = (0, _htmlparser.parseDocument)(html, {
15
15
  lowerCaseTags: true,
16
16
  recognizeSelfClosing: true
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
+ "$schema": "https://json-schema.org/package.json",
2
3
  "name": "@frontkom/block-react-parser",
3
- "version": "0.1.0",
4
+ "version": "1.1.0",
4
5
  "description": "Gutenberg-generated HTML to React parser.",
5
6
  "main": "dist/index.js",
6
7
  "module": "dist/index.js",
@@ -14,6 +15,12 @@
14
15
  "gutenberg"
15
16
  ],
16
17
  "author": "Roberto Ornelas <rob@frontkom.com>",
18
+ "contributors": [
19
+ {
20
+ "name": "Krzysztof Branecki",
21
+ "email": "krzysztof.branecki@frontkom.com"
22
+ }
23
+ ],
17
24
  "license": "ISC",
18
25
  "dependencies": {
19
26
  "@wordpress/block-serialization-default-parser": "^4.21.0",
@@ -1,6 +1,8 @@
1
- import Tree from "./Tree";
2
- import innerNode from "../utils/innerNode";
3
- import { useBlockComponent } from "./Context";
1
+ import React from 'react';
2
+ import Tree from './Tree';
3
+ import innerNode from '../utils/innerNode';
4
+ import { useBlockComponent } from './Context';
5
+ import htmlAttribs from '../utils/htmlAttribs';
4
6
 
5
7
  /**
6
8
  * Block element.
@@ -12,8 +14,11 @@ export default function Block({ block }) {
12
14
  const { blockName = null, innerContent, innerBlocks } = block;
13
15
  const CustomBlock = useBlockComponent(blockName);
14
16
 
17
+ const htmlAttrs = htmlAttribs(innerContent[0]);
18
+ const blockExtended = { ...block, htmlAttrs };
19
+
15
20
  if (CustomBlock) {
16
- return <CustomBlock block={block} />;
21
+ return <CustomBlock block={blockExtended} />;
17
22
  }
18
23
 
19
24
  // Filter out empty blocks.
@@ -23,14 +28,14 @@ export default function Block({ block }) {
23
28
  // Filter out empty lines and orphaned closing tags.
24
29
  if (
25
30
  innerContent.length === 1 &&
26
- (innerContent[0] === "\n" || innerContent[0].substring(0, 2) === "</")
31
+ (innerContent[0] === '\n' || innerContent[0].substring(0, 2) === '</')
27
32
  ) {
28
33
  return null;
29
34
  }
30
35
 
31
36
  const node = innerNode(innerBlocks, innerContent);
32
37
  if (node) {
33
- return <Tree node={node} block={block} />;
38
+ return <Tree node={node} block={blockExtended} />;
34
39
  }
35
40
 
36
41
  return null;
@@ -1,18 +1,17 @@
1
- import { useTagComponent } from "./Context";
2
- import Block from "./Block";
3
- import attribsProps from "../utils/attribsProps";
1
+ import React from 'react';
2
+ import { useTagComponent } from './Context';
3
+ import Block from './Block';
4
+ import attribsProps from '../utils/attribsProps';
4
5
 
5
6
  export default function Tree({ node, block }) {
6
7
  const CustomTag = useTagComponent(node.name);
7
8
 
8
9
  attribsProps(node.attribs);
9
10
 
10
- if (node.type === "text") {
11
- if (node.data === "[innerBlocks]") {
11
+ if (node.type === 'text') {
12
+ if (node.data === '[innerBlocks]') {
12
13
  // eslint-disable-next-line react/no-array-index-key
13
- return block.innerBlocks?.map((inner, index) => (
14
- <Block block={inner} key={index} />
15
- ));
14
+ return block.innerBlocks?.map((inner, index) => <Block block={inner} key={index} />);
16
15
  }
17
16
 
18
17
  return node.data;
@@ -20,7 +19,12 @@ export default function Tree({ node, block }) {
20
19
 
21
20
  // Handle selfclosed elements (???)
22
21
  if (CustomTag) {
23
- return <CustomTag attribs={node.attribs} />;
22
+ const tagChildren = node.children?.map((child, index) => (
23
+ // eslint-disable-next-line react/no-array-index-key
24
+ <Tree node={child} block={block} key={index} />
25
+ ));
26
+
27
+ return <CustomTag node={tagChildren} attribs={node.attribs} />;
24
28
  }
25
29
 
26
30
  const Component = node.name;
@@ -1,3 +1,5 @@
1
+ import React from 'react';
2
+
1
3
  import Image from './tags/img';
2
4
  import SelfClosing from './tags/selfClosing';
3
5
 
@@ -5,9 +7,7 @@ export const coreTags = {
5
7
  img: ({ attribs }) => <Image attribs={attribs} />,
6
8
  br: ({ attribs }) => <SelfClosing attribs={attribs} tag="br" />,
7
9
  hr: ({ attribs }) => <SelfClosing attribs={attribs} tag="hr" />,
8
- meta: ({ attribs }) => {
9
- return null;
10
- },
10
+ meta: ({ attribs }) => null,
11
11
  // area: ({attribs}) => <SelfClosing attribs={attribs} tag="area" />,
12
12
  // base: ({attribs}) => <SelfClosing attribs={attribs} tag="base" />,
13
13
  // col: ({attribs}) => <SelfClosing attribs={attribs} tag="col" />,
@@ -0,0 +1,5 @@
1
+ export default function Image({ attribs }) {
2
+ const { alt = '', class: className = '', src, height, width } = attribs;
3
+
4
+ return <img alt={alt} className={className} src={src} width={width} height={height} />;
5
+ }
@@ -1,18 +1,18 @@
1
1
  import convert from 'react-attr-converter';
2
2
  import parseStyle from 'style-to-js';
3
3
 
4
- const attribsProps = (attribs) => {
4
+ const attribsProps = attribs => {
5
5
  if (attribs === undefined) {
6
6
  return {};
7
7
  }
8
8
 
9
9
  const props = Object.fromEntries(
10
- Object.entries(attribs).map((attribute) => {
10
+ Object.entries(attribs).map(attribute => {
11
11
  if (attribute[0] === 'style') {
12
12
  return [convert(attribute[0]), parseStyle(attribute[1])];
13
13
  }
14
14
  return [convert(attribute[0]), attribute[1]];
15
- })
15
+ }),
16
16
  );
17
17
 
18
18
  return props;
@@ -0,0 +1,22 @@
1
+ import { parseDocument } from 'htmlparser2';
2
+ import attribsProps from './attribsProps';
3
+
4
+ const htmlAttribs = html => {
5
+ const htmlFragment = html?.trim();
6
+
7
+ if (htmlFragment && htmlFragment.length > 1) {
8
+ const parsedFragment = parseDocument(htmlFragment, {
9
+ lowerCaseTags: true,
10
+ recognizeSelfClosing: true,
11
+ });
12
+ const attribs = parsedFragment?.children[0]?.attribs;
13
+
14
+ if (Object.keys(attribs).length !== 0) {
15
+ return attribsProps(attribs) ?? {};
16
+ }
17
+ }
18
+
19
+ return {};
20
+ };
21
+
22
+ export default htmlAttribs;
@@ -1,4 +1,4 @@
1
- import { parseDocument } from "htmlparser2";
1
+ import { parseDocument } from 'htmlparser2';
2
2
 
3
3
  const innerNode = (innerBlocks, innerContent) => {
4
4
  // If no inner blocks, return the block markup.
@@ -6,7 +6,7 @@ const innerNode = (innerBlocks, innerContent) => {
6
6
  const innerHtml = !innerBlocks.length
7
7
  ? innerContent[0]
8
8
  : `${innerContent[0]}[innerBlocks]${innerContent[innerContent.length - 1]}`;
9
- const html = innerHtml ? innerHtml.trim() : "";
9
+ const html = innerHtml ? innerHtml.trim() : '';
10
10
 
11
11
  const tree = parseDocument(html, {
12
12
  lowerCaseTags: true,
@@ -1,5 +1,5 @@
1
- import { parse } from "@wordpress/block-serialization-default-parser";
2
- import Block from "../components/Block";
1
+ import { parse } from '@wordpress/block-serialization-default-parser';
2
+ import Block from '../components/Block';
3
3
 
4
4
  /**
5
5
  * Parse Gutenberg blocks from HTML markup.
@@ -7,7 +7,7 @@ import Block from "../components/Block";
7
7
  * @param {string} html - markup rendered by Gutenberg editor.
8
8
  * @returns {JSX.Element[]}
9
9
  */
10
- const parseBlocks = (html) =>
10
+ const parseBlocks = html =>
11
11
  parse(html.trim()).map((block, key) => <Block block={block} key={key} />);
12
12
 
13
13
  export default parseBlocks;
@@ -1,13 +0,0 @@
1
- export default function Image({ attribs }) {
2
- const { alt = '', class: className = '', src, height, width } = attribs;
3
-
4
- return (
5
- <img
6
- alt={alt}
7
- className={className}
8
- src={src}
9
- width={width}
10
- height={height}
11
- />
12
- );
13
- }