facebook / facebook/lexical

Bug: Pasting code from VS Code in lexical generates multiple code blocks in Safari

Open
#5,569 1 comment 1 reaction 0 assignees View on GitHub
copy+paste html safari-bug
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

Lexical version: 0.13.0

## Steps To Reproduce

1. Open this markdown file in VS Code and copy its content. (or create a markdown file and paste this exact code with the initial empty line in VS Code)
[lexical-paste-issue.md](https://github.com/facebook/lexical/files/14095794/lexical-paste-issue.md)
```

## 📱 Heading

Text

- Animate on sending message and delete
- Set online/offline
- Show all users when @ is typed
- Swipe to reply (fixing its bugs in a patch tomorrow)
- Improved colors for chat bubbles
- Added tabs for direct messages and threads
- Fixed emoji messages to be bigger
- Fixed rendering code and hashtags
- Added support for forwarded messages and nudges

## Heading

```

2. In Safari, paste it from VS Code into Lexical Playground.
3. It will be pasted as multiple code blocks

Video: https://github.com/facebook/lexical/assets/12202757/1c801349-d99a-4d48-8c5d-fa8724907073

Link to code example:

Reproducible in the playground.

## The current behavior

It splits code in multiple code blocks in Safari. It works fine in Chrome:
https://github.com/facebook/lexical/assets/12202757/ba509965-43f2-46da-b18b-aad1a56ea29a

## The expected behavior

It should paste it as one code block.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in the Lexical Playground with Safari and the linked markdown file, using the latest Lexical packages. Trace the Playground's paste handling and compare Safari with Chrome. Done means the content pastes as one code block in Safari without regressing Chrome behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.