Open adrianodias8 opened 7 months ago
Try to check if this work
traits: [
{
label: 'Preview Text',
getValue: ({ component }) => component.getInnerHTML(),
setValue: ({ component, value }) => component.components(value)
}
],
Thanks for your reply! Will do that and then I ping back here if it works! If I manage it I will create a PR for that.
with this i couldn't make it work the value appears text box but it is added to the mjml tag as a empty attribute like ="whatever i wrote in my textbox"
traits: [
{
label: 'Preview Text',
getValue: ({ component }) => component.getInnerHTML(),
setValue: ({ component, value }) => component.components(value)
}
],
with
changeProp: true,
i can change the content of the tag but i have trouble if i have already some text in the tag and i can't get it to persist or the moment i go to preview i lose whatever i wrote in the textbox
hi, looking for same , any solution to the issue ?
Hi there!
First of all I would like to say that the tool is really nice! I was looking forward to use it and I'm currently trying to understand how grapesjs and this mjml plugin works.
I faced similar issue with mj-preview has https://github.com/GrapesJS/grapesjs/issues/5549
I tried to do as @artf said in: https://github.com/GrapesJS/grapesjs/issues/5549#issuecomment-1848949947
and here is what I did: (sorry my bad code I'm not proficient in typescript or js)
So I tried to register a new custom component: Preview.ts
and I load it in here
And I almost got it working as it supposed to with a trait to control the text.
Problem:
if in my mjml template i have
<mj-preview>Hello MJML</mj-preview>
"Hello MJML" is not loaded into the trait field.when i type something it will add to the existing value
I saw this: https://github.com/GrapesJS/grapesjs/issues?q=is%3Aissue+trait+change+value+is%3Aclosed+#issuecomment-1192600885
but it's not picking up the initial value or (most probably i'm missing something)
Can someone give me some guidance? Appreciate your time and effort!
Best, Adriano Dias