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';
77
88export interface HTMLReactParserOptions {
99 // 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 ;
1113 library ?: object ;
1214}
1315
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ var utilities = require('./utilities');
44/**
55 * Converts DOM nodes to React elements.
66 *
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[] }
1112 */
1213function domToReact ( nodes , options ) {
1314 options = options || { } ;
@@ -95,6 +96,10 @@ function domToReact(nodes, options) {
9596 return result . length === 1 ? result [ 0 ] : result ;
9697}
9798
99+ /**
100+ * @param {React.ReactElement } node
101+ * @return {Boolean }
102+ */
98103function shouldPassAttributesUnaltered ( node ) {
99104 return (
100105 utilities . PRESERVE_CUSTOM_ATTRIBUTES &&
You can’t perform that action at this time.
0 commit comments