payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.88k stars 1.58k forks source link

richtext-lexical: merging cells onto already merged cells throws errors #8062

Closed rilrom closed 1 month ago

rilrom commented 1 month ago

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.16.0
  npm: 10.8.1
  Yarn: 1.22.22
  pnpm: 9.9.0
Relevant Packages:
  payload: 3.0.0-beta.98
  next: 15.0.0-canary.104
  @payloadcms/db-postgres: 3.0.0-beta.98
  @payloadcms/email-nodemailer: 3.0.0-beta.98
  @payloadcms/graphql: 3.0.0-beta.98
  @payloadcms/live-preview: 3.0.0-beta.98
  @payloadcms/live-preview-react: 3.0.0-beta.98
  @payloadcms/next/utilities: 3.0.0-beta.98
  @payloadcms/plugin-cloud: 3.0.0-beta.98
  @payloadcms/plugin-form-builder: 3.0.0-beta.98
  @payloadcms/plugin-nested-docs: 3.0.0-beta.98
  @payloadcms/plugin-redirects: 3.0.0-beta.98
  @payloadcms/plugin-seo: 3.0.0-beta.98
  @payloadcms/richtext-lexical: 3.0.0-beta.98
  @payloadcms/translations: 3.0.0-beta.98
  @payloadcms/ui/shared: 3.0.0-beta.98
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022
  Available memory (MB): 25582
  Available CPU cores: 16

Describe the Bug

When you have some merged cells, then attempt to merge another cell into those merged cells, errors are thrown.

lexical-error

Reproduction Steps

  1. Create a lexical rich text table (default 5x5).
  2. Merge 4 of the 5 top row cells.
  3. Attempt to merge the last cell into the other merged cells.
  4. Errors are thrown.

lexical-error-1

Adapters and Plugins

db-postgres, richtext-lexical

rilrom commented 1 month ago

Upon further inspection I am able to replicate this in lexical playground.

A bug report has already been raised with lexical. It's been open for over a year so not a good outlook for it to get fixed.

Edit: I have put together a fix, I will create a PR over at lexical.

GermanJablo commented 1 month ago

That would be great @rilrom, thanks a lot!

GermanJablo commented 1 month ago

I see this is going to be fixed in the next release of Lexical. Thanks @rilrom!

https://github.com/facebook/lexical/pull/6607

github-actions[bot] commented 1 month ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.