mjml
mjml copied to clipboard
how to export the HTML
Hi Artf,
I seem to be bothering you on all fronts. Sorry.
I want to be able to get the converted mjml (HTML). What command should I use to get this?
If i open the "view code" dialog if gives the error: "Line 22 (mj-body) — Element mj-body doesn't exist or is not registered" . The mjml side all looks fine but nothing renders on the HTML side.
It also throws a js error:
grapes.min.js:2 Uncaught TypeError: Cannot read property 'split' of undefined at Xs (grapes.min.js:2) at Pa.splitLines (grapes.min.js:2) at Pa.<anonymous> (grapes.min.js:2) at Pa.setValue (grapes.min.js:2) at Ho.setValue (grapes.min.js:2) at n.setContent (grapes.min.js:2) at n.run (grapesjs-mjml.min.js:108) at n.updateActive (grapes.min.js:2) at y (grapes.min.js:2) at v (grapes.min.js:2)
editor.runCommand('mjml-get-code')
should output the html code
@artf When are you going to update this repo with more stable version ?
Thanks for your initiative, Amazing Work 👍
I still get the error:
"Line 22 (mjml) — Element mjml doesn't exist or is not registered"
and "Line 22 (mj-body) — Element mj-body doesn't exist or is not registered"
.
I don't output the content between the gjs tags. I rely on pulling data from the Store manager. I think this causes the issue:
storageManager: { type: 'remote', stepsBeforeSave: 5, autoload: true, autosave: true, urlStore: '<?php echo Yii::app()->baseUrl . '/index.php/campaigns/'.$campaign->campaign_uid.'/push_campaign_template'; ?>', urlLoad: '<?php echo Yii::app()->baseUrl . '/index.php/campaigns/'.$campaign->campaign_uid.'/pull_campaign_template'; ?>', contentTypeJson: true, params: {}, },
Figured it out.
const mjml = opt.preMjml + editor.getHtml() + opt.postMjml;
Appends
@Chronis77 good to know, but I didn't get if the error is caused by your config with preMjml
/postMjml
or something else
If you include the tags:
into your code it does not work. Your code appends those tags already, so you end up getting something like:
which the converter then fails on.
Any code did not work for me. I found it from source code
editor.runCommand('mjml-code-to-html')?.html