Can't call blocksToHTMLLossy
on document with React custom blocks without instantiating a BlockNoteView
#720
Labels
bug
Something isn't working
Describe the bug
<what's going wrong!?>
I want to render a document of blocks to HTML, "headlessly" ie. without showing the editor. But when some of my custom blocks are React-rendered (defined via
createReactBlockSpec
), an error is thrown when exporting to HTML without having instantiated aBlockNoteView
.blocksToHTMLLossy()
, somewhere down the stack, depends oncontentComponent
being set on the innereditor._tiptapEditor
(here), which is done by auseEffect
inEditorContent
that mutates the editor passed in , andEditorContent
doesn't come into play without having aBlockNoteView
.I think this specific state of affairs was introduced in #641, but I haven't checked whether this would have worked before that.
For now, I'm just rendering a BlockNoteView on a throwaway React root, in order to get the mutation from EditorContent applied, which is fine, but a bit clunky.
I appreciate this is probably not a common use case 🙃
To Reproduce
The error thrown is:
<clear steps to reproduce are super helpful! Best is to provide an online sandbox, click to create one>
Misc
The text was updated successfully, but these errors were encountered: