Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
astro-wt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2b72df6e
authored
2024-11-11 16:14:57 -0600
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Change ReparseStaticChildren to accept all Replace options, and remove
internal hard-coded debug setting.
1 parent
094b0ec6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
lib/react.jsx
lib/react.jsx
View file @
2b72df6
...
...
@@ -4,15 +4,14 @@ import { COMMENT_NODE, DOCUMENT_NODE, DOCTYPE_NODE, ELEMENT_NODE, TEXT_NODE } fr
import
{
parseHtml
,
createMatcher
,
findNode
}
from
'astro-wt/html'
import
{
decode
}
from
'html-entities'
export
const
ReparseStaticChildren
=
(
replace
ment
s
,
Component
)
=>
(
props
)
=>
{
export
const
ReparseStaticChildren
=
(
replace
Option
s
,
Component
)
=>
(
props
)
=>
{
const
{
children
=
{},
...
rest
}
=
props
const
{
props
:
{
value
:
staticHtml
}
=
{}
}
=
children
if
(
!
staticHtml
)
return
<
Component
{
...
props
}
/>
const
bodyToParse
=
String
(
staticHtml
)
const
ultra
=
Replace
({
debug
:
2
,
...
replaceOptions
,
html
:
bodyToParse
,
replacements
,
})
return
<
Component
{
...
rest
}
>
{
ultra
}
</
Component
>
...
...
Please
register
or
sign in
to post a comment