Skip to content

What is the difference between decoration and NodeView in tiptap?! #2865

Discussion options

You must be logged in to vote

So tiptap doesn't have decoration API.

In fact, you can create decoration with tiptap by using the addProseMirrorPlugins method on Extension.create. This will be a prosemirror decoration so you won't be able to render react components easily.

but we can get kind of the same result using NodeViews.

NodeViews force you to have a node in the schema. If you have a node in the schema, you NEED to render html for the browser or the getHTML() method, either a text node or a dom element.

Let's take the example of the placeholder extension: https://github.com/ueberdosis/tiptap/blob/main/packages/extension-placeholder/src/placeholder.ts.

This extension is a decoration because you don't want a <…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@amirhhashemi
Comment options

Answer selected by amirhhashemi
Comment options

You must be logged in to vote
1 reply
@Ragnar-Oock
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants