File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed
Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -188,8 +188,7 @@ parse('<p id="replace">text</p>', {
188188For TypeScript projects, you may need to check that ` domNode ` is an instance of domhandler's ` Element ` :
189189
190190``` tsx
191- import { HTMLReactParserOptions } from ' html-react-parser' ;
192- import { Element } from ' domhandler/lib/node' ;
191+ import { HTMLReactParserOptions , Element } from ' html-react-parser' ;
193192
194193const options: HTMLReactParserOptions = {
195194 replace : domNode => {
Original file line number Diff line number Diff line change 11var domToReact = require ( './lib/dom-to-react' ) ;
22var attributesToProps = require ( './lib/attributes-to-props' ) ;
33var htmlToDOM = require ( 'html-dom-parser' ) ;
4+ var { Element } = require ( 'domhandler/lib/node' ) ;
45
56var domParserOptions = { lowerCaseAttributeNames : false } ;
67
@@ -31,6 +32,7 @@ function HTMLReactParser(html, options) {
3132HTMLReactParser . domToReact = domToReact ;
3233HTMLReactParser . htmlToDOM = htmlToDOM ;
3334HTMLReactParser . attributesToProps = attributesToProps ;
35+ HTMLReactParser . Element = Element ;
3436
3537// support CommonJS and ES Modules
3638module . exports = HTMLReactParser ;
Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ import HTMLReactParser from './index.js';
33export var domToReact = HTMLReactParser . domToReact ;
44export var htmlToDOM = HTMLReactParser . htmlToDOM ;
55export var attributesToProps = HTMLReactParser . attributesToProps ;
6+ export var Element = HTMLReactParser . Element ;
67
78export default HTMLReactParser ;
You can’t perform that action at this time.
0 commit comments