:画布iframe中的文档类型
在下一个版本中,我会添加一个新的事件辅助工具,允许在加载前编辑 iframe 内容: “''js editor.on('frame:load:before', ({ el }) => { const doc = el.contentDocument; 文档开启(); doc.write(“<!DOCTYPE html>”); 文档关闭(); }); ```
阅读下方完整回答 ↓问题
嗨。 这个问题已经被问过两次([这里](https://github.com/artf/grapesjs/issues/973)和[这里](https://github.com/artf/grapesjs/issues/1230)),但从未有过答案。
有没有办法在画布iframe的开头加上'<!DOCTYPE html>',这样iframe就会进入标准模式?
我需要这个,因为我想用tinyMce作为自定义RTE,而tinyMce需要标准模式。
回答(4)
在下一个版本中,我会添加一个新的事件辅助工具,允许在加载前编辑 iframe 内容: “''js editor.on('frame:load:before', ({ el }) => { const doc = el.contentDocument; 文档开启(); doc.write(“<!DOCTYPE html>”); 文档关闭(); });
你好,
对于未来的问题或技术问题(非漏洞),GitHub的[讨论](https://github.com/artf/grapesjs/discussions)标签是最佳选择。
如果问题已解决,请关闭,或在[讨论](https://github.com/artf/grapesjs/discussions)->[问答](https://github.com/artf/grapesjs/discussions/categories/q-a)类别写一条详细的新消息(并关闭本期)。
感谢你的理解。
不太有,但我愿意听听如何让它可自定义的解决方案。
谢谢你举报,@ashercoren。 关于[问题]:画布iframe中的文档类型,这是一个很好的问题。ProseMirror 推荐的方法是使用事件驱动的 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c...
相关问答
通过相似的问题讨论继续研究。
问题 #3722
想添加固定大小的画布高度
我用它来制作动态PDF内容。 我想固定画布的高度,这样用户就不能从给定大小(高度)添加更多方块。 我想要删除滚动和一个消息或限制,比如不能添加更多物品之类的。 在同一个地方找到了一个旧问题 https://github.com/artf/grapesjs/issues/1803...
问题 #3564
无法刷新iframe
0.17.19 你能重现演示中的bug吗? 是的 预期的行为是什么? 我之前问过一个关于iframe刷新(#3413)的问题。[提案的解决方案](https://github.com/artf/grapesjs/issues/3413#issuecomment-83189223...
问题 #3413
添加内联脚本和更新旧事件
在这种情况下,我建议你访问iframe的文档,手动添加内联脚本(要获取文档,请使用'editor.“。Canvas.getDocument()') Originally由@artf在 https://github.com/artf/grapesjs/issues/2012#is...
问题 #3282
CleanId函数无法与MJML代码兼容
即使在最新版本的 grapesjs(0.16.41)上,CleanID 仍然无法支持 MJML 代码。 这和这个已关闭的问题有关:https://github.com/artf/grapesjs/issues/3276 这个函数不会读取MJML标签:“attrs”是空的,我找不...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
Vanilla GrapesJS vs GrapesJS With Plugins: What You Actually Get Out of the Box (2026)
New to GrapesJS? See exactly what the stock editor gives you, where it falls short, and which plugins close the gaps — a beginner-friendly 2026 comparison
教程
Lighthouse for GrapesJS: Audit Accessibility and SEO Without Leaving the Editor
Live WCAG 2.1/2.2 accessibility auditor + SEO manager for GrapesJS. Every finding is bound to the exact component — click to select, then one-click fix.
教程
GrapesJS DevTools: A Developer Panel Inside Your Editor
If you've ever debugged GrapesJS with console.log(editor.getSelected()) and a dozen throwaway event listeners — this post is for you.
浏览插件分类
直接跳转到市场上的插件分类页面。