拖放组件:
你好, 对于未来的问题或技术问题(非漏洞),GitHub的[讨论](https://github.com/artf/grapesjs/discussions)标签是最佳选择。 如果问题已解决,请关闭,或在[讨论](https://github.com/artf/grapesjs/discussions)->[问答](https://github.com/artf/grapesjs/discussions/categories/q-a)类别写一条详细的新消息(并关闭本期)。 感谢你的理解。
阅读下方完整回答 ↓问题
你好,我遇到了以下问题: 我需要一个事件类型编辑器(“sorter: drag: end”),在所有这些情况下都会被投掷: (检测我投放的元素和位置) 1- 当你从blockManager拖放一个元素并放到画布上时,让它听到。 2- 当你把已经组件化的元素从画布拖到画布的另一个区域时,让它听到声音。 3- 当我在 layerManager 中移动元素时会听到这个声音。
用排序器我解决了情况2,1没有出现,因为元素还没有被分成,所以在尝试添加属性时,在被分成之前,它作为标准元素被添加到html画布中,忽略了我手动添加的属性。
你能帮我吗? 谢谢
回答(2)
你好,
对于未来的问题或技术问题(非漏洞),GitHub的[讨论](https://github.com/artf/grapesjs/discussions)标签是最佳选择。
如果问题已解决,请关闭,或在[讨论](https://github.com/artf/grapesjs/discussions)->[问答](https://github.com/artf/grapesjs/discussions/categories/q-a)类别写一条详细的新消息(并关闭本期)。
感谢你的理解。
谢谢你举报,@matiasmasciotta。 关于拖放组件的好问题。ProseMirror 推荐的方法是使用事件驱动的 API。 从这里开始: 查看你所在模块的[GrapesJS文档](https://grapesjs.com/docs/) 寻找“on()”事件监听器方法 大多数操作可以通过监听编辑器和组件事件来实现 常见模式: “JavaScript 留意变化 editor.on('change', () => console.log('something changed')); 组件生命周期 editor.on('component:mount', (c) => console.log...
相关问答
通过相似的问题讨论继续研究。
问题 #4837
HTML元素的ID会在projectData加载的不同页面上递增
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Firefox 109 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 你好, 我注意到当我在 projectData 中加载多个 HTML 中使用...
问题 #6324
Sorter.setDragHelper 不是块拖拉的函数
葡萄JS版本[X] 我确认使用最新版本的GrapesJS你用的是什么浏览器? 131.0.6778.86可复制演示链接 https://jsfiddle.net/badiuciprian/qe28obhr/1/描述一下那个虫子 如何复现这个漏洞?尝试将任意方块拖到画布上 预期的...
问题 #5584
当所有组件都挂载到画布中时,“存储:结束:加载”事件不会触发
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome v91 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 如何复现这个漏洞? 最近我必须将 grapesjs v0.14.62 升级到最...
问题 #5378
未捕获类型错误:在图层管理器面板拖动组件时无法读取未定义属性(读取“Canvas”)。
葡萄JS版本 [X] 我确认使用最新版本的GrapesJS 你用的是什么浏览器? Chrome v116.0.5845.97 可复制演示链接 https://grapesjs.com/demo.html 描述一下那个虫子 如何复现这个漏洞?从画布中选择任意组件打开图层管理器面板...
与此问题匹配的付费插件
根据问题关键词和标签相关性精选,助你更快交付。
正在加载付费插件推荐……
相关教程
关于同一主题的深入指南。
教程
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.
浏览插件分类
直接跳转到市场上的插件分类页面。