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-text] Test for handling multiple matches on hashtags #6056

Merged
merged 6 commits into from
May 10, 2024

Conversation

2wheeh
Copy link
Contributor

@2wheeh 2wheeh commented May 8, 2024

Description

#6053 deleted escape on adjacent next matches. but it turns out it was needed in different place (probably after replacement for current match has done ?)

without it, editor breaks on pasting or importing text that has adjacent matches.
=> #6067

And nodeToReplace can be undefined implicitly. Now it's the case. So I added null check for it.
This could occur in other places especially around TextNode.splitText() unless we use --noUncheckedIndexedAccess.

Test plan

Before

2024-05-08.6.17.02.mov
2024-05-08.6.18.39.mov
2024-05-08.6.41.48.mov

After

2024-05-08.6.27.26.mov
2024-05-08.6.43.12.mov

Copy link

vercel bot commented May 8, 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 10, 2024 1:35am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 1:35am

@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 8, 2024
@2wheeh 2wheeh changed the title [lexical-playground][lexical-text] Bug Fix: for handling multiple matches on hashtags [WIP] Bug Fix: for handling multiple matches on hashtags May 8, 2024
@2wheeh 2wheeh marked this pull request as draft May 8, 2024 10:18
@2wheeh 2wheeh force-pushed the fix-nextmatch-handling branch from bf6448e to 3178daa Compare May 8, 2024 13:41
@2wheeh 2wheeh marked this pull request as ready for review May 8, 2024 14:36
@2wheeh 2wheeh changed the title [WIP] Bug Fix: for handling multiple matches on hashtags [lexical-playground][lexical-text] Bug Fix: for handling multiple matches on hashtags May 8, 2024
@2wheeh
Copy link
Contributor Author

2wheeh commented May 8, 2024

2024-05-08.11.32.08.mov

Now it seems to work well.

cc @Sahejkm

@2wheeh 2wheeh changed the title [lexical-playground][lexical-text] Bug Fix: for handling multiple matches on hashtags [lexical-text] Bug Fix: for handling multiple matches on hashtags May 9, 2024
Copy link
Contributor

@Sahejkm Sahejkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi thanks @2wheeh, we could pull now for the tests to pass, then will approve and close this.

packages/lexical-text/src/registerLexicalTextEntity.ts Outdated Show resolved Hide resolved
Sahejkm
Sahejkm previously approved these changes May 10, 2024
Copy link
Contributor

@Sahejkm Sahejkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding extensive tests for this!

@Sahejkm Sahejkm merged commit 3fc9fb6 into facebook:main May 10, 2024
4 checks passed
@2wheeh 2wheeh deleted the fix-nextmatch-handling branch May 10, 2024 02:10
@2wheeh 2wheeh changed the title [lexical-text] Bug Fix: for handling multiple matches on hashtags [lexical-text] Test for handling multiple matches on hashtags May 10, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants