-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Floating link editor for AutoLinkNode and conversion to LinkNode once modified. #5536
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! Added a minor comment, seems like there's a merge conflict as well if you can look at this before we merge
}).append($createTextNode(parent.getURL())); | ||
parent.getParent()?.append(linkNode); | ||
parent.remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use replace
instead, guarantees the correct position with the best performance.
- Replace the parent:
parent.replace(linkNode)
- Move the children: traverse all the children in parent and append them into
linkNode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using .replace() and it kept crashing my browser but I'll try again
Sorry about that @zurfyx, ran into some weird issues after having to rebase the branch due to the changes to main. Should work perfectly fine and as intended now. |
packages/lexical-playground/src/plugins/FloatingLinkEditorPlugin/index.tsx
Outdated
Show resolved
Hide resolved
LGTM, thanks Harry! |
This PR fixes #4202 as well as satisfies @zurfyx request in #4203 to have the AutoLinkNode be converted to a LinkNode once modified in the floating link editor toolbar.
I saw multiple closed PR's for this and it looked like it was still an issue no one was currently working on.
Please let me know if there's anything I need to change, I know the conversion logic is kind of ugly.