mjml icon indicating copy to clipboard operation
mjml copied to clipboard

full-width="full-width" not working for section or wrapper

Open TechBill opened this issue 4 years ago • 4 comments

The attribute full-width doesn't seem to work for wrapper and section mjml components.

MJML try it live show it to be part of the attribute for section and wrapper

https://mjml.io/try-it-live/components/section

TechBill avatar Dec 01 '21 17:12 TechBill

@TechBill, have you discovered anything?

ronaldohoch avatar Sep 02 '22 17:09 ronaldohoch

@ronaldohoch It works just that editor doesn't render it probably.

We have to add it in then send a test email to ourselves or convert to HTML to confirm that it's working.

TechBill avatar Sep 02 '22 18:09 TechBill

@DRoet can you help us with it?

ronaldohoch avatar Sep 22 '22 14:09 ronaldohoch

WE DID IT!! Asap we will open a PR to it! https://www.loom.com/share/be13b096764045099b9b8fcdedd9b34c

ronaldohoch avatar Sep 23 '22 17:09 ronaldohoch

WE DID IT!! Asap we will open a PR to it! https://www.loom.com/share/be13b096764045099b9b8fcdedd9b34c

hi any update on PR. The editor still not render corretly althogh send mail work

lechuhuuha avatar Dec 02 '22 04:12 lechuhuuha

Been a year since I reported it .... I would be interested in the update as well too

TechBill avatar Dec 02 '22 13:12 TechBill

Oh yeah... I solved with @ronaldohoch and was going to open the PR but forgot. Sorry guys. Will do it this afternoon (in brazilian time)

gustavohleal avatar Dec 02 '22 14:12 gustavohleal

Oh yeah... I solved with @ronaldohoch and was going to open the PR but forgot. Sorry guys. Will do it this afternoon (in brazilian time)

thanks man its would help us a lot

lechuhuuha avatar Dec 02 '22 15:12 lechuhuuha

Just opened the PR. I would like to advise that this make the section and wrapper elements full width when selected. But is just the selection, the content and background still going to respect the 600px width limit when full-width is not selected. Once its selected than the background color or image will extend to the whole canvas. The problem was that when full-width is added the MJML engine would change the structure of the elements and the function getChildrenContainer()from grapes components would return the wrong query to get the childrens container. But also mj-body element add a div with max-width, so i removed this max-width when the body is rendered.

gustavohleal avatar Dec 02 '22 17:12 gustavohleal

Just opened the PR. I would like to advise that this make the section and wrapper elements full width when selected. But is just the selection, the content and background still going to respect the 600px width limit when full-width is not selected. Once its selected than the background color or image will extend to the whole canvas. The problem was that when full-width is added the MJML engine would change the structure of the elements and the function getChildrenContainer()from grapes components would return the wrong query to get the childrens container. But also mj-body element add a div with max-width, so i removed this max-width when the body is rendered.

thanks you very much for the fix. Mind if i ask one more question. Have you face this issues in this link some time i see the attribute added in style manager or trait manager and then the editor just strip out attribute or not render correctly

lechuhuuha avatar Dec 02 '22 18:12 lechuhuuha

Fixed in v1.0.3

DRoet avatar Dec 05 '22 15:12 DRoet

Just opened the PR. I would like to advise that this make the section and wrapper elements full width when selected. But is just the selection, the content and background still going to respect the 600px width limit when full-width is not selected. Once its selected than the background color or image will extend to the whole canvas. The problem was that when full-width is added the MJML engine would change the structure of the elements and the function getChildrenContainer()from grapes components would return the wrong query to get the childrens container. But also mj-body element add a div with max-width, so i removed this max-width when the body is rendered.

Hello. I see other bug is when you set backgroud-image on component wrapper and then set full-width on wrapper the editor did not render correctly You can test on the lastest version of this repo to see the bug

Expected behavior : image

The result: image

Did you encounter this issue before ?

Thanks

lechuhuuha avatar Dec 13 '22 10:12 lechuhuuha

Just opened the PR. I would like to advise that this make the section and wrapper elements full width when selected. But is just the selection, the content and background still going to respect the 600px width limit when full-width is not selected. Once its selected than the background color or image will extend to the whole canvas. The problem was that when full-width is added the MJML engine would change the structure of the elements and the function getChildrenContainer()from grapes components would return the wrong query to get the childrens container. But also mj-body element add a div with max-width, so i removed this max-width when the body is rendered.

Hello. I see other bug is when you set backgroud-image on component wrapper and then set full-width on wrapper the editor did not render correctly You can test on the lastest version of this repo to see the bug

Expected behavior : image

The result: image

Did you encounter this issue before ?

Thanks

Ok i manage to find where its got wrong

When you use full-width with background-url mjml will render another div so the children selector not get its right Change Wrapper.ts from this

      getChildrenSelector() {
        if (this.model.getAttributes()['full-width']) {
          return 'table > tbody > tr > td > div > table > tbody > tr > td';
        } else
          return 'table > tbody > tr > td';
      },

To this

      getChildrenSelector() {
        if (this.model.getAttributes()['full-width'] && this.model.getAttributes()['background-url']) {
          return 'table > tbody > tr > td > div > div > table > tbody > tr > td';
        } else if (this.model.getAttributes()['full-width']) {
          return 'table > tbody > tr > td > div > table > tbody > tr > td';

        }
        else
          return 'table > tbody > tr > td';
      },

So the editor will render correctly image

So far i dont see any side effect

Hope this help someone.

lechuhuuha avatar Dec 13 '22 16:12 lechuhuuha

@lechuhuuha feel free to open a PR so I can merge the fix

DRoet avatar Dec 13 '22 18:12 DRoet