mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-13 12:10:23 +00:00
25 lines
553 B
JavaScript
25 lines
553 B
JavaScript
import Component from '@ember/component';
|
|
import { get } from '@ember/object';
|
|
|
|
export default Component.extend({
|
|
classNames: ['drop-region'],
|
|
classNameBindings: ['dragClass'],
|
|
dragClass: 'deactivated',
|
|
|
|
dragLeave(e) {
|
|
e.preventDefault();
|
|
this.set('dragClass', 'deactivated');
|
|
},
|
|
|
|
dragOver(e) {
|
|
e.preventDefault();
|
|
this.set('dragClass', 'activated');
|
|
},
|
|
|
|
drop(e) {
|
|
const data = e.dataTransfer.getData('text/data');
|
|
get(this, 'dropped')(data, get(this, 'param'));
|
|
this.set('dragClass', 'deactivated');
|
|
}
|
|
});
|