#17288·mautic

[Bug] MJML builder wraps inline spans in block-level divs, breaking paragraph layout

Author: JustinKeltnerCreated Sep 7, 2026Updated Sep 25, 2026
Labelsbugbuilder-grapesjs

Mautic Series

7.1.x series

Mautic installed version

7.2.0

Way of installing

I downloaded a release from https://www.mautic.org/mautic-releases

PHP version

8.3

What browsers are you seeing the problem on?

Chrome

What happened?

Cloning a template email via the UI (or opening it in the MJML/GrapesJS builder) and saving - with ZERO edits to the footer - rewrites the footer MJML: a single mj-text paragraph with mixed inline children (styled spans + unsubscribe link) is split into empty

remnants, each span hoisted into its own
, plus extra nbsp spacer blocks. The compiled HTML gains block-level splits (footer lines stack instead of flowing) and gjs-* classes. I expected the clone to be byte-identical to the source until I edit something.

How can we reproduce this issue?

  1. New template email with MJML footer:

    Disclaimer text. Unsubscribe here.. note. | {webview_text}.

    (any paragraph with element children - links/styled spans - triggers it; bare {unsubscribe_text} tokens do not, they contain no elements).
  2. Save. Clone it via the UI - this forwards straight into the edit/builder page.
  3. Save to finish the clone (no edits).
  4. Inspect the clone custom_mjml (bundle_grapesjsbuilder) and compiled custom_html: paragraph split, spans wrapped, nbsp blocks added, footer lines stack. Suspected code: plugins/GrapesJsBuilderBundle/Assets/library/js/builder.service.js normalizeTextComponentContainer(s)/wrapHeadingComponentWithDiv on editor load/component:add/rte:disable, plus MJML parse splitting mixed-inline

    children so nested spans lose their text ancestor; getDataSlotTextPlugin re-maps wrappers so damage compounds on re-parse. Workaround: duplicate the emails + bundle_grapesjsbuilder rows directly (or via API) without opening the builder

Relevant log output

bash

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct



Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.