Add drag and drop for attachments
Files can be dragged and dropped on the bottom in order to be added as attachments. Resolves: #260
This commit is contained in:
parent
4e416c6cbf
commit
cbbb8dfa24
1 changed files with 24 additions and 1 deletions
|
@ -22,7 +22,10 @@
|
|||
events: {
|
||||
'change': 'previewImages',
|
||||
'click .close': 'deleteFiles',
|
||||
'click .choose-file': 'open'
|
||||
'click .choose-file': 'open',
|
||||
'drop': 'openDropped',
|
||||
'dragover': 'showArea',
|
||||
'dragleave': 'hideArea'
|
||||
},
|
||||
|
||||
open: function() {
|
||||
|
@ -228,6 +231,26 @@
|
|||
this.$input.wrap('<form>').parent('form').trigger('reset');
|
||||
this.$input.unwrap();
|
||||
this.file = null;
|
||||
},
|
||||
|
||||
openDropped: function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
this.file = e.originalEvent.dataTransfer.files[0];
|
||||
this.previewImages();
|
||||
this.$el.removeClass("dropoff");
|
||||
},
|
||||
|
||||
showArea: function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
this.$el.addClass("dropoff");
|
||||
},
|
||||
|
||||
hideArea: function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
this.$el.removeClass("dropoff");
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue