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

[lexical-core][code-node] Bug Fix: Adding an empty paragraph before code node #6103

Closed
wants to merge 1 commit into from

Conversation

MaxPlav
Copy link
Contributor

@MaxPlav MaxPlav commented May 14, 2024

Description

Adding an empty paragraph before a code node when a user clicks Arrow Up from the code block and there are no other nodes before the code node.

Closes: #5968

Test plan

Before

Screen.Recording.2024-05-14.at.11.27.26.mov

After

Screen.Recording.2024-05-16.at.11.38.59.mov

Copy link

vercel bot commented May 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 5:47pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 5:47pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 14, 2024
@StyleT
Copy link
Contributor

StyleT commented May 14, 2024

For the context: we have similar issue with QuoteNode (although selection there never jumps to the root node), so maybe we shall try to fix both :)

Screen.Recording.2024-05-14.at.12.56.57.PM.mov

@MaxPlav
Copy link
Contributor Author

MaxPlav commented May 14, 2024

The issue is reproducible for other ElementNodes and should be fixed not only for the playground editor. Checked on ImageNode and it's possible to set the cursor before the node for adding a new element.

@MaxPlav MaxPlav force-pushed the fix/code-block-focus-5968 branch from 3699342 to fdcf662 Compare May 16, 2024 17:46
@MaxPlav MaxPlav changed the title [lexical-playground][code-node] Bug Fix: Adding an extra empty paragraph when insert code node [lexical-core][code-node] Bug Fix: Adding an empty paragraph before code node May 16, 2024
@StyleT
Copy link
Contributor

StyleT commented May 20, 2024

Discussed with @MaxPlav that more comprehensive solution needed here that accounts for more nodes and use cases (ex: two "column layout" nodes in the middle of the document)

@StyleT StyleT closed this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. contribution-week Issues that are good to be picked up for the contribution week
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants