lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: Pasting over linebreaks puts content in different places

Open augustobmoura opened this issue 1 year ago • 2 comments

When pasting some text with at least two containers/paragraphs on two linebreaks, the text being pasted gets split, the first container (heading) gets on the correct location, and the remaining text gets pasted after the next paragraph.

Lexical version:

Steps To Reproduce

  1. Hit two Shift-Enter inside a paragraph on Lexical's editor
  2. Try pasting a text having two containers, a heading and a paragraph for example

https://github.com/facebook/lexical/assets/5845160/321fe7a4-56b7-488d-a851-7f6d16174514

Lexical playground exports: Playground 2023-07-24T13_10_22.747Z.lexical.zip

The current behavior

The first line of the text being pasted gets to the correct location, and the remaining text gets appended to the end of the paragraph.

The expected behavior

All the text gets inserted to the correct location, preferably keeping the same formatting from where it was copied.

augustobmoura avatar Jul 24 '23 13:07 augustobmoura

Hi @augustobmoura, I reproduced this error, and it seems there is an issue when copying and pasting text. I observed the following:

  • When you have some text already written and have some space below with "Shift+Enter" and paste some other text there with any formatting, it adopts the same format as the existing text.

i'm willing to work on it, can anyone please assign this task to me. @StyleT

Git-Codder avatar Apr 25 '24 17:04 Git-Codder

@Git-Codder Hi! Go ahead and proceed! And thanks for your help here.

StyleT avatar Apr 25 '24 19:04 StyleT