Skip to content

Bug: $generateHtmlFromNodes ignores alignment style in case of headings & lists #4243

@ionutcirja

Description

@ionutcirja

Hello, I have a little issue with generateHtmlFromNodes method.

const html = $generateHtmlFromNodes(editor, null);

Lexical version: 0.9.1

Steps To Reproduce

  1. In an editor I choose a paragraph and a right alignment and the result is: <p dir="ltr" style="text-align: right;"><span>text</span></p>
  2. If I change the paragraph to a heading tag or a list item the result is: <h1 class="text-2xl"><span>text</span></h1>.

The current behavior

As you can observe, the style attribute is missing for headings and lists.

The expected behavior

The style attribute should be set.

Thank you

Metadata

Metadata

Assignees

No one assigned

    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