-
This is my jsx code: value = value.filter((obj: any) => Object.keys(obj).length > 0);
return (
<Typography>
<div
dangerouslySetInnerHTML={{
__html: serializeHtml<MyValue>(editor, {
nodes: value,
convertNewLinesToHtmlBr: true
}),
}}
/>
</Typography>
); And finally I get result just text, no HTML, alse not Edited by @12joan to improve code formatting |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @mazhan465 can you provide the code link to debug it? |
Beta Was this translation helpful? Give feedback.
-
It's quite difficult to tell what's going on here without more context. Since you're calling From the output you're getting, it looks to me like your If you want |
Beta Was this translation helpful? Give feedback.
It's quite difficult to tell what's going on here without more context.
Since you're calling
filter
onvalue
, it's clear thatvalue
is an array, presumably of Slate nodes. I don't know why you're filtering on presence of keys, though, since I've never seen an empty object in a Slate value before.From the output you're getting, it looks to me like your
value
array contains a single text fragment (about a new medicine to treat stomache disorders, if I'm reading it correctly?) containing no inline or block formatting. I'm not sure why the JSON for this text fragment is being rendered fromserializeHtml
, unless the JSON was part of the original text.If you want
serializeHtml
to output HTML …