RangeError 最大呼叫堆栈大小超过。
你好@salemkode基于[自定义组件处理](https://grapesjs.com/docs/modules/Components.html#how-components-work),通过设置“isComponent”返回“true”且无条件,产生最大调用堆栈问题。 它会不断创建新组件,因为你也有“components”属性,但由于新类型在栈顶且总是返回“true”,它会一直引用自己。所以我建议你正确调整你的“isComponent”方法,或者干脆把它移除。
阅读下方完整回答 ↓问题
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? 勇敢 1.33.105 铬:96.0.4664.93 可复制演示链接 https://codesandbox.io/s/relaxed-mccarthy-v2e37w 描述一下那个虫子 如何复现这个漏洞?添加带有img或svg标签的组件类型将该组件添加到画布中 预期的行为是什么? 只要加法必须无误 目前的行为是什么? 它将会回归 “RangeError 最大呼叫堆栈大小已超过” 如果需要执行某些代码以重现该漏洞,请将其粘贴到下面: “''js const editor = Grapesjs.init({ 容器:“#gjs”, fromElement: 1, storageManager: { type: 0 } }); 编辑。DomComponents.addType(“img”, { isComponent: (el) => { 返回真值; }, 型号:{ 默认值:{ 名称:“主楼”, 组件:/HTML/ ' <img src=“https://brave.com/static-assets/images/brave-logo.svg” /> } } }); 编辑。BlockManager.add(“img”, { 标签:“主区块”, 媒体:“mainTextIcon”, 内容:[ { 类型:“_...
回答(2)
你好@salemkode基于[自定义组件处理](https://grapesjs.com/docs/modules/Components.html#how-components-work),通过设置“isComponent”返回“true”且无条件,产生最大调用堆栈问题。 它会不断创建新组件,因为你也有“components”属性,但由于新类型在栈顶且总是返回“true”,它会一直引用自己。所以我建议你正确调整你的“isComponent”方法,或者干脆把它移除。
谢谢你举报,@salemkode。 关于RangeError最大呼叫堆栈大小超过的好问题。推荐的 Canvas 方法是使用事件驱动的 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) => conso...
相关问答
通过相似的问题讨论继续研究。
问题 #6409
手机上无法拖动移动组件
葡萄JS版本 [x] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome v133 可复制演示链接 https://jsfiddle.net/2hjdrb7L/1/ 描述一下那个虫子 如何复现这个漏洞? 用grapesjs v0.22.x和grapesjs...
问题 #3806
添加视频时目标为零
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome新版本 可复制演示链接 https://codesandbox.io/s/react-redux-toolkit-application-forked-l5rhp?file=/src/...
问题 #4837
HTML元素的ID会在projectData加载的不同页面上递增
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Firefox 109 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 你好, 我注意到当我在 projectData 中加载多个 HTML 中使用...
问题 #6641
在设置扩展模型默认值时出现错误
GrapesJS版本 [x] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? 版本 141.0.7390.123(官方构建)(64位) 可复制演示链接 https://codesandbox.io/p/sandbox/jovial-elion-js8zgy?file...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
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.
教程
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.
浏览插件分类
直接跳转到市场上的插件分类页面。