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

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

Closed
TechBill opened this issue Dec 1, 2021 · 14 comments
Closed

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

TechBill opened this issue Dec 1, 2021 · 14 comments

Comments

@TechBill
Copy link

TechBill commented Dec 1, 2021

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

@ronaldohoch
Copy link

@TechBill, have you discovered anything?

@TechBill
Copy link
Author

TechBill commented Sep 2, 2022

@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.

@ronaldohoch
Copy link

@DRoet can you help us with it?

@ronaldohoch
Copy link

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

@lechuhuuha
Copy link

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

@TechBill
Copy link
Author

TechBill commented Dec 2, 2022

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

@gustavohleal
Copy link
Contributor

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)

@lechuhuuha
Copy link

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

@gustavohleal
Copy link
Contributor

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.

@lechuhuuha
Copy link

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

@DRoet
Copy link
Collaborator

DRoet commented Dec 5, 2022

Fixed in v1.0.3

@DRoet DRoet closed this as completed Dec 5, 2022
@lechuhuuha
Copy link

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
Copy link

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.

@DRoet
Copy link
Collaborator

DRoet commented Dec 13, 2022

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

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

No branches or pull requests

5 participants