Skip to content

Video disappears when parsing markdown back to blocks after page refresh #1938

@iyansr

Description

@iyansr

Bug Description

When uploading a video to the editor, it renders correctly and exports to markdown as expected. However, when refreshing the page and parsing the same markdown back to blocks, the video disappears and only the thumbnail image remains.

Steps to Reproduce

  1. Upload a video file to the BlockNote editor
  2. Export content using editor.blocksToMarkdownLossy(editor.document)
  3. Refresh the page
  4. Parse the markdown back using editor.tryParseMarkdownToBlocks(content)
  5. Replace blocks with editor.replaceBlocks(editor.document, blocks)

Expected Behavior

The video should be preserved and rendered correctly after parsing markdown back to blocks, maintaining the same functionality as before the page refresh.

Actual Behavior

The video disappears and only the thumbnail image is displayed. The markdown link reference to the video URL is lost during the parsing process.

Code Samples

Export (works correctly):

const markdown = await editor.blocksToMarkdownLossy(editor.document)

Import (loses video):

const blocks = await editor.tryParseMarkdownToBlocks(content);
editor.replaceBlocks(editor.document, blocks);

Markdown Output Comparison

After initial upload (correct):

asdasd

[](https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4)![1lpV49uSTaxnGNRCY99wXkQ.png](https://xxxxxxx.cloudfront.net/d52a08cb-1ede-44a1-bb57-4eb72bc329b0/files/7ea09d03-4273-467e-ab03-b86d8bb18c1d.png)
Image

After page refresh and re-import (incorrect):

asdasd

![BlockNote image](https://xxxxx.cloudfront.net/d52a08cb-1ede-44a1-bb57-4eb72bc329b0/files/7ea09d03-4273-467e-ab03-b86d8bb18c1d.png)
Image

Environment

  • BlockNote version: ^0.34.0
  • Browser: Arc Browser
  • OS: Mac OS Sonoma

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions