Skip to content

RangeError: Content hole not allowed in a leaf node spec #4562

Closed Answered by nperez0111
techtitan1998 asked this question in Questions & Help
Discussion options

You must be logged in to vote

A "content hole" is Prosmirror's way of describing how to inject content from a prosemirror managed element (i.e. a normal paragraph without a nodeview) to a nodeview managed element (like a custom paragraph component). The "hole" describes the renderHTML method wherein you'd usually have:

  renderHTML({ HTMLAttributes }) {
    return ['element', mergeAttributes(HTMLAttributes), 0];
  },

//////////////// VS

  renderHTML({ HTMLAttributes }) {
    return ['element', mergeAttributes(HTMLAttributes)];
  },

where the 0 describes where to place child content into (like if you made a custom header, allowing it to accept rich text as sub-content.

In this case, specifically, the renderHTML metho…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

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