Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for nested lists #470

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

franz-sw
Copy link

Add Full Support for Nested Lists in RichText Editor

This pull request introduces comprehensive support for nested lists, including both OrderedList and UnorderedLists.

Key Features:

  • RichTextState Support: Added core functionality to handle nested lists.
  • Markdown Support: Correct parsing and rendering for nested lists in Markdown.
  • HTML Support: Proper rendering for nested lists in HTML phrasing.

Nested List Behavior:

Nesting levels are managed using an enum (ListNestedLevel) that supports three levels:

  1. Default indentation
  2. One level deeper
  3. Two levels deeper
Example:

Screenshot_20241220_190832_com mohamedrejeb richeditor android

You can control nesting levels programmatically with these public functions:

  • RichTextState.increaseListNestedLevel()
  • RichTextState.decreaseListNestedLevel()

Testing

To keep this PR focused, sample updates were excluded. You can test the functionality by adding the following snippet to RichTextStyleRow:

item {
    RichTextStyleButton(
        onClick = {
            state.decreaseListNestedLevel()
        },
        icon = Icons.AutoMirrored.Outlined.FormatIndentDecrease,
    )
}

item {
    RichTextStyleButton(
        onClick = {
            state.increaseListNestedLevel()
        },
        icon = Icons.AutoMirrored.Outlined.FormatIndentIncrease,
    )
}

This implementation provides a streamlined approach to nested list management, enhancing both Markdown and HTML capabilities. Feedback and suggestions are welcome! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant