如何在Javascript中获取grapes.js的输出HTML和CSS?
我正在为时事通讯编写一个 Django 应用程序,其中我需要一个时事通讯编辑器,为此我使用了“grapes.js”时事通讯。一切都很好,但我被困在需要获取用它创建的模板的 HTML 和 CSS 的地方。
我有:
<script type="text/javascript">
var editor = grapesjs.init({
container : '#gjs',
plugins: ['gjs-preset-newsletter'],
pluginsOpts: {
'gjs-preset-newsletter': {
modalTitleImport: 'Import template',
'grapesjs-plugin-export': { /* options */ }
// ... other options
}
}
});
function returnHtml(){
console.log('test')
const mjml = editor.getHtml;
preview = editor.getHtml
$("#myiframe").contents().find("body").html(mjml)
}
returnHtml();
这段代码给了我模板的 html 但没有 css !
我试过https://github.com/artf/grapesjs-mjml/issues/2。有人可以建议我缺少什么吗?谢谢。