Skip to content

Bug: inconsistent behavior of DecoratorNode within MarkNode #7231

@giacomoran

Description

@giacomoran

Lexical version: 0.25.0

Steps To Reproduce

  1. Open Lexical Playground
  2. Starting with text aaa x^2 bbb, turn x^2 into an equation, then turn the entire text into a comment
  3. Starting with text aaa x^2 bbb, turn the entire text into a comment, then turn x^2 into an equation
CleanShot.2025-02-22.at.08.59.44.mp4

The current behavior

In point 2, the equation node (52) is part of the MarkNode (56).
In point 3, the equation node (62) is outside the MarkNodes (60) and (64).

root
  ├ (47) paragraph 
  | └ (56) mark ids: [ ibexx ]
  |   ├ (49) text "aaa "
  |   ├ (52) equation 
  |   └ (53) text " bbb"
  ├ (50) paragraph 
  | ├ (60) mark ids: [ zjzth ]
  | | └ (51) text "aaa "
  | ├ (62) equation 
  | └ (64) mark ids: [ zjzth ]
  |   └ (63) text " bbb"
  └ (65) paragraph

The expected behavior

I would have expected the equation to always be within the MarkNode, like in point 2.

Impact of fix

In the Rember editor, we use MarkNodes for text occlusion flashcards (basically fill-in-the-blank quizzes) to mark the portion of text to occlude. This bug makes it hard for users to create text occlusion flashcards which contain equations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions