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

Get the rendered html from the editor? #348

Closed
casesolved-co-uk opened this issue Feb 17, 2024 · 2 comments
Closed

Get the rendered html from the editor? #348

casesolved-co-uk opened this issue Feb 17, 2024 · 2 comments

Comments

@casesolved-co-uk
Copy link

Hi,

I've not used typescript before so struggling to understand how I get the rendered HTML from an MJML template. getHTML() returns the MJML.

I can see I need to call the command cmdGetMjmlToHtml or mjml-code-to-html, how do I do that?

Thanks

@gustavohleal
Copy link
Contributor

Hi,

To run any command you call for `editor.runCommand("command-name").
I sugest you take a look at the tutorials in the grapesjs docs. Here you can see how to add custom commands and how to run them. https://grapesjs.com/docs/modules/Commands.html#basic-configuration

You can experiment more using the demo version of grapejs standard or with mjml online through the console in the devtools.

@casesolved-co-uk
Copy link
Author

Thanks @gustavohleal
I just figured out this.editor.Command.run, but runCommand is even better!

Yes it was in the documentation 😊

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

2 participants