payloadcms / payloadcms/payload

Paste content to lexical editor with CORS-protected images will create invalid document in database

Open
#14,657 1 comment 1 reaction 1 assignee View on GitHub

@AlessioGr is already working on this.

Since Nov 19, 2025.

plugin: richtext-lexical status: verified
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

Pasting CORS-protected images into the Lexical editor on a collection with drafts enabled causes unhandled errors in PayloadCMS.

Link to the code that reproduces this issue

https://github.com/llaz00/payload-paste-image-bug

Reproduction Steps
  1. Create a project with a collection that has a rich text field using the Lexical editor.
  2. Enable drafts.
  3. Try to paste content containing CORS-protected images (e.g., I used this article: https://www.xataka.com/moviles/llevamos-anos-sufriendo-llamadas-spam-operadores-miraban-uno-ellos-fin-va-a-hacer-algo).
  4. A CORS error appears in the browser console; the Media dialog does not open, but the post can still be saved as a draft. This results in an invalid document in the database.
  5. Attempting to update any other field of the document using payload.update returns a ValidationError because the upload block ID within the rich text field is invalid.
Which area(s) are affected? (Select all that apply)

plugin: richtext-lexical

Environment Info
Binaries:
  Node: 20.13.1
  npm: 10.5.2
  Yarn: N/A
  pnpm: 10.15.1
Relevant Packages:
  payload: 3.64.0
  next: 15.4.7
  @payloadcms/db-mongodb: 3.64.0
  @payloadcms/graphql: 3.64.0
  @payloadcms/next/utilities: 3.64.0
  @payloadcms/richtext-lexical: 3.64.0
  @payloadcms/translations: 3.64.0
  @payloadcms/ui/shared: 3.64.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 16318
  Available CPU cores: 4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.