Padding and background of mj-column cannot be configured / are ignored.
See original GitHub issueMJML allows to specify padding and background-color for mj-columns but such options are not available in grapesjs-mjml. When importing a template where e.g. a custom padding is set then those are ignored to.
I’ve tried to implement this by myself but I’m kind of confused since there’s a global attribute to set the padding of columns and the mj-section component has a custom render function.
Compare e.g the following mjml in mjml.io/try-it-live and grapes-mjml
<mjml>
<mj-body>
<mj-section>
<mj-column background-color="red" padding="100px">
<mj-text font-size="20px">Hello World</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Cannot override css (padding) on column total cells
I have tried using cell. addClass() and cell. attr in onCustomizeCell() to add a class and/or id attribute of 'noPadding' to the cells,...
Read more >Why am I unable to apply a border to an angular mat-table row?
Rows, columns, row groups, and column groups cannot have borders (i.e., user agents must ignore the border properties for those elements).
Read more >Modifier - Android Developers
Column import androidx.compose.foundation.layout.padding @Composable ... Attempts to use this Modifier on older Android versions will be ignored.
Read more >padding-bottom - CSS: Cascading Style Sheets | MDN
The padding-bottom CSS property sets the height of the padding area on the bottom of an element.
Read more >Create layout grids with grids, columns, and rows
Why aren't my layout grids showing? There are a couple of reasons why a layout grid may not be showing: The layout grid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@m-e-conroy
I had the same problem with padding being reseted to defaults (changes persisted on canvas but not on style manager).
padding was beign reseted because the padding property was being added with
detached: true
in https://github.com/artf/grapesjs-mjml/blob/df40b0c980cf65fe03d6d89b159213167d443635/src/style.js#L22so what i did was to “override” the padding style property with my own parameters:
another solution as well is to prevent style manager reset by setting
resetStyleManager: false
in mjmlpluginOpts
(keep in mind that you’ll have to provide your own property and sectors config)hope this helps anyone with the same problem
Hello again. Guys, find other bug, here is the solution:
What is the problem i find? Any other attribute, like css-class and id are turning into style. Part of that issue i describe there: https://github.com/artf/grapesjs/discussions/4022
So, i update the style variable line from this:
const style = Object.keys(this.model.get('style')).map(attr =>
${attr}😒{model_style[attr]};)
into this:Explanation: Here i’m using the property stylable from the component’s model to filter what will turn into style.