Skip to content

Commit

Permalink
Changes package version to 0.7.4_1
Browse files Browse the repository at this point in the history
Fixes file selection visible in Safari (fixes #115)
  • Loading branch information
jalik committed Feb 23, 2017
1 parent 939b1bd commit bb2aa7f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@ Some helpers are available by default to help you work with files inside templat

## Changelog

### Version 0.7.4_1
- Fixes file selection input visible in Safari

### Version 0.7.4
**Security fix, please upgrade as soon as possible**
- Fixes store callback events not being called : `onCopyError`, `onFinishUpload`, `onRead`, `onReadError`, `onWriteError`
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

Package.describe({
name: "jalik:ufs",
version: "0.7.4",
version: "0.7.4_1",
author: "karl.stein.pro@gmail.com",
summary: "Base package for UploadFS",
homepage: "https://github.com/jalik/jalik-ufs",
Expand Down
26 changes: 17 additions & 9 deletions ufs.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,20 @@ export const UploadFS = {
* @param callback
*/
selectFile(callback) {
let input = document.createElement('input');
const input = document.createElement('input');
input.type = 'file';
input.multiple = false;
input.onchange = (ev) => {
let files = ev.target.files;
callback.call(UploadFS, files[0]);
};
// Fix for iOS
input.style = 'display:none';
document.body.appendChild(input);
// Fix for iOS/Safari
const div = document.createElement('div');
div.className = 'ufs-file-selector';
div.style = 'display:none; height:0; width:0; overflow: hidden;';
div.appendChild(input);
document.body.appendChild(div);
// Trigger file selection
input.click();
},

Expand All @@ -199,19 +203,23 @@ export const UploadFS = {
* @param callback
*/
selectFiles(callback) {
let input = document.createElement('input');
const input = document.createElement('input');
input.type = 'file';
input.multiple = true;
input.onchange = (ev) => {
let files = ev.target.files;
const files = ev.target.files;

for (let i = 0; i < files.length; i += 1) {
callback.call(UploadFS, files[i]);
}
};
// Fix for iOS
input.style = 'display:none';
document.body.appendChild(input);
// Fix for iOS/Safari
const div = document.createElement('div');
div.className = 'ufs-file-selector';
div.style = 'display:none; height:0; width:0; overflow: hidden;';
div.appendChild(input);
document.body.appendChild(div);
// Trigger file selection
input.click();
}
};
Expand Down

0 comments on commit bb2aa7f

Please sign in to comment.