Why is renderHtml
still required when using addNodeView
?
#4924
Replies: 3 comments
-
I'm also wondering this with Vue, see #4888 |
Beta Was this translation helpful? Give feedback.
-
I think the idea is to allow you to display content in editor in one way (using For example this can be useful if you are exporting the content of your editor to HTML for saving somewhere. At the same time, when working in your editor, you want your node to look differently. For example, to have some decorations that you don't need to store. So these methods have a different purpose. You can find this text at the beginning of the article (https://tiptap.dev/docs/editor/extensions/custom-extensions/node-views):
One of them can be used as 'default' to another. In TipTap the |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I have a custom node whose rendering is controlled entirely using
addNodeView
and React. I have not definedrenderHtml
for the node. This functions completely fine. However, when you attempt to add this node as initial content to the editor, a runtime error is thrown, something abouttoDOM
being missing. This can be solved by definingrenderHtml
, however this feels strange to me, as the rendering defined there gets overridden byaddNodeView
. I've noticed pattern of defining bothrenderHtml
andaddNodeView
throughout the Tiptap library, for example here. What is the purpose of this?Beta Was this translation helpful? Give feedback.
All reactions