mjmlio / mjml

MJML: the only framework that makes responsive-email easy
https://mjml.io
MIT License
17.08k stars 960 forks source link

Allow custom component to adjust allowed children #2110

Closed verbeeksteven closed 3 years ago

verbeeksteven commented 3 years ago

Hello,

In the linter it loops over each component (such as mj-column) and confirms that the component is allowed to be there.

But from what I can see there doesn't seem to be a way to say mj-custom-component is allowed to be placed inside a mj-column.

It would be nice if there was a way to this child could be part of what parents, rather then what children a parent can have.

Thanks,

iRyusa commented 3 years ago

It would be a bit confusing API wise to support both way IMO ?

verbeeksteven commented 3 years ago

Is there anyway to edit the existing components? Like can I add components to mj-column "registry"?

iRyusa commented 3 years ago

When you call the function it will append it to currently registered dependencies

verbeeksteven commented 3 years ago

@iRyusa which function are you referring to?

registerComponent(WhatEver)

That one?

iRyusa commented 3 years ago

You have an example in component boilerplate here : https://github.com/mjmlio/mjml-component-boilerplate/blob/master/components/MjImageText.js#L5-L9

verbeeksteven commented 3 years ago

Well shut the front door. Let's call this solved, my apologies I did not see this before. I think this method is perfectly fine.