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

Bug: useCharacterLimit autolink infinite loop bug #6662

Open
redstar08 opened this issue Sep 24, 2024 · 2 comments
Open

Bug: useCharacterLimit autolink infinite loop bug #6662

redstar08 opened this issue Sep 24, 2024 · 2 comments

Comments

@redstar08
Copy link

redstar08 commented Sep 24, 2024

copy text and paste to Editor, type any link in overflow node, infinite loop
(eg.[https://x.com])

useCharacterLimit autolink infinite loop bug
type a link in overflow node
http://x.
image

Lexical version: 0.17.1

Steps To Reproduce

  1. add CharacterLimitPlugin and AutoLinkPlugin or LinkPlugin
  2. type a link in overflow node

Link to code example:
https://playground.lexical.dev/?isCharLimit=true

The current behavior

infinite loop in useCharacterLimit -> $wrapOverflowedNodes

The expected behavior

$wrapOverflowedNodes can deal autolink node or link node

Impact of fix

Can I fix it by modify $wrapOverflowedNodes ?

see the comment below

@redstar08
Copy link
Author

There is a way to fixed

import {$isAutoLinkNode, $isLinkNode} from '@lexical/link';

modify function $wrapOverflowedNodes

Judge by the $isAutoLinkNode and $isLinkNode to avoid infinite loop

image

Expected effect after modification

image

@redstar08
Copy link
Author

Please refer to PR #6668 for discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant