Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly import mjml with composed attributes #197

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

aki-ks
Copy link
Contributor

@aki-ks aki-ks commented Aug 31, 2020

If currently a composed attribute such as "padding: 10px 20px 30px 40px" is contained in an imported template, the default values are loaded and the value from the template is ignored.

This is caused by the "style-default" attribute containing "padding-left", "padding-right", "padding-top" and "padding-bottom" for many components. These default attributes are merged with the values of the imported templates. The more specific "padding-top/bottom/left/right" attributes containing the default values will have precedence over the "padding" attribute from the template.


To reproduce the error import the following code with the latest revision of grapes-mjml and the default padding will be set for the section instead of 100px.

<mjml>
  <mj-body>
    <mj-section background-color="red" padding="100px">
      <mj-column>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Now in comparison import the following mjml which displays with a padding of 100px.
If you compile both examples with the mjml compiler or at https://mjml.io/try-it-live/, both will have a padding of 100px.

<mjml>
  <mj-body>
    <mj-section background-color="red" padding-left="100px" padding-right="100px" padding-top="100px" padding-bottom="100px">
      <mj-column>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

Copy link
Collaborator

@DRoet DRoet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change

src/components/Image.js Outdated Show resolved Hide resolved
Co-authored-by: Daan Roet <DRoet@users.noreply.github.com>
@DRoet DRoet merged commit 281980a into GrapesJS:master Aug 31, 2020
@DRoet
Copy link
Collaborator

DRoet commented Aug 31, 2020

thanks! released in v0.2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants