You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open editor in the browser & insert Image Block. Immediately onEditorContentChange event will fire, causing blocksToMarkdown to run, which throws an error.
Here is the block object with empty image causing the error:
Thanks for writing up this issue! We still have some work to do on serializing blocks made using createBlockSpec and createReactBlockSpec. This issue is closely related to #221 and #282.
Context:
The root cause of this bug is that we're using ProseMirror's node views to define how custom blocks are rendered, as this lets us get the block that needs to be rendered. The problem with this is that node views are only used for rendering to the DOM, not for serialization, which is used for e.g. copying to clipboard and converting to HTML. We are still working on implementing a custom serializer for the underlying ProseMirror editor which will let us use a block's render function for both rendering and serialization.
Thanks for quick and detailed reply. Ease of writing custom components with Blocknote is great, keeping my fingers crossed for custom serialization solution.
For now I made a workaround to convert image block to markdown (and store them as paragraph block) before calling blocksToMarkdown(). It's not a nice solution, also complicates the backward conversion (from markdown to image block), but does the job... Definitely looking forward to more elegant & flexible way to achieve it.
Activity
matthewlipski commentedon Oct 4, 2023
Thanks for writing up this issue! We still have some work to do on serializing blocks made using
createBlockSpecandcreateReactBlockSpec. This issue is closely related to #221 and #282.Context:
The root cause of this bug is that we're using ProseMirror's node views to define how custom blocks are rendered, as this lets us get the block that needs to be rendered. The problem with this is that node views are only used for rendering to the DOM, not for serialization, which is used for e.g. copying to clipboard and converting to HTML. We are still working on implementing a custom serializer for the underlying ProseMirror editor which will let us use a block's
renderfunction for both rendering and serialization.wkocjan commentedon Oct 9, 2023
Thanks for quick and detailed reply. Ease of writing custom components with Blocknote is great, keeping my fingers crossed for custom serialization solution.
For now I made a workaround to convert image block to markdown (and store them as paragraph block) before calling
blocksToMarkdown(). It's not a nice solution, also complicates the backward conversion (from markdown to image block), but does the job... Definitely looking forward to more elegant & flexible way to achieve it.Fix TypeCellOS#361 Error converting Image Block to Markdown
jmas commentedon Oct 15, 2023
@matthewlipski @wkocjan Hello! I added PR: #381 that fix the issue. Please check!