Skip to content

Bug: Numbered List Resets After Page Break in Lexical Editor #7032

Open
@PatrickAfshar

Description

Lexical version: 0.22.0

When using the lexical-list plugin in a Lexical Editor to create nested numbered lists, adding a page break resets the numbering of the list to 1. This disrupts the continuity of numbered lists and affects the user experience, particularly when working with structured or formatted content.
Steps to Reproduce:
Add the lexical-list plugin to a Lexical Editor instance.
Create a numbered list with multiple items.
Insert a page break in the middle of the list.
Continue the list after the page break.
Observe that the numbering resets to 1 instead of continuing from the previous number.
Expected Behavior:
Numbered lists should retain their numbering across a page break, ensuring continuity in the sequence.
Actual Behavior:
The numbering of the list resets to 1 after a page break, disrupting the expected sequence.
Suggested Solution:
Implement a custom PageBreakNode that integrates into the Lexical Editor without disrupting the list numbering.
Define a new PageBreakNode class to represent page breaks in the Lexical state.
Ensure the PageBreakNode doesn't interrupt the context of the list plugin.
Modify the lexical-list plugin to:
Skip over PageBreakNode when calculating numbering.
Maintain the correct list numbering across sections divided by page breaks.
Add test cases for:
Numbered lists with a single page break.
Nested lists with page breaks.
Multiple page breaks in a single editor instance.
Environment:
Lexical Version: [Specify your version]
Browser: [Specify browser and version]
Operating System: [Specify OS and version]
Additional Context:
This issue is relevant for scenarios where users need structured numbering, such as creating documents or outlines. A seamless solution will enhance the usability of the lexical-list plugin in content-heavy applications.
image

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions