Skip to content

convertLexicalToMarkdown function does not provide output for Upload Nodes #12425

@shawnvogt

Description

@shawnvogt

Describe the Bug

When converting Lexical State to Markdown, Upload Nodes are not being converted and a blank line is entered in the markdown output.

Expected output: I would be happy with just about any text value that includes the upload collection slug and id.
Actual output: a blank line

Link to the code that reproduces this issue

https://github.com/shawnvogt/payloadLexicalToMarkdown/tree/lexical-to-markdown-fails-to-convert-uploads

Reproduction Steps

  1. Ensure you are on the lexical-to-markdown-fails-to-convert-uploads branch of the attached codebase
  2. Run pnpm dev _community
  3. Access admin panel at localhost:3000/admin
  4. Open the example post in Posts collection in edit view
  5. Add an Upload node in the Content Fields lexical editor
  6. Click save
  7. View markdown output in the Markdown field and see that there is no output for the upload node

Additionally, if you want.

switch to the fix-lexical-to-markdown-fails-to-convert-uploads branch and run the above steps again. I have provided a basic fix for converting lexical Upload Nodes to markdown. markdown to lexical is not provided, I didn't see a use case for this, maybe there is one?

Which area(s) are affected? (Select all that apply)

plugin: richtext-lexical

Environment Info

Payload: 3.37.0
Node.js: 22.9.0
Next.js: 15.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions