mjml
mjml copied to clipboard
mj-image broken when used in a body with width
Given the following template:
<mjml>
<mj-body width="800px">
<mj-section padding="0">
<mj-column>
<mj-image padding="0" width="800px" src="https://picsum.photos/id/1002/4312/2868"></mj-image>
</mj-column>
</mj-section>
</mj-body>
</mjml>
Mjml renders this:
But grapesjs-mjml renders this:
Notice the left-right padding of the image?
The reason this happens is that mj-image generates a width while considering the width of surrounding boxes (and the root mj-body). However, in grapes, the mj-image is rendered in a body with no width.
I cannot think of a simple fix to this. Any suggestions are welcomed.
Did you find a workaround for this?
Unfortunately, MJML compiler doesn't work perfectly with standalone components and changes its HTML code based on the entire code. Probably, in this case, we should update the view post-render