File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ import htmlToDOM from 'html-dom-parser';
7
7
8
8
export interface HTMLReactParserOptions {
9
9
// TODO: Replace `object` by type for objects like `{ type: 'h1', props: { children: 'Heading' } }`
10
- replace ( domNode : DomElement ) : React . ReactElement | object | undefined | false ;
10
+ replace ?: (
11
+ domNode : DomElement
12
+ ) => React . ReactElement | object | void | undefined | null | false ;
11
13
library ?: object ;
12
14
}
13
15
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ var utilities = require('./utilities');
4
4
/**
5
5
* Converts DOM nodes to React elements.
6
6
*
7
- * @param {Array } nodes - The DOM nodes.
8
- * @param {Object } [options] - The additional options.
9
- * @param {Function } [options.replace] - The replace method.
10
- * @return {ReactElement|Array }
7
+ * @param {DomElement[] } nodes - The DOM nodes.
8
+ * @param {Object } [options={}] - The additional options.
9
+ * @param {Function } [options.replace] - The replacer.
10
+ * @param {Object } [options.library] - The library (React, Preact, etc.).
11
+ * @return {String|ReactElement|ReactElement[] }
11
12
*/
12
13
function domToReact ( nodes , options ) {
13
14
options = options || { } ;
@@ -95,6 +96,10 @@ function domToReact(nodes, options) {
95
96
return result . length === 1 ? result [ 0 ] : result ;
96
97
}
97
98
99
+ /**
100
+ * @param {React.ReactElement } node
101
+ * @return {Boolean }
102
+ */
98
103
function shouldPassAttributesUnaltered ( node ) {
99
104
return (
100
105
utilities . PRESERVE_CUSTOM_ATTRIBUTES &&
You can’t perform that action at this time.
0 commit comments