Skip to content

blocksToFullHTML and blocksToHTMLLossy produces broken tables #1574

Closed

Description

@Vadim-Karpenko

Describe the bug
The lack of tableWrapper, tableWrapper-inner, and inline styling (such as <table style="--default-cell-min-width: 120px; min-width: 494px;">) in the output HTML results in unstyled tables, which are entirely different from what we have in the editor.

To Reproduce

  1. Create any table.

Image

  1. Output it using blocksToFullHTML or blocksToHTMLLossy

Image

Code

Activity

  1. linear commented on Aug 14, 2025

    @linear

    from matthewlipski:

    Hi, one of the reasons the styles are off is because exporting blocks to HTML only exports the HTML elements corresponding to those blocks. This doesn't include some wrapping elements of the editor, which are necessary for styling. You can fix that by rendering the exported HTML in such a structure:

    <div className="bn-container bn-mantine dark" data-color-scheme="dark">
      <div className="ProseMirror bn-editor bn-default-styles" >
        {exportedHTML}
      </div>
    </div>

    Note that this has some dark theme specific classes/attributes too. Check the .bn-container and .bn-editor elements in your specific use case to see what you classes/attributes you need.

    Also, the column widths are not being exported properly atm. I've created PR #1947 to address this, so that'll be shipped in the next release.

  2. YousefED commented on Aug 18, 2025

    @YousefED
    Collaborator

    @matthewlipski should we explain this in the docs / example? (wrapping classes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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