CleanId函数无法与MJML代码兼容
问题
即使在最新版本的 grapesjs(0.16.41)上,CleanID 仍然无法支持 MJML 代码。
这和这个已关闭的问题有关:https://github.com/artf/grapesjs/issues/3276
htmlOpts.attributes = (mod, attrs) => {
const { id } = attrs;
console.log(attrs) // 这日志在HTML dom上运行良好,但在MJML中不行,我也不知道为什么
如果(
ID &&
id[0] === 'i' &&
!mod.get('script') &&
!mod.get('attributes').id &&
idRules.indexOf(id) < 0
) {
删除 attrs.id;
}
退货;
};
这个函数不会读取MJML标签:“attrs”是空的,我找不到原因......
回答(2)
id 问题应该已经在最新的 mjml 插件版本中解决了
谢谢你举报,@ThomasPof。 关于CleanId函数无法与MJML代码配合提出的好问题。GrapesJS 推荐的方法是使用事件驱动 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) => con...
相关问答
通过相似的问题讨论继续研究。
问题 #3276
CleanId函数无法与MJML代码兼容
这个问题是关于 MJML 代码的,但我觉得这更多是关于 grapesjs 而不是 grapesjs-mjml 有一个函数可以移除“src/code_manager/model/HtmlGenerator.js”中不必要的ID。这个函数在 HTML 标签上表现良好,但在 MJML...
问题 #3142
AssetManager 渲染问题
@artf这正是之前已经被解决过的[问题#2760](https://github.com/artf/grapesjs/issues/2760),这是错了还是我做错了?我本以为资源不会显示出来,但它们全都可见 ) and a dozen throwaway event listeners — this post is for you.
教程
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
教程
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
浏览插件分类
直接跳转到市场上的插件分类页面。