ember-drag-drop icon indicating copy to clipboard operation
ember-drag-drop copied to clipboard

Accept drag class is not display when dragging over draggable-object

Open cbou opened this issue 9 years ago • 5 comments
trafficstars

accept_drag class is not set when you drag an object over a draggable-object even if it's contained by a draggable-object-target.

The class is not set but if you drop the object the action will be executed.

{{#draggable-object content=this}}
{{/draggable-object}}

{{#draggable-object-target action='dragged'}}
  {{#draggable-object content=this}}
  {{/draggable-object}}
  {{#draggable-object content=this}}
  {{/draggable-object}}
  {{#draggable-object content=this}}
  {{/draggable-object}}
{{/draggable-object-target}}

cbou avatar Sep 14 '16 13:09 cbou

I'll look into this later.

dgavey avatar Sep 14 '16 14:09 dgavey

Hi! I'm apparently facing the same issue. Has anyone worked out a fix, even temporary? Thank you!

Sype911 avatar Oct 27 '16 19:10 Sype911

+1

jzcorrea avatar Jul 02 '18 20:07 jzcorrea

@cbou @Sype911 I found an workaround by creating an custom component that extends from draggable-object and uses the dragEnter and dragLeave HTML5 events to manipulate a flag that adds or remove a CSS class when something is being dragged over the component:

import DraggableObject from 'ember-drag-drop/components/draggable-object';

export default DraggableObject.extend({

	classNameBindings: ['isDraggingOver:is-dragging-over'],

	isDraggingOver: false,

	dragEnter() {

		this.set('isDraggingOver', true);
	},

	dragLeave() {

		this.set('isDraggingOver', false);
	}
});

In my case, i want to change the element's style, not the parent's style (draggable-object-target, for example), but you can use jQuery to get the parent element and add/remove CSS classes manually. I have the same problem and i know this is not the best approach, but works. :grin:

jzcorrea avatar Jul 02 '18 21:07 jzcorrea

The same problem. I just forked this package and changed a function to return true.

Igor-Rabodzei avatar Nov 22 '19 16:11 Igor-Rabodzei