RenderHTML without escaping HTML characters #2272
Answered
by
philippkuehn
robinbisping
asked this question in
Questions & Help
-
I am trying to add a Raw HTML field to tiptap, wrapped in a custom node view. Its purpose is to allow a user to insert raw HTML into the field, which is then rendered at the same place as HTML. However, <div class="video">
<video src="video.mp4"></video>
</div> is rendered as <div data-type="raw"><div class="video">
<video src="video.mp4"></video>
</div></div> My renderHTML ({ node }) {
return [
'div',
{ 'data-type': 'raw' },
node.attrs.html
]
} Does anyone have an idea how to render the data without escaping any HTML characters? |
Beta Was this translation helpful? Give feedback.
Answered by
philippkuehn
Dec 13, 2021
Replies: 1 comment 1 reply
-
This is not supported with this syntax. But you can also return a DOM node in renderHTML ({ node }) {
const div = document.createElement('div')
div.dataset.type = 'raw'
div.innerHTML = node.attrs.html
return div
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
robinbisping
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not supported with this syntax. But you can also return a DOM node in
renderHTML
so you could try the following: