mirror of https://github.com/keeweb/keeweb.git
fix #190: allow selecting attachments with click
This commit is contained in:
parent
d61b60d316
commit
a5da669a3b
|
@ -52,6 +52,8 @@ var DetailsView = Backbone.View.extend({
|
|||
'click .details__buttons-trash': 'moveToTrash',
|
||||
'click .details__buttons-trash-del': 'deleteFromTrash',
|
||||
'click .details__back-button': 'backClick',
|
||||
'click .details__attachment-add': 'attachmentBtnClick',
|
||||
'change .details__attachment-input-file': 'attachmentFileChange',
|
||||
'dragover .details': 'dragover',
|
||||
'dragleave .details': 'dragleave',
|
||||
'drop .details': 'drop'
|
||||
|
@ -565,6 +567,18 @@ var DetailsView = Backbone.View.extend({
|
|||
this.$el.find('.details').removeClass('details--drag');
|
||||
this.dragging = false;
|
||||
var files = e.target.files || e.originalEvent.dataTransfer.files;
|
||||
this.addAttachedFiles(files);
|
||||
},
|
||||
|
||||
attachmentBtnClick: function() {
|
||||
this.$el.find('.details__attachment-input-file')[0].click();
|
||||
},
|
||||
|
||||
attachmentFileChange: function(e) {
|
||||
this.addAttachedFiles(e.target.files);
|
||||
},
|
||||
|
||||
addAttachedFiles: function(files) {
|
||||
_.forEach(files, function(file) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = (function() {
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
<i class="details__buttons-trash fa fa-trash-o" title="{{res 'detDelEntry'}}" tip-placement="top"></i>
|
||||
{{~/if~}}
|
||||
<div class="details__attachments">
|
||||
<input type="file" class="details__attachment-input-file hide-by-pos" multiple />
|
||||
{{#each attachments as |attachment ix|}}
|
||||
<div class="details__attachment" data-id="{{ix}}"><i class="fa fa-{{attachment.icon}}"></i> {{attachment.title}}</div>
|
||||
{{else}}
|
||||
|
|
|
@ -2,6 +2,7 @@ Release notes
|
|||
-------------
|
||||
|
||||
##### v1.2.0 (TBD)
|
||||
`+` allow selecting attachments with click
|
||||
`+` register file associations
|
||||
`-` prevent second app instance on windows
|
||||
|
||||
|
|
Loading…
Reference in New Issue