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>', {
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 => {
Original file line number Diff line number Diff line change 1
1
var domToReact = require ( './lib/dom-to-react' ) ;
2
2
var attributesToProps = require ( './lib/attributes-to-props' ) ;
3
3
var htmlToDOM = require ( 'html-dom-parser' ) ;
4
+ var { Element } = require ( 'domhandler/lib/node' ) ;
4
5
5
6
var domParserOptions = { lowerCaseAttributeNames : false } ;
6
7
@@ -31,6 +32,7 @@ function HTMLReactParser(html, options) {
31
32
HTMLReactParser . domToReact = domToReact ;
32
33
HTMLReactParser . htmlToDOM = htmlToDOM ;
33
34
HTMLReactParser . attributesToProps = attributesToProps ;
35
+ HTMLReactParser . Element = Element ;
34
36
35
37
// support CommonJS and ES Modules
36
38
module . exports = HTMLReactParser ;
Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ import HTMLReactParser from './index.js';
3
3
export var domToReact = HTMLReactParser . domToReact ;
4
4
export var htmlToDOM = HTMLReactParser . htmlToDOM ;
5
5
export var attributesToProps = HTMLReactParser . attributesToProps ;
6
+ export var Element = HTMLReactParser . Element ;
6
7
7
8
export default HTMLReactParser ;
You can’t perform that action at this time.
0 commit comments