html-react-parser 1.3.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.4.0](https://www.github.com/remarkablemark/html-react-parser/compare/v1.3.0...v1.4.0) (2021-10-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * added CRA typescript example ([42f42e5](https://www.github.com/remarkablemark/html-react-parser/commit/42f42e519c05c382476a14a73d45b5f700fecdbb))
11
+ * export domhandler's Element ([0473e83](https://www.github.com/remarkablemark/html-react-parser/commit/0473e832ac65b3e8ce5f8da69c740cbd84f62863))
12
+
5
13
  ## [1.3.0](https://www.github.com/remarkablemark/html-react-parser/compare/v1.2.9...v1.3.0) (2021-09-07)
6
14
 
7
15
 
package/README.md CHANGED
@@ -188,8 +188,7 @@ parse('<p id="replace">text</p>', {
188
188
  For TypeScript projects, you may need to check that `domNode` is an instance of domhandler's `Element`:
189
189
 
190
190
  ```tsx
191
- import { HTMLReactParserOptions } from 'html-react-parser';
192
- import { Element } from 'domhandler/lib/node';
191
+ import { HTMLReactParserOptions, Element } from 'html-react-parser';
193
192
 
194
193
  const options: HTMLReactParserOptions = {
195
194
  replace: domNode => {
@@ -200,7 +199,7 @@ const options: HTMLReactParserOptions = {
200
199
  };
201
200
  ```
202
201
 
203
- If you're having issues with `domNode instanceof Element`, try this [alternative solution](https://github.com/remarkablemark/html-react-parser/issues/221#issuecomment-771600574).
202
+ If you're having issues take a look at our [Create React App example](./examples/create-react-app-typescript/src/App.tsx).
204
203
 
205
204
  #### replace element and children
206
205
 
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
3
3
  typeof define === 'function' && define.amd ? define(['react'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.HTMLReactParser = factory(global.React));
5
- }(this, (function (require$$0) { 'use strict';
5
+ })(this, (function (require$$0) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -1181,7 +1181,7 @@
1181
1181
  exports["default"] = StyleToJS;
1182
1182
  }(cjs));
1183
1183
 
1184
- var React$1 = require$$0__default['default'];
1184
+ var React$1 = require$$0__default["default"];
1185
1185
  var styleToJS = cjs.default;
1186
1186
 
1187
1187
  /**
@@ -1346,7 +1346,7 @@
1346
1346
  return props;
1347
1347
  };
1348
1348
 
1349
- var React = require$$0__default['default'];
1349
+ var React = require$$0__default["default"];
1350
1350
  var attributesToProps$1 = attributesToProps$2;
1351
1351
  var utilities$1 = utilities$3;
1352
1352
 
@@ -2366,6 +2366,7 @@
2366
2366
  HTMLReactParser.domToReact = domToReact;
2367
2367
  HTMLReactParser.htmlToDOM = htmlToDOM;
2368
2368
  HTMLReactParser.attributesToProps = attributesToProps;
2369
+ HTMLReactParser.Element = node.Element;
2369
2370
 
2370
2371
  // support CommonJS and ES Modules
2371
2372
  htmlReactParser$1.exports = HTMLReactParser;
@@ -2375,5 +2376,5 @@
2375
2376
 
2376
2377
  return htmlReactParser;
2377
2378
 
2378
- })));
2379
+ }));
2379
2380
  //# sourceMappingURL=html-react-parser.js.map