Override Drag functions
你好@artf我想覆盖“dmode ”absolute“' 的拖拽功能。 目前我们可以自由移动画布,如果在桌面上移动,其他移动端和桌面设备就不一样了。另外,我希望像素数是百分比,这样在整个屏幕上都能响应。 请问你能帮我从哪里开始,以及如何实现吗? 谢谢
artf
你必须[扩展](https://grapesjs.com/docs/modules/Commands.html#extending)[ComponentDrag](https://github.com/artf/grapesjs/blob/dev/src/commands/view/ComponentDrag.js)命令
GJSBlock
谢谢你举报,@Abhisheknanda1344463。 关于覆盖拖拽函数的好建议!虽然这个具体功能还没有出现在核心 API 中,但有几种方法可以实现类似的行为。 使用事件系统: “JavaScript editor.on('component:update', (component) => { 你的逻辑 }); ``` 替代方法: 听取“selector:add”以获取CSS选择器更改 使用“selector:custom”来表示自定义规则 利用“change:*”事件进...