Issue #1409Opened September 7, 2018by YashPrince0 reactions

Component Drag Event

Question

I want to know how can I get that component from which element is dragged and drop to the other component. I need to add a class if component become empty if element is dragged and droped to the outside element. I can get the component which dragged and in which it droped but not from where it dragged. Any Help would be appreciated.

dragevent

Answers (3)

artfSeptember 11, 20180 reactions

In your case, I think it would be better listen to inner components changes (eg. what if I delete all children components?), but currently, there is no such an event, so I'll try to add it for the next release. It should be something like this

editor.on('component:update:components', component => {
	// just modify the view element
	const el = component.getEl();
	const hasChildren = component.components().length;
	el.classList[hasChildren ? 'remove' : 'add']('component--is-empty');
})
sakshigarg9March 25, 20190 reactions

@YashPrince how did you get the id of the dragged component and where it was dropped

lock[bot]March 27, 20200 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.