Replies: 1 comment
-
Hello, const editor = grapesjs.init({})
editor.on('component:drag', ({
target: draggedComp,
parent: parentComp,
index
}) => {
// If parentComp is not your container, then parentComp.set('droppable', false) or another similar way
console.log({
draggedComp,
parentComp,
index
})
}) 🤔 Sources: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. I need to prevent dropping of certain components onto others, but I need to make the decision during the drag operation. Is there a way to hook into the drag operation and prevent the various "insertion" indicators and / or prevent a drop from taking place?
One of my use cases is to allow reordering of elements within a container, but not allow those elements to be dragged out to other containers. So if I'm dragging a component and move it outside the container, other containers will not be able to receive the dragged component.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions