Skip to content

Bug: Pasting content that has disjointed pre tags into an existing code block loses content.  #9151

Description

@zamorai

Lexical version: v0.50.0+dev.esm

Steps To Reproduce

  1. Copy the output of this HTML from somewhere like jsfiddle
<html>
<body>
<pre>Some text here</pre> </br>
<pre >Some more text there</pre>
</body>
</html>
  1. Paste the clipboard in the lexical playground
  2. Notice that a code block with content some text here then an empty line then another code block with content Some more text there will be added
  3. Delete everything from the playground so you are in a fresh state
  4. Now add a code block with ctrl+alt+c and ensure your cursor is inside the code block.
  5. Paste content from your clipboard again
  6. Notice that only Some text here will be copied, the second part is lost.
Image

The current behavior

Pasting multiple pre tags inside an existing code block means only the first one is correctly pasted

The expected behavior

All consecutive pre tags are collapsed into the same code block, or expanded to different code blocks, as long as no content is lost from the paste operation.

Impact of fix

Lower severity as not a lot of places copy disjointed pre tags, but notably, telemetry services like jenkins and humio do, so a lot of internal customers that rely on a workflow of creating a code block > pasting the logs are affected. This can be somewhat alleviated as not pre-creating the code block removes this issue, but we have still gotten reports from this awkward behavior.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions