Skip to content

Commit

Permalink
[cmd:upload] fix #2531 upload buttons are not working in Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Jun 5, 2018
1 parent f115340 commit 886ddb6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 3 additions & 2 deletions css/dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,15 @@ button.elfinder-info-button {
position: absolute;
right: 0;
top: 0;
width: 100%;
opacity: 0;
filter: Alpha(Opacity=0);
}

.elfinder-upload-dialog-wrapper .ui-button form input {
padding: 0 20px;
padding: 50px 0 0;
font-size: 3em;

width: 100%;
}

/* dialog for elFinder itself */
Expand Down
18 changes: 15 additions & 3 deletions js/commands/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,32 @@ elFinder.prototype.commands.upload = function() {
inputButton = function(type, caption) {
var button,
input = $('<input type="file" ' + type + '/>')
.on('click', function() {
// for IE's bug
if (fm.UA.IE) {
setTimeout(function() {
form.css('display', 'none').css('position', 'relative');
requestAnimationFrame(function() {
form.css('display', '').css('position', '');
});
}, 100);
}
})
.on('change', function() {
upload({input : input.get(0), type : 'files'});
})
.on('dragover', function(e) {
e.originalEvent.dataTransfer.dropEffect = 'copy';
});
}),
form = $('<form/>').append(input);

return $('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only elfinder-tabstop elfinder-focus"><span class="ui-button-text">'+fm.i18n(caption)+'</span></div>')
.append($('<form/>').append(input))
.append(form)
.on('click', function(e) {
if (e.target === this) {
e.stopPropagation();
e.preventDefault();
input.click();
input.trigger('click');
}
})
.on('mouseenter mouseleave', function(e) {
Expand Down

0 comments on commit 886ddb6

Please sign in to comment.