Open
Description
Lexical version: v0.5.2 - latest
Steps To Reproduce
Issue when overlapping mark nodes and link nodes
- 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).
- Wrapping half of the linked word with a mark node, will wrap the entire link in a mark node.
- 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
- Link node styling disappears
- Wraps entire link with mark node
- Duplicates link node
The expected behavior
- Link styling should remain visible
- Should only wrap selected text with mark node
- Should be same link node