In the Lexical playground (or another Lexical install that includes CodeBlockPlugin), create a new empty code block by typing three backticks. Then copy some plain text from elsewhere, which contains three or more newlines in a row (ie two blank lines), and paste it inside the code block. Text after the newlines will wind up as top-level paragraphs rather than inside the code block.
In CodeNode.insertNewAfter, there is code that checks whether the last two children of the code block are blank lines, and if so, breaks out of the code block and starts a paragraph block. This makes sense if the user is typing (it makes it possible to leave the code block by typing enter a few times at the end), but doesn't make sense while pasting. Adding !$hasUpdateTag(PASTE_TAG) to the condition appears to fix it, without changing the intended UI interaction that this bit of code enables.
Lexical version: v0.43.0
In the Lexical playground (or another Lexical install that includes
CodeBlockPlugin), create a new empty code block by typing three backticks. Then copy some plain text from elsewhere, which contains three or more newlines in a row (ie two blank lines), and paste it inside the code block. Text after the newlines will wind up as top-level paragraphs rather than inside the code block.In CodeNode.insertNewAfter, there is code that checks whether the last two children of the code block are blank lines, and if so, breaks out of the code block and starts a paragraph block. This makes sense if the user is typing (it makes it possible to leave the code block by typing enter a few times at the end), but doesn't make sense while pasting. Adding
!$hasUpdateTag(PASTE_TAG)to the condition appears to fix it, without changing the intended UI interaction that this bit of code enables.Lexical version: v0.43.0