Skip to content

Bug: Line breaks lost on paste #3548

Closed

Description

@stefantds

Lexical version: latest on playground as of today (sorry, I'm not sure where to find it)

Steps To Reproduce

  1. Open a new Google Doc
  2. Enter some text, then a new line using Shift+Enter (note that if you use just Enter it works fine)
  3. enter some text on the second line
  4. copy both lines
  5. Paste them in a lexical editor

Text copied in Google Docs:
Screenshot 2022-12-13 at 14 52 22

Pasted in Lexical:

Screenshot 2022-12-13 at 14 50 43

Clipboard content for the example images above public/html:

<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-545ebf83-7fff-b767-e61b-5f1d46955a56"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Line 1</span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;"><br /></span><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Line 2</span></b>

Note that the text is not wrapped in p elements but there are br elements that should be inserted as line breaks.

The current behavior

The two lines are inserted as one line, the line break is lost.

The expected behavior

The two lines are inserted as two separate lines in lexical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions