Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Odd behaviour with $getRoot().getTextContent() when copying and pasting it is stripping new lines. #3602

Closed
OrderAndCh4oS opened this issue Dec 20, 2022 · 0 comments · Fixed by #3669

Comments

@OrderAndCh4oS
Copy link

OrderAndCh4oS commented Dec 20, 2022

When copying and pasting content in the rich text editor, hitting return causes the last piece of pasted text to strip all new lines.

Lexical version: ^0.7.4

Steps To Reproduce

  1. console.log($getRoot().getTextContent()) in an `onChange handler.
  2. Type some text with a couple of line breaks.
  3. Copy the text with the line breaks and paste it underneath.
  4. Hit return, and you should see the output has stripped line breaks from the logged content.

Link to code example: Example Project

The current behavior

Lines are being concatenated when reading $getRoot().getTextContent()

The expected behavior

Text should maintain line breaks when reading $getRoot().getTextContent()

Screen.Recording.2022-12-20.at.16.33.51.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant