mjml icon indicating copy to clipboard operation
mjml copied to clipboard

mj-image broken when used in a body with width

Open emilsedgh opened this issue 5 years ago • 3 comments

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:

Screenshot_20191102_101941

But grapesjs-mjml renders this:

Screenshot_20191102_102052

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.

Screenshot_20191102_102351

emilsedgh avatar Nov 02 '19 17:11 emilsedgh

I cannot think of a simple fix to this. Any suggestions are welcomed.

emilsedgh avatar Nov 02 '19 17:11 emilsedgh

Did you find a workaround for this?

Felix-Indoing avatar Nov 22 '19 14:11 Felix-Indoing

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

artf avatar Feb 05 '20 00:02 artf