Change ReparseStaticChildren to accept all Replace options, and remove
internal hard-coded debug setting.
Showing
1 changed file
with
2 additions
and
3 deletions
... | @@ -4,15 +4,14 @@ import { COMMENT_NODE, DOCUMENT_NODE, DOCTYPE_NODE, ELEMENT_NODE, TEXT_NODE } fr | ... | @@ -4,15 +4,14 @@ import { COMMENT_NODE, DOCUMENT_NODE, DOCTYPE_NODE, ELEMENT_NODE, TEXT_NODE } fr |
4 | import { parseHtml, createMatcher, findNode } from 'astro-wt/html' | 4 | import { parseHtml, createMatcher, findNode } from 'astro-wt/html' |
5 | import { decode } from 'html-entities' | 5 | import { decode } from 'html-entities' |
6 | 6 | ||
7 | export const ReparseStaticChildren = (replacements, Component) => (props) => { | 7 | export const ReparseStaticChildren = (replaceOptions, Component) => (props) => { |
8 | const { children = {}, ...rest } = props | 8 | const { children = {}, ...rest } = props |
9 | const { props: { value: staticHtml } = {} } = children | 9 | const { props: { value: staticHtml } = {} } = children |
10 | if (!staticHtml) return <Component {...props}/> | 10 | if (!staticHtml) return <Component {...props}/> |
11 | const bodyToParse = String(staticHtml) | 11 | const bodyToParse = String(staticHtml) |
12 | const ultra = Replace({ | 12 | const ultra = Replace({ |
13 | debug: 2, | 13 | ...replaceOptions, |
14 | html: bodyToParse, | 14 | html: bodyToParse, |
15 | replacements, | ||
16 | }) | 15 | }) |
17 | 16 | ||
18 | return <Component {...rest}>{ultra}</Component> | 17 | return <Component {...rest}>{ultra}</Component> | ... | ... |
-
Please register or sign in to post a comment