Skip to content

Parsing nested bullet points HTML - Blocks #431

Closed
@caioebueno

Description

@caioebueno

In my app I am persisting the state of the editor in HTML using the blocksToHTML function. If I parse from blocks to HTML and parse the HTML to blocks later, it looses the nested bullet points and all points become in the same level.

EXP:
Screenshot 2023-11-30 at 10 25 23 AM

This input after parsed results in the following HTML (includes the nested items)

<ul>
  <li>
    <p class="_inlineContent_nstdf_297">Point A</p>
    <ul>
      <li>
        <p class="_inlineContent_nstdf_297">Point A1</p>
      </li>
    </ul>
  </li>
  <li>
    <p class="_inlineContent_nstdf_297">Point B</p>
  </li>
</ul>
<p class="_inlineContent_nstdf_297"></p>

After parsing to blocks and using as initial content this is the result

Screenshot 2023-11-30 at 10 28 35 AM

This is the result of parsing blocks to HTML again

<ul>
  <li>
    <p class="_inlineContent_nstdf_297">Point A</p>
  </li>
  <li>
    <p class="_inlineContent_nstdf_297">Point A1</p>
  </li>
  <li>
    <p class="_inlineContent_nstdf_297">Point B</p>
  </li>
</ul>
<p class="_inlineContent_nstdf_297"></p>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions