2b72df6e by Adam Heath

Change ReparseStaticChildren to accept all Replace options, and remove

internal hard-coded debug setting.
1 parent 094b0ec6
...@@ -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>
......