:画布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
Want to Add fixed sized height of canvas
我用它来制作动态PDF内容。 我想固定画布的高度,这样用户就不能从给定大小(高度)添加更多方块。 我想要删除滚动和一个消息或限制,比如不能添加更多物品之类的。 在同一个地方找到了一个旧问题 https://github.com/artf/grapesjs/issues/1803...
问题 #3564
Unable to refresh the iframe
0.17.19 你能重现演示中的bug吗? 是的 预期的行为是什么? 我之前问过一个关于iframe刷新(#3413)的问题。[提案的解决方案](https://github.com/artf/grapesjs/issues/3413#issuecomment-83189223...
问题 #3413
Adding inline scripts and updating old events
在这种情况下,我建议你访问iframe的文档,手动添加内联脚本(要获取文档,请使用'editor.“。Canvas.getDocument()') Originally由@artf在 https://github.com/artf/grapesjs/issues/2012#is...
问题 #3282
CleanId function not working with MJML code
即使在最新版本的 grapesjs(0.16.41)上,CleanID 仍然无法支持 MJML 代码。 这和这个已关闭的问题有关:https://github.com/artf/grapesjs/issues/3276 这个函数不会读取MJML标签:“attrs”是空的,我找不...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
Introducing Search on GJS.Market
GJS.Market now has one search across everything we publish — plugins, articles, community questions, guides, authors and services. Press ⌘K from any page.
教程
GJS.Market Is Now Available for India 🇮🇳
GJS.Market is expanding its global presence with a dedicated experience for developers, agencies, SaaS companies, and digital creators in India
教程
如何在2026年用 GrapesJS 构建AI驱动的页面构建器
我们构建GJSDocs的经验——从简单的AI文本生成到结构化、上下文感知的视觉编辑
浏览插件分类
直接跳转到市场上的插件分类页面。