lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: Pasting into an empty quote node converts it to a paragraph

Open kevinansfield opened this issue 2 years ago • 3 comments

Lexical version: v0.12.2

Steps To Reproduce

  1. Open https://playground.lexical.dev
  2. Copy some text from elsewhere in the playground editor contents
  3. Start a new quote using either > or the menu
  4. Paste your copied text

The current behavior

The quote formatting is lost and replaced with a plain paragraph.

https://github.com/facebook/lexical/assets/415/7d8b7703-a7c6-49f5-bb3a-52303d272f99

The expected behavior

The quote formatting is kept when pasting.

kevinansfield avatar Oct 10 '23 17:10 kevinansfield

This issue is not reproducible in 0.16.0

https://github.com/facebook/lexical/assets/8845364/8e666eab-3495-4d69-953b-62cfe0a0854d

grigoriy-reshetniak avatar Jun 07 '24 09:06 grigoriy-reshetniak

Confirmed, this looks to be fixed 🙏

Closing for now, if we detect other issues after upgrading I'll re-open/open a new issue.

kevinansfield avatar Jul 02 '24 09:07 kevinansfield

On further testing this only appears to have been fixed when a copy results in the clipboard only containing text nodes. If a whole paragraph node is copied then a paste into a quote still clears the quote which feels unexpected.

I've worked around that in our editor here https://github.com/TryGhost/Koenig/pull/1297/files but I'm re-opening the issue as it still feels like a core concern. However, please feel free to close if this expected behaviour crosses the core/userspace concern boundary.

kevinansfield avatar Jul 02 '24 15:07 kevinansfield