Skip to content

Bug: Overlapping Mark Nodes and Link Nodes #3266

Open
@robdasi

Description

@robdasi

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.

Screenshot 2022-10-26 at 12 02 34

Screenshot 2022-10-26 at 12 02 56

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions