Bug: Overlapping Mark Nodes and Link Nodes
- Dominant language
- TypeScript
- Stars
- 23.9k
- Forks
- 2.2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 55
Description
Lexical version: v0.5.2 - latest
## Steps To Reproduce
Issue when overlapping mark nodes and link nodes
1. If a link element already exists, wrapping a mark node over it will remove the link styling. The mark node range must be the same as the link node range. Basically adding a mark from where the link starts until where the link ends. (anchor.offset and focus.offset).
2. Wrapping half of the linked word with a mark node, will wrap the entire link in a mark node.
3. Creating a link over a text node and a mark node will duplicate/split the link node in two halves. I’ve added a couple screenshots. You will notice the link duplication in the tree view.

Link to code example: https://playground.lexical.dev/
## The current behavior
1) Link node styling disappears
2) Wraps entire link with mark node
3) Duplicates link node
## The expected behavior
1) Link styling should remain visible
2) Should only wrap selected text with mark node
3) Should be same link node
Contributor guide
Assessment
This issue has not been assessed yet.