HTML5 drag/drop support for ember components
- HTML5 drag/drop specification
- cross browser support (Chrome, Firefox, Safari, IE 10+)
- shim for
moz-drag-over
CSS psuedoclass
$ ember install ember-draggable
import Ember from 'ember';
import Draggable from 'ember-draggable/mixins/draggable';
import Droppable from 'ember-draggable/mixins/droppable';
// example draggable component
export default Ember.Component.extend(Draggable, {
model: null,
draggableData: Ember.computed.alias('model.id')
});
// example droppable component
export default Ember.Component.extend(Droppable, {
actions: {
drop(modelId) {
console.log('dropped model id: ', modelId);
}
}
});
import Ember from 'ember';
import Droppable from 'ember-draggable/mixins/droppable';
export default Ember.Component.extend(Droppable, {
acceptedDropTypes: [
'text/uri-list'
],
actions: {
drop(url) {
console.log('dropped link: ', url);
}
}
});
git clone
this repositorynpm install
bower install
ember server
- Visit your app at http://localhost:4200.
ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.